我做了一个 DEMO
因此问题在于第三个按钮不起作用。按钮之间的唯一区别是我在Header组件中传递按钮的方式。
<Header secondButton={<View style={styles.button}><Text>Second Button</Text></View>}
thirdButton={<ThirdButton />}
onPress={this._handlePress} />
最佳答案
我的解决方案是把这个...
<TouchableWithoutFeedback onPress={props.onPress}>
<Contents {...props} />
</TouchableWithoutFeedback>
进入这个...
<TouchableWithoutFeedback onPress={props.onPress}>
<View>
<Contents {...props} />
</View>
</TouchableWithoutFeedback>