React Native Touchables在ScrollView组件中不起作用

时间:2020-08-16 23:33:29

标签: react-native react-native-android react-native-ios react-native-video react-native-scrollview

我花了数小时试图解决此问题,但似乎无法解决。我正在使用react-native-cube-navigation库将多维数据集导航合并到我的应用程序中。在多维数据集导航中,我有从数据库中提取的视频,这些视频在插入时会播放。我创建了一个工作暂停功能,但是当视频放置在CubeNavigation内时,暂停功能以及屏幕上的所有按钮都将停止工作。 CubeNavigation使用了Animated.ScrollView,因此我需要弄清楚如何允许可触摸对象在其中工作。

这是主屏幕上的代码。

CubeNavigation>
            
         {posts.map(
          ({url, owner, description, encores, comments, shares}) => (
      <View style={[styles.container, { backgroundColor: "#ddd" }]}>
        <Videos url={url} owner={owner} description={description} encores={encores} comments={comments} shares={shares}/>
      </View>
        )
      )}
      
        </CubeNavigation>

这是Videos.js中的代码

<TouchableWithoutFeedback onPress={() => setPlaying(!playing)} >
          <View style={{flex:1}}>
          <Video
            paused={playing}
            style={[styles.backgroundVideo, {width: w, height: h}]}
            source={{uri: url}}
            repeat
            ref={videoRef}
            resizeMode="cover"
            retainOnceInViewPort={false}
          />
          </View>
          </TouchableWithoutFeedback>

0 个答案:

没有答案