隐藏/显示在印刷机上
反应-native我有反应本土工具栏,这样隐藏/显示在印刷机上
当点击搜索图标,我需要打开这样
输入文本
我试过很多这个例子,但我不能申请任何人为我的情况,任何帮助?
这是我的代码:
constructor(props, context) { super(props, context);
const ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2
});
this.state = {
visible: false,
selectedTab: 'view1',
ds:[{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"},{CustomerName: "Customer Name", CustomerPhone: "+564659878964"}],
dataSource:ds,
}
}
<TouchableHighlight
onPress={()=>this.toggleStatus()}>
<Image style={styles.imagestyle}
source={require('./ic_search.png')} />
</TouchableHighlight>
<Text style={styles.toolbarTitle}>CUSTOMERS</Text>
<TouchableHighlight onPress={() => this.moveToAddNewCustomer()}>
<Image style={styles.imagestyle}
visible={this.state.visible}
source={require('./ic_action_name.png')} />
</TouchableHighlight>
</View>
我怎么可以隐藏标题和开放输入文本???
回答:
如果导航栏可以访问visible
状态,那么你应该能够只使用一个if
语句来确定显示
if (this.state.visible) { return (
<SearchBar />
)
} else {
return (
<Title />
)
}
以上是 隐藏/显示在印刷机上 的全部内容, 来源链接: utcz.com/qa/259677.html