0.7.1 • Published 29 days ago

@mattermost/react-native-paste-input v0.7.1

Weekly downloads
3
License
MIT
Repository
github
Last release
29 days ago

@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

npm i --save-exact @mattermost/react-native-paste-input

Demo

AndroidiOS
AndroidiOS

Usage

import React, { useRef } from 'react';
import PasteInput, { PastedFile, PasteInputRef } from "@mattermost/react-native-paste-input";

const YourTextInput = () => {
    const inputRef = useRef<PasteInputRef>(null);

    const onPaste = (
        error: string | null | undefined,
        files: Array<PastedFile>
    ) => {
        console.log('ERROR', error);
        console.log('PASTED FILES', files);
    };

    return (
        <PasteInput
            ref={inputRef}
            disableCopyPaste={false}
            onPaste={onPaste}
            multiline={true}
            blurOnSubmit={false}
            underlineColorAndroid="transparent"
            keyboardType="default"
            disableFullscreenUI={true}
            textContentType="none"
            autoCompleteType="off"
        />
    );
}

Properties

All properties of the 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 to learn how to contribute to the repository and the development workflow.

License

MIT

0.7.1

29 days ago

0.6.3

10 months ago

0.6.4

10 months ago

0.7.0

6 months ago

0.6.2

1 year ago

0.6.1

1 year ago

0.5.2

1 year ago

0.6.0

1 year ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.2

2 years ago

0.4.0

2 years ago

0.3.6

2 years ago

0.3.7

2 years ago

0.3.5

2 years ago

0.3.4

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago