Have ideas to improve npm?Join in the discussion! »

    @rescript-react-native/clipboard

    1.5.2 • Public • Published

    @rescript-react-native/clipboard

    Build Status Version ReScript Forum

    ReScript bindings for @react-native-community/clipboard.

    Exposed as ReactNativeClipboard module.

    @rescript-react-native/clipboard X.y.* means it's compatible with @react-native-community/clipboard X.y.*

    Installation

    When @react-native-community/clipboard is properly installed & configured by following their installation instructions, you can install the bindings:

    npm install @rescript-react-native/clipboard
    # or
    yarn add @rescript-react-native/clipboard

    @rescript-react-native/clipboard should be added to bs-dependencies in your bsconfig.json:

    {
      //...
      "bs-dependencies": [
        "@rescript/react",
        "rescript-react-native",
        // ...
    +    "@rescript-react-native/clipboard"
      ],
      //...
    }

    Usage

    Methods

    getString

    To attempt reading content from the Clipboard; resolves to a string if successful.

    getString: unit => Js.Promise.t(string)

    setString

    To copy a string to the Clipbard.

    setString: string => unit

    Hooks

    useClipboard

    useClipboard: unit => (string, string => unit)

    Example

    open ReactNative;
    
    ReactNativeClipboard.setString("initial value");
    
    let make = () => {
      let (data, setData) = ReactNativeClipboard.useClipboard();
    
      <View>
        <Button title=data onPress={_ => setData("new value")} />
      </View>
    
    };

    Changelog

    Check the changelog for more informations about recent releases.


    Contribute

    Read the contribution guidelines before contributing.

    Code of Conduct

    We want this community to be friendly and respectful to each other. Please read our full code of conduct so that you can understand what actions will and will not be tolerated.

    Install

    npm i @rescript-react-native/clipboard

    DownloadsWeekly Downloads

    0

    Version

    1.5.2

    License

    MIT

    Unpacked Size

    6.32 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar