fable-compiler / fable-react-native

Fable bindings and helpers for React Native projects
Apache License 2.0
49 stars 11 forks source link

TextInputAndroidProperties #44

Closed fkhosrow closed 5 years ago

fkhosrow commented 5 years ago

Hello,

I would like to use TextInputAndroidProperties.UnderlineColorAndroid for the textInput wrapper for ReactNative. However since TextInputAndroidProperties is not a ITextInputProperties, this is not possible. Is this a bug or am I doing something wrong? I am using Fable.react.native v1.7.2. Thanks for your help.

Here is my code snippet: textInput [ TextInputProperties.Password true ; TextInputProperties.SecureTextEntry true ; TextInputProperties.AutoCorrect false ; TextInputProperties.DefaultValue "Password" ; TextInputProperties.Editable true ; TextInputAndroidProperties.UnderlineColorAndroid "transparent" P.S. The same applies to TextInputIOSProperties.

fkhosrow commented 5 years ago

This looks to have been fixed in the latest Fable.ReactNative versions.

The fix in Fable.ReactNative less than v2.0 is to define your own ITextInputProperties implementation: type MyTextInputAndroidProperties = | UnderlineColorAndroid of string interface open Fable.Helpers.ReactNative.Props.TextInput.ITextInputProperties

and use this with textInput element.

For example: open Fable.Helpers.ReactNative open Fable.Helpers.ReactNative.Props open Fable.Helpers.ReactNative.Props.TextInput textInput [ TextInputProperties.AutoCorrect false ; MyTextInputAndroidProperties.UnderlineColorAndroid "transparent" ]