Use native driver even if gestures are enabled
Summary: Gestures now work with native animations so we can enable it, it is also not needed anymore to check if the native module exists since we print a warning in the Animated module now. **Test plan** Tested that animations and gesture work properly in the UIExplorer example. Also been using native animations with NavigationExperimental (ex-nav) in an app for a while. Closes https://github.com/facebook/react-native/pull/11234 Differential Revision: D4321763 Pulled By: ericvicenti fbshipit-source-id: 255bed5bfed3b93bdc10939b5a03d4d8b00ceade
This commit is contained in:
parent
41f2169629
commit
4220063f84
|
@ -32,7 +32,6 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const NativeAnimatedModule = require('NativeModules').NativeAnimatedModule;
|
|
||||||
const NavigationCard = require('NavigationCard');
|
const NavigationCard = require('NavigationCard');
|
||||||
const NavigationCardStackPanResponder = require('NavigationCardStackPanResponder');
|
const NavigationCardStackPanResponder = require('NavigationCardStackPanResponder');
|
||||||
const NavigationCardStackStyleInterpolator = require('NavigationCardStackStyleInterpolator');
|
const NavigationCardStackStyleInterpolator = require('NavigationCardStackStyleInterpolator');
|
||||||
|
@ -221,16 +220,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
|
||||||
_configureTransition = () => {
|
_configureTransition = () => {
|
||||||
const isVertical = this.props.direction === 'vertical';
|
const isVertical = this.props.direction === 'vertical';
|
||||||
const animationConfig = {};
|
const animationConfig = {};
|
||||||
if (
|
if (NavigationCardStackStyleInterpolator.canUseNativeDriver(isVertical)) {
|
||||||
!!NativeAnimatedModule
|
|
||||||
|
|
||||||
// Gestures do not work with the current iteration of native animation
|
|
||||||
// driving. When gestures are disabled, we can drive natively.
|
|
||||||
&& !this.props.enableGestures
|
|
||||||
|
|
||||||
// Native animation support also depends on the transforms used:
|
|
||||||
&& NavigationCardStackStyleInterpolator.canUseNativeDriver(isVertical)
|
|
||||||
) {
|
|
||||||
animationConfig.useNativeDriver = true;
|
animationConfig.useNativeDriver = true;
|
||||||
}
|
}
|
||||||
return animationConfig;
|
return animationConfig;
|
||||||
|
|
Loading…
Reference in New Issue