簡體   English   中英

嵌套的 React Native ScrollView 需要點擊兩次才能開始滾動

[英]Nested React Native ScrollView requires two taps to start scrolling

我在另一個ScrollView ScrollView 我注意到我必須點擊兩次才能使嵌套滾動視圖開始滾動。

我嘗試使用一些屬性,如scrollEnablednestedScrollEnabledkeyboardShouldPersistTaps="always"但這些都沒有幫助。

我無法提供任何真正的代碼,因為該項目非常大,並且滾動視圖之間有多個組件。 但是,基本結構與此類似:

<ScrollView>
  <SomeNestedComponents>
    <ScrollView
      scrollEnabled={true}
      nestedScrollEnabled={true}
      keyboardShouldPersistTaps="always"
    >
    </ScrollView>
  </SomeNestedComponents>
</ScrollView>

我建議您也嘗試將keyboardShouldPersistTaps='always'放在最外面的<ScrollView />組件上。 根據這個 GitHub 問題的最終答案,應該可以解決它。

例如:

<ScrollView keyboardShouldPersistTaps='always'>
  <SomeNestedComponents>
    <ScrollView
      scrollEnabled={true}
      nestedScrollEnabled={true}
      keyboardShouldPersistTaps='always'
    >
    </ScrollView>
  </SomeNestedComponents>
</ScrollView>

暫無
暫無

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

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