我想在我的RN应用程序中只读文本输入.我试图设置可编辑的道具,但它没有正常工作.我怎样才能做到这一点?
<DetailInput
inputStyle={styles.inputStyles}
height={120}
width={width - 40}
multiline={true}
numberOfLines={6}
underlineColorAndroid="transparent"
maxLength={500}
editable={!userRegistrationInProgress}
onChangeText={value => this.statementChangedHandler(value)}
/>
const detailInput = props => {
return (
<TextInput
{...props}
style=
{[
props.inputStyle,
{ height: props.height, width: props.width},
!props.valid && props.touched ? props.invalidInput : null
]}
/>
);
}
export default detailInput;
Run Code Online (Sandbox Code Playgroud)
eig*_*ive 11
更好的readonly文本输入:
<View pointerEvents="none">
<TextInput value="I am read only" editable={false} />
</View>
Run Code Online (Sandbox Code Playgroud)
https://facebook.github.io/react-native/docs/view#pointerevents
<TextInput
value = "Read Only"
editable = {false}
/>
Run Code Online (Sandbox Code Playgroud)
将editable false设置为只读TextInput.
| 归档时间: |
|
| 查看次数: |
6093 次 |
| 最近记录: |