React Native - 模式中未指定“useNativeDriver”

gra*_*mos 5 react-native

我正在构建一个使用库react-native-image-viewer显示可缩放图像的模式。这是我的自定义组件:

       <Modal
            animationType="slide"
            visible={isVisible}
            transparent={true}
        >
            <ImageViewer imageUrls={images} />
        </Modal>
Run Code Online (Sandbox Code Playgroud)

问题是,当我单击图像时,模式会出现,并显示可缩放图像,但带有以下警告消息:

动画:useNativeDriver未指定。这是必需的选项,必须明确设置为truefalse

我一直在搜索很多解决方案,找到了包含以下内容的位置:

animatedValue = new Animated.Value(-300);

componentDidMount() {
    Animated.timing(this.animatedValue,
        {
            toValue: 0,
            duration: 3000,
            useAnimatedDriver: true,
        }).start();
}
Run Code Online (Sandbox Code Playgroud)

并将ImageViewer包含在 Animated.View 组件中,但我已经尝试过,但仍然有相同的警告。有什么解决办法吗?提前致谢

Kir*_*kov 0

这是因为 RN 团队将其useNativeDriver作为必需属性https://github.com/facebook/react-native/commit/5876052615f4858ed5fc32fa3da9b64695974238并且react-native-image-viewer维护者尚未更新其实现。