检测点击标题图标

j.d*_*doe 1 javascript reactjs react-native

我对本机反应很陌生。我在我的应用程序中使用来自react-native-elements的标头。这是我的代码

<Header
  leftComponent={{ icon: 'menu', color: '#fff' }}
  centerComponent={{ text: 'MY TITLE', style: { color: '#fff' } }} 
  rightComponent={{ icon: 'home', color: '#fff' }}
/>
Run Code Online (Sandbox Code Playgroud)

我无法找到有关如何检测图标点击的任何示例,并在可能的情况下显示额外视图。我的目标是实现这样的目标: 在此处输入图片说明 你有任何示例或示例代码吗?

Hri*_*shi 7

写入:插入 = , onPress 将起作用

  <Header 
     leftComponent={ {text:'ok',color: '#fff', onPress: () => this.myFunction()}}
     centerComponent={{ text: 'MY TITLE', style: { color: '#fff' } }}
  />
Run Code Online (Sandbox Code Playgroud)

或者您可以传递自己的组件,例如

 leftComponent={<MyCustomLeftComponent />}
Run Code Online (Sandbox Code Playgroud)