react-native-documents/document-picker

TypeError: null is not an object (evaluating 'RNDocumentPicker.pick')

Closed this issue · 2 comments

dotku commented

Here is my full code, I got error with TypeError, null is not an object?!
Why?

import React from "react";
import { View } from "react-native";
import { Button, IconButton, TextInput } from "react-native-paper";
import DocumentPicker from "react-native-document-picker";

export default function PostAdd() {
  const selectFile = () => {
    DocumentPicker.pick({
      type: [DocumentPicker.types.allFiles],
    }).then((res) => {
      console.log("res : " + JSON.stringify(res));
    });
  };

  return (
    <View>
      <TextInput
        multiline
        numberOfLines={5}
        placeholder="What's on your mind?"
      />
      <IconButton icon="camera" onPress={selectFile} />
      <Button>Post</Button>
    </View>
  );
}

On iOS, running pod install in ios directory fixed this for me.

👋 @dotku, sorry you're having an issue. This issue is being closed because it does not provide all information required by the issue template.
As the issue template explains, we require that you provide a runnable example that reproduces your issue and your environment information. This means you need to provide a git repository with code that reproduces the issue.
The reason is that maintainers do not have time to try reproduce bugs themselves. Please try to minimize the superfluous code and focus only on reproducing the bug.
Please create a new issue with this and we'll be happy to review it!