728x90
반응형
export default class App extends Component {
// 키보드를 화면에서 사라지게 함(
dismissKeyboard () {
Keyboard.dismiss()
}
render () {
return (
<View style={styles.container}>
<TextInput style={styles.input} />
{/* UI의 버튼에 dismissKeyboard 메서드를 연결 */}
<TouchableHighlight
onPress={this.dismissKeyboard}
style={styles.button}>
<Text>Dismiss Keyboard</Text>
</TouchableHighlight>
</View>
)
}
}
styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 150,
},
input: {
margin: 10,
backgroundColor: '#ededed',
height: 50,
padding: 10
},
button: {
height: 50,
backgroundColor: '#dddddd',
margin: 10,
justifyContent: 'center',
alignItems: 'center'
}
})
728x90
반응형
'React Native' 카테고리의 다른 글
AppRegistry.registerComponent(앱이름, ()=>시작컴포넌트) (0) | 2020.01.17 |
---|---|
[React] 컴포넌트에 props 전달 방법 (0) | 2020.01.17 |
React native 지오로케이션 GeoLocation (0) | 2020.01.16 |
ReactNative 에서 android 퍼미션 요청 하기 (1) | 2020.01.16 |
TextInput 비밀번호 (0) | 2020.01.15 |