小编gra*_*mos的帖子

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

我正在构建一个使用库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 组件中,但我已经尝试过,但仍然有相同的警告。有什么解决办法吗?提前致谢

react-native

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

标签 统计

react-native ×1