小编Sai*_*ddy的帖子

React Native - Animated.View 内的可触摸不透明度正在触发背景列表视图的事件

我有一个带有滚动视图的列表,我正在尝试为其添加过滤器选项。当单击过滤器图标时,position:absolute将在 Animated.View 内显示一个叠加层。我在覆盖视图内有按钮TouchableOpacity

过滤器.js

    export default class FilterFade extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          visible: props.visible,
        };
    };

    componentWillMount() {
      this._visibility = new Animated.Value(this.props.visible ? 1 : 0);
    }

    componentWillReceiveProps(nextProps) {

        if (nextProps.visible) {
          this.setState({ visible: true });
        }
        Animated.timing(this._visibility, {
          toValue: nextProps.visible ? 1 : 0,
          duration: 300,
        }).start(() => {
          this.setState({ visible: nextProps.visible });
        });
    }

    render() {
      const { visible, style, children, ...rest } = this.props;

      const containerStyle = {
        opacity: …
Run Code Online (Sandbox Code Playgroud)

react-native

5
推荐指数
1
解决办法
2194
查看次数

标签 统计

react-native ×1