• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

隐藏/显示在印刷机上

Android 来源:Mr.moayed 4次浏览

反应-native我有反应本土工具栏,这样隐藏/显示在印刷机上

enter image description here

当点击搜索图标,我需要打开这样

输入文本enter image description here

我试过很多这个例子,但我不能申请任何人为我的情况,任何帮助?

这是我的代码:

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 /> 
) 
} 

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)