react-native(리액트 네이티브) component - TextInput
import React, { Component } from 'react';
import { AppRegistry, View, Text, TextInput, TouchableOpacity } from 'react-native';
class UselessTextInput extends Component {
render() {
return (
<TextInput
{...this.props} // Inherit any props passed to it; e.g., multiline, numberOfLines below
editable = {true}
maxLength = {40}
/>
);
}
}
export default class UselessTextInputMultiline extends Component {
constructor(props) {
super(props);
this.state = {
text: 'Useless Multiline Placeholder',
};
}
// If you type something in the text box that is a color, the background will change to that
// color.
render() {
return (
<View>
<TouchableOpacity>
<Text>If you type something in the text box that is a color, the background will change to that color.</Text>
</TouchableOpacity>
<View style={{
backgroundColor: this.state.text,
borderBottomColor: '#000000',
borderBottomWidth: 1 }}
>
<UselessTextInput
multiline = {true}
numberOfLines = {4}
onChangeText={(text) => this.setState({text})}
value={this.state.text}
/>
</View>
</View>
);
}
}
// skip these lines if using Create React Native App
AppRegistry.registerComponent(
'AwesomeProject',
() => UselessTextInputMultiline
);
'프로그래밍(Programming) > 리액트 네이티브(React Native)' 카테고리의 다른 글
react-native(리액트 네이티브) component - View (0) | 2019.01.07 |
---|---|
react-native(리액트 네이티브) component - Touchable (0) | 2019.01.07 |
react-native(리액트 네이티브) component - Text (0) | 2019.01.07 |
react-native(리액트 네이티브) component - Switch (0) | 2019.01.07 |
react-native(리액트 네이티브) component - StatusBar (0) | 2019.01.07 |