Skip to content

martinmoec/Fable.ReactNative.ImagePicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Fable.ReactNative.ImagePicker

Fable bindings for 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.

seq<ImagePickerProps> -> (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.

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
)

About

Fable bindings for react-native-image-picker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages