![](/img/trans.png)
[英]React Native - 'useNativeDriver' was not specified in modal
[英]react native modal swipe is not working with usenativedriver
我使用库 react-native-modal。 如果我使用“useNativeDriver”为真,谁能解释我为什么我的滑动不起作用? 如果我滑动它就会消失,但我没有看到任何滑动 animation。
<Modal
isVisible={modalDeleteMessage}
swipeDirection="down"
onSwipeComplete={() => setModalDeleteMessage(false)}
onBackButtonPress={() => setModalDeleteMessage(false)}
onBackdropPress={() => setModalDeleteMessage(false)}
animationOut="slideOutDown"
useNativeDriver={true}
backdropTransitionOutTiming={0}
style={{margin: 0, padding: 0}}
>
这个问题跟踪器解决了这个问题: https://github.com/react-native-community/react-native-modal/issues/163#issuecomment-409760695
引用帖子:
这不是由于反应原生限制。 这是一个问题,因为正在使用 getLayout 来动画视图的左侧和顶部样式属性,而 useNativeDriver 不支持这些属性。 存在 getLayout 的替代方法,称为 getTranslateTransform(参见此处),它为 translateX 和 translateY 设置动画而不是顶部和左侧,但由于 react-native-animatable 动画使用这些属性来拉出输入/输出转换,并且 react-native-animatable 将覆盖当您尝试明确设置转换时,在视图上进行转换,目前这是不可能的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.