https://github.com/rescript-react-native/clipboard
ReScript bindings for @react-native-community/clipboard
https://github.com/rescript-react-native/clipboard
clipboard react react-native rescript rescript-react rescript-react-native
Last synced: 9 months ago
JSON representation
ReScript bindings for @react-native-community/clipboard
- Host: GitHub
- URL: https://github.com/rescript-react-native/clipboard
- Owner: rescript-react-native
- License: mit
- Created: 2020-04-01T21:38:35.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-02-09T07:14:30.000Z (almost 3 years ago)
- Last Synced: 2025-04-13T12:08:41.170Z (9 months ago)
- Topics: clipboard, react, react-native, rescript, rescript-react, rescript-react-native
- Language: ReScript
- Homepage:
- Size: 844 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `@rescript-react-native/clipboard`
[](https://github.com/rescript-react-native/clipboard/actions)
[](https://www.npmjs.com/@rescript-react-native/clipboard)
[](https://forum.rescript-lang.org/)
[ReScript](https://rescript-lang.org) bindings for
[`@react-native-community/clipboard`](https://github.com/react-native-clipboard/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`](https://github.com/react-native-clipboard/clipboard)
is properly installed & configured by following their installation instructions,
you can install the bindings:
```console
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`:
```diff
{
//...
"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.
```rescript
getString: unit => Js.Promise.t(string)
```
### `setString`
To copy a `string` to the Clipbard.
```rescript
setString: string => unit
```
## Hooks
### `useClipboard`
```rescript
useClipboard: unit => (string, string => unit)
```
#### Example
```rescript
open ReactNative;
ReactNativeClipboard.setString("initial value");
let make = () => {
let (data, setData) = ReactNativeClipboard.useClipboard();
setData("new value")} />
};
```
---
## Changelog
Check the [changelog](./CHANGELOG.md) for more informations about recent
releases.
---
## Contribute
Read the
[contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md)
before contributing.
## Code of Conduct
We want this community to be friendly and respectful to each other. Please read
[our full code of conduct](https://github.com/rescript-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
so that you can understand what actions will and will not be tolerated.