簡體   English   中英

React Native - 按絕對定位視圖和聚焦輸入

[英]React Native - Press going through an absolute positioned View and focusing input

我正在嘗試創建一個定位的絕對視圖,其中列出了一些選項,但是當 TextInput 在它后面時,我遇到了觸摸手勢問題。

問題:當位置絕對視圖打開並且我嘗試點擊它時(假設我想點擊它里面的選項),TextInput 變得聚焦......就像視圖根本沒有被觸摸注冊.

注意:這僅發生在 Android 設備上

請檢查我創建的這個 Snack 作為參考 -> https://snack.expo.io/@sempa/5788f2

謝謝!

    <View style={styles.container}>
      <View style={styles.touchableWrapper}>
        <TouchableOpacity
          style={styles.touchable}
          onPress={() => setIsOpened(!isOpened)}>
          <Text>Click To Open</Text>
        </TouchableOpacity>
        {isOpened && <View style={styles.absoluteWrapper}></View>}
      </View>
      
      {!isOpened && (
        <View>
          <TextInput placeholder="Start typing..." style={styles.inputText} />
        </View>
      )}
    </View>

您可以像這樣輕松修改

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM