<commit_before>[<Fable.Core.Erase>]
module Fable.Helpers.ReactNativeImagePicker

open Fable.Core
open Fable.Import
open Fable.Import.ReactNativeImagePicker
type IP = ReactNativeImagePicker.Globals

module Props =
    [<KeyValueList>]
    type IImagePickerOptions =
        interface end

    [<KeyValueList>]
    type ImagePickerOptions =
    | Title of string
    | CancelButtonTitle of string
    | TakePhotoButtonTitle of string
    | ChooseFromLibraryButtonTitle of string
    | CameraType of CameraType
    | MediaType of MediaType
    | MaxWidth of int
    | MaxHeight of int
    | Quality of float
    | VideoQuality of VideoQuality
    | DurationLimit of int
    | Rotation of int
    | AllowsEditing of bool
    | NoData of bool
    | StorageOptions of StorageOptions
        interface IImagePickerOptions

open Props

let inline showImagePicker (props: IImagePickerOptions list) f =
    IP.ImagePicker.showImagePicker(props |> unbox, f)

let inline showImagePickerAsync (props: IImagePickerOptions list) =
    Async.FromContinuations(fun (onSuccess, onError, _) ->
        showImagePicker
            props
            (fun result ->
                if not result.didCancel then
                    if System.String.IsNullOrEmpty result.error then
                        onSuccess (Some result.uri)
                    else
                        onError (System.Exception result.error)
                else onSuccess None)
    )
<commit_msg>Exposed launchcamera and launchimagelibrary in helpers<commit_after>[<Fable.Core.Erase>]
module Fable.Helpers.ReactNativeImagePicker

open Fable.Core
open Fable.Import
open Fable.Import.ReactNativeImagePicker
type IP = ReactNativeImagePicker.Globals

module Props =
    [<KeyValueList>]
    type IImagePickerOptions =
        interface end

    [<KeyValueList>]
    type ImagePickerOptions =
    | Title of string
    | CancelButtonTitle of string
    | TakePhotoButtonTitle of string
    | ChooseFromLibraryButtonTitle of string
    | CameraType of CameraType
    | MediaType of MediaType
    | MaxWidth of int
    | MaxHeight of int
    | Quality of float
    | VideoQuality of VideoQuality
    | DurationLimit of int
    | Rotation of int
    | AllowsEditing of bool
    | NoData of bool
    | StorageOptions of StorageOptions
        interface IImagePickerOptions

open Props

let inline showImagePicker (props: IImagePickerOptions list) f =
    IP.ImagePicker.showImagePicker(props |> unbox, f)

let inline showImagePickerAsync (props: IImagePickerOptions list) =
    Async.FromContinuations(fun (onSuccess, onError, _) ->
        showImagePicker
            props
            (fun result ->
                if not result.didCancel then
                    if System.String.IsNullOrEmpty result.error then
                        onSuccess (Some result.uri)
                    else
                        onError (System.Exception result.error)
                else onSuccess None)
    )

let inline launchCamera (props: IImagePickerOptions list) f =
    IP.ImagePicker.launchCamera(props |> unbox, f)


let inline launchImageLibrary (props: IImagePickerOptions list) f =
    IP.ImagePicker.launchImageLibrary(props |> unbox, f)
{'fraction_non_alphanumeric': 0.05832549388523048, 'fraction_numerical': 0.0, 'mean_word_length': 2.600451467268623, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4669829', 'n_tokens_mistral': 872, 'n_tokens_neox': 850, 'n_words': 249}