简体   繁体   中英

react native modal swipe is not working with usenativedriver

I use the libary react-native-modal. Can anyone explain me why my swipe not working If I use "useNativeDriver" to true? It goes away if I swipe but I dont see any swipe 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 在此处输入图像描述

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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