![](/img/trans.png)
[英]How to setState inside an onPress Alert function in React-Native
[英]How to avoid onPress function works inside the inner Views in React-Native
我想避免onPress={() => onRequestClose()}
function 在我的 react-native 項目的內部View
中工作。
當用戶點擊屏幕時(無論區域) onPress={() => onRequestClose()}
工作,以避免我在第一個TouchableWithoutFeedback
和View
組件內使用View
我添加了另一個TouchableWithoutFeedback
。 但這不起作用。
我正在努力尋找解決方案,有什么方法可以解決這個問題。
我的代碼如下
<View style={styles.videoOverlayWrapper}>
<TouchableWithoutFeedback onPress={() => onRequestClose()} style={{width: '100%', height: '100%'}}>
<View><TouchableWithoutFeedback onPress={()=>{}}>{props.children}</TouchableWithoutFeedback></View>
</TouchableWithoutFeedback>
</View>
您可以在任何 onPress 中傳遞 null,如 onPress={() => null} 或 onPress={null}
<View style={styles.videoOverlayWrapper}>
<TouchableWithoutFeedback onPress={() => null} style={{width: '100%', height: '100%'}}>
</View>
你能分享你的觀點風格嗎 styles.videoOverlayWrapper
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.