我对 React Native 很陌生。我正在使用来自 react-native-elements 的 header 在我的应用程序中。这是我的代码
<Header
leftComponent={{ icon: 'menu', color: '#fff' }}
centerComponent={{ text: 'MY TITLE', style: { color: '#fff' } }}
rightComponent={{ icon: 'home', color: '#fff' }}
/>
我找不到任何关于如何检测图标点击以及如何显示额外 View 的示例。我的目标是实现这样的目标: 您有任何示例或示例代码吗?
最佳答案
写 : insted of = , onPress 会起作用
<Header
leftComponent={ {text:'ok',color: '#fff', onPress: () => this.myFunction()}}
centerComponent={{ text: 'MY TITLE', style: { color: '#fff' } }}
/>
或者你可以传递你自己的组件
leftComponent={<MyCustomLeftComponent />}
关于javascript - 检测点击标题图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46725919/