我想在 textInput 上添加类似提示的内容,就像在使用 android studio 的 java 中一样,在 react native 中可以这样做吗?我知道您可以选择添加值、默认值和占位符,但它们不像提示那样工作。
坦克!
我想在 textInput 上添加类似提示的内容,就像在使用 android studio 的 java 中一样,在 react native 中可以这样做吗?我知道您可以选择添加值、默认值和占位符,但它们不像提示那样工作。
坦克!
您可以使用占位符道具
<TextInput
placeholder="Input email"
/>
是的,这是可能的,它被称为placeholder ,这是来自docs的示例。:
<TextInput
style={{height: 40}}
placeholder="Type here to translate!"
onChangeText={(text) => this.setState({text})}
value={this.state.text}
/>
您唯一需要做的就是添加一个placeholder
道具。
<TextInput
...//otherprops
placeholder="enter your hint here"
/>
我强烈建议您在此处阅读更多有关TextInput
React Native 文档的信息