简体   繁体   English

反应本机模式滑动不适用于 usenativedriver

[英]react native modal swipe is not working with usenativedriver

I use the libary react-native-modal.我使用库 react-native-modal。 Can anyone explain me why my swipe not working If I use "useNativeDriver" to true?如果我使用“useNativeDriver”为真,谁能解释我为什么我的滑动不起作用? It goes away if I swipe but I dont see any swipe animation.如果我滑动它就会消失,但我没有看到任何滑动 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}}
      >

This issue tracker addresses this: https://github.com/react-native-community/react-native-modal/issues/163#issuecomment-409760695这个问题跟踪器解决了这个问题: https://github.com/react-native-community/react-native-modal/issues/163#issuecomment-409760695 在此处输入图像描述

Quote from the post:引用帖子:

This is not due to react native limitations.这不是由于反应原生限制。 This is a problem because getLayout is being used which animates the left and top style properties of a view which are not supported by useNativeDriver.这是一个问题,因为正在使用 getLayout 来动画视图的左侧和顶部样式属性,而 useNativeDriver 不支持这些属性。 an alternative to getLayout exists called getTranslateTransform (See here) that animates translateX and translateY instead of top and left but since react-native-animatable animations are using those properties to pull off the in/out transitions and react-native-animatable will override the transform on the view when you try and set the transform explicitly this is not currently possible.存在 getLayout 的替代方法,称为 getTranslateTransform(参见此处),它为 translateX 和 translateY 设置动画而不是顶部和左侧,但由于 react-native-animatable 动画使用这些属性来拉出输入/输出转换,并且 react-native-animatable 将覆盖当您尝试明确设置转换时,在视图上进行转换,目前这是不可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM