uppy/website/src/docs/react-native.md
Antoine du Hamel c48064ba56
doc: lint JS code snippets (#2954)
* doc: lint JS code snippets

* deps: update `lint-staged` deps

* Fix remaining lint warnings and errors

Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2021-07-04 19:32:50 +02:00

1.6 KiB
Raw Blame History

title type module permalink order category
React Native docs @uppy/react-native docs/react/native/ 8 React

⚠️ In Beta

@uppy/react-native is a basic Uppy component for React Native with Expo. It is in Beta, and is not full-featured. You can select local images or videos, take pictures with a camera or add any files from remote urls with the help of a server-side component, Uppy Companion.

Make sure to check out the example in examples/react-native-expo.

Installation

Install from NPM:

npm install @uppy/react-native
import React from 'react'
import UppyFilePicker from '@uppy/react-native'

export default function MyComponent (props) {
  return (
    <UppyFilePicker
      uppy={props.uppy}
      show={props.isFilePickerVisible}
      onRequestClose={props.hideFilePicker}
      companionUrl="https://server.uppy.io"
    />
  )
}

Props

The <UppyFilePicker> component supports the following props:

uppy

The uppy instance. Initialize in constructor, add all the nessesary plugins, set up event listeners, before passing as a prop.

show

Boolean — the <UppyFilePicker> modal component will be rendered when set to true.

onRequestClose

A callback thats called when a file is picked or a “close” button is pressed. Use it to hide <UppyFilePicker>, like in the example above.

companionUrl

Uppy Companion url.