Skip to content

Instantly share code, notes, and snippets.

@pavsidhu
Last active January 28, 2020 11:13
Show Gist options
  • Save pavsidhu/31e5c8360a464f01715b44f46bcaa408 to your computer and use it in GitHub Desktop.
Save pavsidhu/31e5c8360a464f01715b44f46bcaa408 to your computer and use it in GitHub Desktop.
Validate.js with React Native text input
import React from 'react'
import { View, TextInput, Text } from 'react-native'
const TextField = props => (
<View>
<TextInput/>
{props.error && <Text>{props.error}</Text>}
</View>
)
export default TextField
@fithaN
Copy link

fithaN commented Jan 23, 2018

Hi ,
I tried using the validation example.
But i am getting below error.
screen shot 2018-01-23 at 5 10 04 pm

@Solniechniy
Copy link

You should wrap statement in curly braces
{ props.error ? <Text>{props.error}</Text> : null }

@pavsidhu
Copy link
Author

Just fixed the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment