首页 > 解决方案 > react native @react-native-community/slider 在 Animated.View 组件中不起作用

问题描述

在 react-native@0.64.1, @react-native-community/slider@3.0.3

我尝试使用 react native Animated 使 Slider 具有不透明过渡,但是当我这样做时,组件无法拖动。

像这样:

<Animated.View style={{opacity: this.controlBarAnimatedOpacity}} >
  <Slider
    style={style.videoSlider}
    value={this.state.playPosition}
    minimumValue={0}
    maximumValue={this.state.videoFullTime}
    minimumTrackTintColor={...}
    maximumTrackTintColor={...}
    thumbTintColor={...}
    onTouchStart={() => this.handleTouchStart()}
    onSlidingComplete={() => this.hanleSlidingComplete()}
    onValueChange={value => this.handleValueChange(value)}
  />
</Animated.View>

我尝试了一些解决方法,例如 set pointerEvents 但没用,无法收到滑块的任何响应,有人有更复杂的问题吗?

标签: react-nativeanimationslider

解决方案


推荐阅读