From ab840483497b520094e61c99ba509d00f06c3889 Mon Sep 17 00:00:00 2001 From: Tymoteusz Boba Date: Mon, 22 Jan 2024 12:16:53 +0100 Subject: [PATCH] fix: move GHContext from gesture-handler to native-stack (#2017) ## Description Unfortunately, because of changing the way how we export the components, I didn't saw the wrong export of GHContext in gesture-handler's `index.tsx` file. To match the changes from the PR with full screen swipe (#1913), I've created the directory in a wrong place. This PR fixes this export by moving the context to native-stack and removing the export from the gesture-handler/index.tsx. I'm also removing this export, because right now it's possible to import GHContext from `react-native-screens` and also from `react-native-screens/gesture-handler` which is wrong. ## Changes - Changed the export of GHContext in index.tsx - Moved GHContext from gesture-handler to native-stack ## Test code and steps to reproduce Try to build and run TestsExample - see if the bundling state passes correctly. Then, try to import GestureDetectorProvider and wrap whole navigator in it. ## Checklist - [X] Included code example that can be used to test this change - [x] Ensured that CI passes --- src/gesture-handler/GestureDetectorProvider.tsx | 2 +- src/gesture-handler/index.tsx | 5 ----- src/index.tsx | 4 ++-- .../context => native-stack/contexts}/GHContext.tsx | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) rename src/{gesture-handler/context => native-stack/contexts}/GHContext.tsx (80%) diff --git a/src/gesture-handler/GestureDetectorProvider.tsx b/src/gesture-handler/GestureDetectorProvider.tsx index 3648aea7b2..d506881860 100644 --- a/src/gesture-handler/GestureDetectorProvider.tsx +++ b/src/gesture-handler/GestureDetectorProvider.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { GHContext } from './context/GHContext'; +import { GHContext } from 'react-native-screens'; import ScreenGestureDetector from './ScreenGestureDetector'; import type { GestureProviderProps } from '../native-stack/types'; diff --git a/src/gesture-handler/index.tsx b/src/gesture-handler/index.tsx index 65403ead4a..176c9ff765 100644 --- a/src/gesture-handler/index.tsx +++ b/src/gesture-handler/index.tsx @@ -1,8 +1,3 @@ -/* - * Context - */ -export { GHContext } from './context/GHContext'; - /* * Providers */ diff --git a/src/index.tsx b/src/index.tsx index de862ff7b3..7fa79c235e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -53,9 +53,9 @@ export { default as FullWindowOverlay } from './components/FullWindowOverlay'; export { default as NativeScreensModule } from './fabric/NativeScreensModule'; /* - * Gesture Handler + * Contexts */ -export { GHContext } from './gesture-handler'; +export { GHContext } from './native-stack/contexts/GHContext'; /* * Utils diff --git a/src/gesture-handler/context/GHContext.tsx b/src/native-stack/contexts/GHContext.tsx similarity index 80% rename from src/gesture-handler/context/GHContext.tsx rename to src/native-stack/contexts/GHContext.tsx index 096c78d3f3..05b93e2a38 100644 --- a/src/gesture-handler/context/GHContext.tsx +++ b/src/native-stack/contexts/GHContext.tsx @@ -1,5 +1,5 @@ import React, { PropsWithChildren } from 'react'; -import { GestureProviderProps } from '../../native-stack/types'; +import { GestureProviderProps } from '../types'; // context to be used when the user wants full screen swipe (see `gesture-handler` folder in repo) export const GHContext = React.createContext(