https://github.com/mattermost/react-native-paste-input
React Native TextInput replacement to allow pasting files
https://github.com/mattermost/react-native-paste-input
Last synced: 5 months ago
JSON representation
React Native TextInput replacement to allow pasting files
- Host: GitHub
- URL: https://github.com/mattermost/react-native-paste-input
- Owner: mattermost
- License: mit
- Created: 2020-11-04T22:38:41.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-09T12:36:28.000Z (10 months ago)
- Last Synced: 2025-07-30T08:04:28.721Z (6 months ago)
- Language: Objective-C
- Size: 28.1 MB
- Stars: 178
- Watchers: 7
- Forks: 30
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# @mattermost/react-native-paste-input
React Native `TextInput` component have functionality to capture text input from a user
by using the soft and hardware keyboards but lacks the ability to restrict copy & paste options
as well as allwing pasting different files formats copied from other apps, like images & videos from
the Photos gallery app.
`PasteInput` is a `TextInput` replacement that solves this issues.
## Installation
```sh
npm i --save-exact @mattermost/react-native-paste-input
```
## Demo
| Android | iOS |
|-- |-- |
|||
## Usage
```js
import React, { useRef } from 'react';
import PasteInput, { PastedFile, PasteInputRef } from "@mattermost/react-native-paste-input";
const YourTextInput = () => {
const inputRef = useRef(null);
const onPaste = (
error: string | null | undefined,
files: Array
) => {
console.log('ERROR', error);
console.log('PASTED FILES', files);
};
return (
);
}
```
### Properties
All properties of the [TextInput](!https://reactnative.dev/docs/textinput) component plus:
##### `disableCopyPaste: boolean`
Indicates if the menu items for *cut*, *copy*, *paste* and *share* should not be present in the context menu.
##### `onPaste: (error, files) => void`
Callback that is called when the pasting files into the text input.
*Note: On Android this callback is also called when selecting and image / gif from the soft keyboard.*
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT