Last active
January 26, 2017 20:12
-
-
Save sbalay/66cf961511f703e6c80a71698e4159a9 to your computer and use it in GitHub Desktop.
React Native's TextInput wrapper to be used with redux-form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { TextInput, View, Text } from 'react-native'; | |
/** | |
* to be wrapped with redux-form Field component | |
*/ | |
export default function MyTextInput(props) { | |
const { input, ...inputProps } = props; | |
return ( | |
<View> | |
<TextInput | |
{...inputProps} | |
onChangeText={input.onChange} | |
onBlur={input.onBlur} | |
onFocus={input.onFocus} | |
value={input.value} | |
/> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment