Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add React Native signature pad #26

Open
forki opened this issue May 8, 2017 · 0 comments
Open

Add React Native signature pad #26

forki opened this issue May 8, 2017 · 0 comments

Comments

@forki
Copy link
Collaborator

forki commented May 8, 2017

@alfonsogarciacaro promised to add this to react native bindings once things moved to 1.0 :P

open Fable.Core.JsInterop
module R = Fable.Helpers.React

type RCom = Fable.Import.React.ComponentClass<obj>

let SignaturePad: RCom = importDefault "react-native-signature-pad"

/// Opens a signature pad with callbacks for onError and onChange
let signaturePad (props:Fable.Helpers.ReactNative.Props.IStyle list) (onError:exn -> unit) (onChange:string -> unit) : React.ReactElement =
    let onChange (o:obj) = onChange(o?base64DataUrl |> unbox)
    let pad =
        createObj
            [ "style" ==> props
            "onError" ==> onError
            "onChange" ==> onChange ]
        |> unbox

    R.from SignaturePad pad []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant