Closed jacereda closed 5 years ago
Why would it do that?
https://facebook.github.io/react-native/docs/textinput.html for reference.
On Fri, Dec 15, 2017 at 7:40 PM, jacereda notifications@github.com wrote:
Shouldn't this take (children: React.ReactElement list) instead of text?
https://github.com/fable-compiler/fable-react-native/blob/ b8585a183ff61bb6bfe288227d15cb100a2ef9e8/src/Fable.Helpers. ReactNative.fs#L1441
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fable-compiler/fable-react-native/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3VvuJoqw8W07W89NVGYje_KY9aB27Qks5tAxGbgaJpZM4REKLi .
I'm trying to run the iOS version of https://github.com/SAFE-Stack/SAFE-Nightwatch and I'm getting a Raw text cannot be used outside of a <Text> tag
error. I think textInput
isn't terminal and it can contain children.
Maybe not a terminal though... What is the text
argument supposed to be?
I haven't used RN much myself, @forki have you used this function?
@jacereda I hit this issue myself some time ago. I implemented a work-around locally. If you use this alternate implementation for textInput
, it should work
let inline textInput (props: ITextInputProperties list) (text:string): React.ReactElement =
let valueProp = TextInput.TextInputProperties.Value text :> ITextInputProperties
createElement(RN.TextInput, valueProp :: props, [])
I'll submit a PR for https://github.com/ddunlea/fable-react-native/commit/ee7c419eb16b705e317e298e3021a5f935db04b5
Is the text
argument really necessary? Wouldn't it be better to remove it completely and pass it as part of props
?
I wrote it that way so as not to break the signature for existing callers. In my own code where I had no existing code to worry about, I'd been doing exactly what you said.
Shouldn't this take
(children: React.ReactElement list)
instead of text?https://github.com/fable-compiler/fable-react-native/blob/b8585a183ff61bb6bfe288227d15cb100a2ef9e8/src/Fable.Helpers.ReactNative.fs#L1441