我想对用户密码的文本输入使用React Native元素形式。我的代码在这里:
<FormLabel> Passsword </FormLabel>
<FormInput
onChangeText - {(text) => this.setState({password: text})}
/>
Run Code Online (Sandbox Code Playgroud)
我如何使他们输入的文本安全,以使没人能看到它是什么。对于textInput他们有secureTextEntry但我无法找到类似的东西来反应本机元素
我正在尝试过滤数据数组,如下所示:
let data =
[
{
"approval": "TPED",
"manufacturer": "Chesterfield"
},
{
"approval": "BV",
"manufacturer": "Faber"
}
]
let approvalVariable = "TP"
let filteredData = data.filter(x => x.approval.includes(approvalVariable))
console.log(filteredData)Run Code Online (Sandbox Code Playgroud)
因此,如果批准变量是“TP”,我希望新数组是:
[
{
"approval": "TPED",
"manufacturer": "Chesterfield"
},
]
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我有它的工作:
let filteredData = data.filter(x => x.approval == approvalVariable)
Run Code Online (Sandbox Code Playgroud)
但是当我尝试:
x.approval.includes(approvalVariable)
Run Code Online (Sandbox Code Playgroud)
我收到 x.approval.includes 不是对象的错误
我曾经用 .includes() 让它工作过,但现在出了点问题。
任何帮助将不胜感激。
componentWillMount() {
this.fetchData();
}
fetchData = async () => {
var fireBaseResponse = firebase.database().ref();
fireBaseResponse.once('value').then(snapshot => {
let data1 = [];
let approval = …Run Code Online (Sandbox Code Playgroud) 我将用户文本输入存储到这样的状态中
<TextInput
placeholder = "Hello"
onChangeText = {(text) => this.setState({greeting: text})}
/>
Run Code Online (Sandbox Code Playgroud)
我想使用react-native-modal-dropdown 做类似的事情。
<ModalDropdown
style = {styles.enterSearch}
options = {this.state.gasOptions}
onSelect {(renderButtonText) => this.setState({gas: renderButtonText})}
/>
Run Code Online (Sandbox Code Playgroud)
使用此代码,我可以选择我想要的选项,但我找不到方法来获取所选文本选项的值。
任何帮助都会很棒。