diff --git a/example/App.js b/example/App.js index 745184b..ba434a3 100644 --- a/example/App.js +++ b/example/App.js @@ -12,12 +12,12 @@ import ModalStack from './src/ModalStack'; import LifecycleInteraction from './src/LifecycleInteraction'; import GestureInteraction from './src/GestureInteraction'; -// Uncomment the following line to force RTL. Requires closing and re-opening -// your app after you first load it with this option enabled. -// I18nManager.forceRTL(true); - // Comment the following two lines to stop using react-native-screens import { useScreens } from 'react-native-screens'; + +// Uncomment the following line to force RTL. Requires closing and re-opening +// your app after you first load it with this option enabled. +I18nManager.forceRTL(false); useScreens(); const data = [ diff --git a/example/src/GestureInteraction.js b/example/src/GestureInteraction.js index e41dec4..fe6bb7d 100644 --- a/example/src/GestureInteraction.js +++ b/example/src/GestureInteraction.js @@ -5,18 +5,13 @@ import { InteractionManager, WebView, View, - StyleSheet, } from 'react-native'; import { MapView } from 'expo'; -import { withNavigationFocus } from 'react-navigation'; import { createStackNavigator, StackGestureContext, } from 'react-navigation-stack'; -import { - PanGestureHandler, - NativeViewGestureHandler, -} from 'react-native-gesture-handler'; +import { NativeViewGestureHandler } from 'react-native-gesture-handler'; const IndexScreen = ({ navigation }) => ( diff --git a/example/src/ImageStack.js b/example/src/ImageStack.js index f726c7e..af256a0 100644 --- a/example/src/ImageStack.js +++ b/example/src/ImageStack.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Dimensions, Button, Image, View, Text } from 'react-native'; +import { Dimensions, Button, Image, View } from 'react-native'; import { createStackNavigator } from 'react-navigation-stack'; import { FlatList, BorderlessButton } from 'react-native-gesture-handler'; diff --git a/example/src/LifecycleInteraction.js b/example/src/LifecycleInteraction.js index 0a622b0..38be546 100644 --- a/example/src/LifecycleInteraction.js +++ b/example/src/LifecycleInteraction.js @@ -1,11 +1,5 @@ import React from 'react'; -import { - ActivityIndicator, - Button, - Text, - View, - StyleSheet, -} from 'react-native'; +import { Button, Text, View, StyleSheet } from 'react-native'; import { BarCodeScanner } from 'expo'; import { withNavigationFocus } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack'; diff --git a/src/utils/StackGestureContext.js b/src/utils/StackGestureContext.js index 8e7a50a..51b82c7 100644 --- a/src/utils/StackGestureContext.js +++ b/src/utils/StackGestureContext.js @@ -1,3 +1,3 @@ import React from 'react'; -export default React.createContext(null); \ No newline at end of file +export default React.createContext(null); diff --git a/src/views/Header/HeaderBackButton.js b/src/views/Header/HeaderBackButton.js index 61f364c..e3e675e 100644 --- a/src/views/Header/HeaderBackButton.js +++ b/src/views/Header/HeaderBackButton.js @@ -79,13 +79,7 @@ class HeaderBackButton extends React.PureComponent { }; _maybeRenderTitle() { - const { - backTitleVisible, - titleStyle, - tintColor, - truncatedTitle, - } = this.props; - + const { backTitleVisible, titleStyle, tintColor } = this.props; let backTitleText = this._getTitleText(); if (!backTitleVisible || backTitleText === null) { diff --git a/src/views/StackView/StackView.js b/src/views/StackView/StackView.js index c0ccec5..3ca659a 100644 --- a/src/views/StackView/StackView.js +++ b/src/views/StackView/StackView.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Platform, NativeModules } from 'react-native'; +import { NativeModules } from 'react-native'; import { StackActions } from '@react-navigation/core'; import StackViewLayout from './StackViewLayout'; diff --git a/src/views/StackView/StackViewLayout.js b/src/views/StackView/StackViewLayout.js index 8b2984b..ec20f5a 100644 --- a/src/views/StackView/StackViewLayout.js +++ b/src/views/StackView/StackViewLayout.js @@ -1,9 +1,7 @@ import React from 'react'; - import { Animated, StyleSheet, - PanResponder, Platform, View, I18nManager, @@ -27,8 +25,6 @@ import StackGestureContext from '../../utils/StackGestureContext'; import clamp from '../../utils/clamp'; import { supportsImprovedSpringAnimation } from '../../utils/ReactNativeFeatures'; -const emptyFunction = () => {}; - const IPHONE_XS_HEIGHT = 812; // iPhone X and XS const IPHONE_XR_HEIGHT = 896; // iPhone XR and XS Max const { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window'); @@ -63,11 +59,6 @@ const ANIMATION_DURATION = 500; */ const POSITION_THRESHOLD = 1 / 2; -/** - * The threshold (in pixels) to start the gesture action. - */ -const RESPOND_THRESHOLD = 20; - /** * The distance of touch start from the edge of the screen where the gesture will be recognized */ @@ -390,8 +381,6 @@ class StackViewLayout extends React.Component { // TODO: remove this __getValue! let distance = layout.height.__getValue(); - - let translationY = nativeEvent.translationY; let value = index - nativeEvent.translationY / distance; return clamp(index - 1, value, index); }; @@ -412,7 +401,7 @@ class StackViewLayout extends React.Component { } }; - _handleActivateGestureHorizontal = nativeEvent => { + _handleActivateGestureHorizontal = () => { let { index } = this.props.transitionProps.navigation.state; if (this._isMotionInverted()) { @@ -449,7 +438,7 @@ class StackViewLayout extends React.Component { } }; - _handleActivateGestureVertical = nativeEvent => { + _handleActivateGestureVertical = () => { let { index } = this.props.transitionProps.navigation.state; this.setState({ @@ -472,8 +461,7 @@ class StackViewLayout extends React.Component { _handleReleaseHorizontal = nativeEvent => { const { - transitionProps: { navigation, position, layout, scene }, - mode, + transitionProps: { navigation, position, layout }, } = this.props; const { index } = navigation.state; const immediateIndex = @@ -525,8 +513,7 @@ class StackViewLayout extends React.Component { _handleReleaseVertical = nativeEvent => { const { - transitionProps: { navigation, position, layout, scene }, - mode, + transitionProps: { navigation, position, layout }, } = this.props; const { index } = navigation.state; const immediateIndex = diff --git a/src/views/StackView/createPointerEventsContainer.js b/src/views/StackView/createPointerEventsContainer.js index 6b4e93a..5767ae0 100644 --- a/src/views/StackView/createPointerEventsContainer.js +++ b/src/views/StackView/createPointerEventsContainer.js @@ -23,8 +23,6 @@ export default function createPointerEventsContainer(Component) { this._bindPosition(); this._pointerEvents = this._computePointerEvents(); - const { navigation, scene } = this.props; - return ( { + _onPositionChange = (/* { value } */) => { // This should log each frame when releasing the gesture or when pressing // the back button! If not, something has gone wrong with the animated // value subscription diff --git a/src/views/Transitioner.js b/src/views/Transitioner.js index 0758bd8..7385d87 100644 --- a/src/views/Transitioner.js +++ b/src/views/Transitioner.js @@ -26,7 +26,7 @@ class Transitioner extends React.Component { }; const position = new Animated.Value(this.props.navigation.state.index); - this._positionListener = position.addListener(({ value }) => { + this._positionListener = position.addListener((/* { value } */) => { // This should work until we detach position from a view! so we have to be // careful to not ever detach it, thus the gymnastics in _getPosition in // StackViewLayout @@ -60,7 +60,8 @@ class Transitioner extends React.Component { componentWillUnmount() { this._isMounted = false; - this._positionListener && this.state.position.removeListener(this._positionListener); + this._positionListener && + this.state.position.removeListener(this._positionListener); } // eslint-disable-next-line react/no-deprecated