From ad0696183c32fa5406323be5f4b6b8a6403afbc2 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Thu, 23 Aug 2018 16:19:13 -0700 Subject: [PATCH] Stop using animated value for active prop temporarily due to https://github.com/react-navigation/react-navigation/issues/4886 --- src/views/StackView/StackViewCard.js | 24 ++++++++++++++++-------- src/views/Transitioner.js | 15 +-------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/views/StackView/StackViewCard.js b/src/views/StackView/StackViewCard.js index 2133bde..5835dac 100644 --- a/src/views/StackView/StackViewCard.js +++ b/src/views/StackView/StackViewCard.js @@ -3,6 +3,7 @@ import { StyleSheet, Platform } from 'react-native'; import { Screen } from './screens'; import createPointerEventsContainer from './createPointerEventsContainer'; +/* eslint-disable no-unused-vars */ const EPS = 1e-5; function getAccessibilityProps(isActive) { @@ -29,21 +30,28 @@ class Card extends React.Component { children, pointerEvents, style, - position, - scene: { index, isActive }, + // position, + scene: { /* index, */ isActive }, } = this.props; - const active = position.interpolate({ - inputRange: [index, index + 1 - EPS, index + 1], - outputRange: [1, 1, 0], - extrapolate: 'clamp', - }); + + // If we use react-native <= 0.55, we can't call position.__makeNative() + // before binding this value to the view. If we use >= 0.56, then we have + // to call position.__makeNative(). Unclear to me what is happening here + // so temporarily commented this out. + // + // const active = position.interpolate({ + // inputRange: [index, index + 1 - EPS, index + 1], + // outputRange: [1, 1, 0], + // extrapolate: 'clamp', + // }); return ( {children} diff --git a/src/views/Transitioner.js b/src/views/Transitioner.js index b7ad1f2..0ee5d72 100644 --- a/src/views/Transitioner.js +++ b/src/views/Transitioner.js @@ -1,18 +1,9 @@ import React from 'react'; -import { - Animated, - NativeModules, - Easing, - StyleSheet, - View, -} from 'react-native'; +import { Animated, Easing, StyleSheet, View } from 'react-native'; import invariant from '../utils/invariant'; import NavigationScenesReducer from './ScenesReducer'; -const NativeAnimatedModule = - NativeModules && NativeModules.NativeAnimatedModule; - // Used for all animations unless overriden const DefaultTransitionSpec = { duration: 250, @@ -47,10 +38,6 @@ class Transitioner extends React.Component { ), }; - if (NativeAnimatedModule) { - this.state.position.__makeNative(); - } - this._prevTransitionProps = null; this._transitionProps = buildTransitionProps(props, this.state); this._isMounted = false;