React native ScrollView后面的可触摸处理程序

React native ScrollView后面的可触摸处理程序,react-native,React Native,我想制作某种可滚动的Paralax效果,其中ScrollView设置为flex:1,在它后面有一个绝对定位的元素,它有一些按钮。ScrollView有一个视图,用作填充,使绝对视图可见。当滚动其他内容操作系统时,ScrollView会像desirade一样覆盖绝对视图。问题是绝对视图不响应触摸事件,因为它被ScrollView覆盖。我有什么解决办法 这是我现在拥有的代码: <View style={[styles.container, { backgroundColor: "red" }]

我想制作某种可滚动的Paralax效果,其中ScrollView设置为flex:1,在它后面有一个绝对定位的元素,它有一些按钮。ScrollView有一个视图,用作填充,使绝对视图可见。当滚动其他内容操作系统时,ScrollView会像desirade一样覆盖绝对视图。问题是绝对视图不响应触摸事件,因为它被ScrollView覆盖。我有什么解决办法

这是我现在拥有的代码:

<View style={[styles.container, { backgroundColor: "red" }]}>
        <Animated.View
          style={[styles.static, { backgroundColor: "yellow" }]}
          onLayout={this.onLayout}
        >
          <Header navigation={this.props.navigation} name={name} />
          <Balance balance={balance} />
          <BotonesAccion navigation={this.props.navigation} />
        </Animated.View>
        <Animated.ScrollView
          style={styles.container}
          onScroll={Animated.event([
            { nativeEvent: { contentOffset: { y: this.y } } }
          ])}
        >
          <View
            style={{
              height: this.state.height,
              backgroundColor: "green",
              opacity: 0.2
            }}
          />
          <Historial navigation={this.props.navigation} />
        </Animated.ScrollView>
      </View>

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  static: {
    position: "absolute",
    top: 0,
    width,
    paddingTop: Constants.statusBarHeight + theme.sizes.padding,
    padding: theme.sizes.padding
  },
});


const styles=StyleSheet.create({
容器:{
弹性:1
},
静态:{
位置:“绝对”,
排名:0,
宽度,
paddingTop:Constants.statusBarHeight+theme.sizes.padding,
填充:theme.size.padding
},
});

然后我想使用ScrollView的nativeEvent来驱动一些动画,但这不是问题的一部分。

您应该使用pointerEvents=“box none”()作为ScrollView的道具

<Animated.ScrollView
          pointerEvents="box-none"
          style={styles.container}
          onScroll={Animated.event([
            { nativeEvent: { contentOffset: { y: this.y } } }
          ])}
        >
<View>
[...]
</View>
</Animated.ScrollView>

[...]

这不起作用:(.仍然有相同的问题。你能为此提供零食链接吗?嗨,Matias,你成功地使它起作用了吗?:)