Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinmoec/Fable.ReactNative.ImagePicker
Fable bindings for react-native-image-picker
https://github.com/martinmoec/Fable.ReactNative.ImagePicker
Last synced: 3 months ago
JSON representation
Fable bindings for react-native-image-picker
- Host: GitHub
- URL: https://github.com/martinmoec/Fable.ReactNative.ImagePicker
- Owner: martinmoec
- Created: 2020-10-15T21:10:10.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-15T21:12:59.000Z (about 4 years ago)
- Last Synced: 2024-06-28T05:44:06.069Z (4 months ago)
- Language: F#
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fable.ReactNative.ImagePicker
Fable bindings for [react-native-image-picker](https://github.com/react-native-image-picker/react-native-image-picker).
## Install
Add npm module:`yarn add react-native-image-picker`
Install Pod
`cd ios && pod install`
Add NuGet package
```dotnet add package Fable.ReactNative.ImagePicker```
or add `Fable.ReactNative.ImagePicker` to your paket.dependencies
## Sample
This package provides bindings as well as the helper functions `showImagePicker`, `launchCamera` and `launchImageLibrary` which lets you call the `react-native-image-picker` equivalents with a list of props in the familiar `Fable.React` way. The functions has the following signature.
```fsharp
seq -> (PickerResponse -> unit) -> unit
```Provide a list of properties along with a callback function containing the response. See `ImagePickerProps` and `PickerResponse` in `Fable.ReactNative.ImagePicker.fs` and the `react-native-image-picker` documentation for further details.
```fsharp
open Fable.ReactNative.ImagePicker// open camera/library modal
showImagePicker [
Title "Select image"
MediaType MediaType.Photo
] (fun response ->
if not response.didCancel then
// do something with base-64 image
response.data
)// open camera directly
launchCamera [] (fun response ->
// do something with response
)// open library directly
launchImageLibrary [] (fun response ->
// do something with response
)```