在按下时显示反应中的隐藏/显示

时间:2016-11-27 15:17:39

标签: android reactjs react-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>

我如何隐藏标题并打开输入文本???

1 个答案:

答案 0 :(得分:0)

如果导航栏可以访问FB.login() called before FB.init(). 状态,那么您应该只能使用visible语句来确定要显示的内容

if