Created
August 21, 2017 17:20
-
-
Save javidjamae/083b92b189525c171509f72c9d42840a to your computer and use it in GitHub Desktop.
React Native issue with TabNavigator and form autoFocus
This file contains 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 { StyleSheet, Text, View } from 'react-native'; | |
import { TabNavigator } from 'react-navigation' | |
import TheListView from './TheListView' | |
import TheFormView from './TheFormView' | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<AppNavigator /> | |
); | |
} | |
} | |
const AppNavigator = TabNavigator( { | |
listView: { screen: TheListView }, | |
formView: { screen: TheFormView } | |
} ) | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}); |
This file contains 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
{ | |
"name": "react-navigation-keyboard-dismiss", | |
"version": "0.0.0", | |
"description": "Hello Expo!", | |
"author": null, | |
"private": true, | |
"main": "node_modules/expo/AppEntry.js", | |
"dependencies": { | |
"expo": "^19.0.0", | |
"react": "16.0.0-alpha.12", | |
"react-native": "https://github.com/expo/react-native/archive/sdk-19.0.0.tar.gz", | |
"react-navigation": "^1.0.0-beta.11" | |
} | |
} |
This file contains 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 { Text, TextInput, View } from 'react-native' | |
const TheFormView = () => { | |
return ( | |
<View style={{ marginTop: 50 }}> | |
<TextInput | |
autoFocus={ true } | |
keyboardType="default" | |
placeholder="Blah" | |
/> | |
</View> | |
) | |
} | |
export default TheFormView |
This file contains 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 { Text, View } from 'react-native' | |
const TheListView = () => { | |
return ( | |
<View style={{ marginTop: 50 }}> | |
<Text>ListView</Text> | |
</View> | |
) | |
} | |
export default TheListView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment