From 5eac729fc39990a94998f815d4b3ba7a86eb5dca Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Mon, 24 Sep 2018 17:53:22 -0700 Subject: [PATCH] Experiment with passing the pan gesture ref down through context --- example/App.js | 2 + example/src/GestureInteraction.js | 58 ++++++++++++++++++++++++++ package.json | 2 +- src/index.js | 3 ++ src/utils/GestureContext.js | 4 ++ src/views/StackView/StackViewLayout.js | 13 ++++-- 6 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 example/src/GestureInteraction.js create mode 100644 src/utils/GestureContext.js diff --git a/example/App.js b/example/App.js index da50c7a..400bad2 100644 --- a/example/App.js +++ b/example/App.js @@ -8,6 +8,7 @@ import { ListSection, Divider } from 'react-native-paper'; import SimpleStack from './src/SimpleStack'; import TransparentStack from './src/TransparentStack'; import ModalStack from './src/ModalStack'; +import GestureInteraction from './src/GestureInteraction'; // Comment the following two lines to stop using react-native-screens import { useScreens } from 'react-native-screens'; @@ -21,6 +22,7 @@ const data = [ title: 'Transparent', routeName: 'TransparentStack', }, + { component: GestureInteraction, title: 'Gesture Interaction', routeName: 'GestureInteraction' }, ]; class Home extends React.Component { diff --git a/example/src/GestureInteraction.js b/example/src/GestureInteraction.js new file mode 100644 index 0000000..f605bb4 --- /dev/null +++ b/example/src/GestureInteraction.js @@ -0,0 +1,58 @@ +import React from 'react'; +import { Button, WebView, View, StyleSheet } from 'react-native'; +import { MapView } from 'expo'; +import { createStackNavigator } from 'react-navigation'; +import { GestureContext } from 'react-navigation-stack'; +import { + PanGestureHandler, + NativeViewGestureHandler, +} from 'react-native-gesture-handler'; + +const IndexScreen = ({ navigation }) => ( + +