@ericvicenti/universe (#4493)

* Isolate modules for uncontainerized navigators

* Clean up prop-types

* Fix warnings and web import friendlyness

* strip a flow

* Standalone provider/consumer navigation context

* export shallowEqual as module

* address various lint

# Conflicts:
#	src/navigators/createStackNavigator.js

* Get tests to pass
This commit is contained in:
Eric Vicenti
2018-06-22 10:20:27 -07:00
committed by Brent Vatne
parent 247fba56e6
commit 608365266a
21 changed files with 73 additions and 90 deletions

View File

@@ -21,7 +21,7 @@ import withOrientation from '../withOrientation';
import { NavigationProvider } from '../NavigationContext';
import TransitionConfigs from './StackViewTransitionConfigs';
import * as ReactNativeFeatures from '../../utils/ReactNativeFeatures';
import { supportsImprovedSpringAnimation } from '../../utils/ReactNativeFeatures';
const emptyFunction = () => {};
@@ -154,10 +154,7 @@ class StackViewLayout extends React.Component {
}
_reset(resetToIndex, duration) {
if (
Platform.OS === 'ios' &&
ReactNativeFeatures.supportsImprovedSpringAnimation()
) {
if (Platform.OS === 'ios' && supportsImprovedSpringAnimation()) {
Animated.spring(this.props.transitionProps.position, {
toValue: resetToIndex,
stiffness: 5000,
@@ -197,10 +194,7 @@ class StackViewLayout extends React.Component {
}
};
if (
Platform.OS === 'ios' &&
ReactNativeFeatures.supportsImprovedSpringAnimation()
) {
if (Platform.OS === 'ios' && supportsImprovedSpringAnimation()) {
Animated.spring(position, {
toValue,
stiffness: 5000,
@@ -236,7 +230,7 @@ class StackViewLayout extends React.Component {
return false;
}
position.stopAnimation((value: number) => {
position.stopAnimation(value => {
this._isResponding = true;
this._gestureStartValue = value;
});
@@ -244,7 +238,7 @@ class StackViewLayout extends React.Component {
},
onMoveShouldSetPanResponder: (event, gesture) => {
const {
transitionProps: { navigation, position, layout, scene, scenes },
transitionProps: { navigation, layout, scene },
mode,
} = this.props;
const { index } = navigation.state;
@@ -416,18 +410,10 @@ class StackViewLayout extends React.Component {
);
}
const {
transitionProps: { navigation, position, layout, scene, scenes },
transitionProps: { scene, scenes },
mode,
} = this.props;
const { index } = navigation.state;
const isVertical = mode === 'modal';
const { options } = scene.descriptor;
const gestureDirection = options.gestureDirection;
const gestureDirectionInverted =
typeof gestureDirection === 'string'
? gestureDirection === 'inverted'
: I18nManager.isRTL;
const gesturesEnabled =
typeof options.gesturesEnabled === 'boolean'