Skip to content

Commit

Permalink
fix: move GHContext from gesture-handler to native-stack (#2017)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
tboba authored Jan 22, 2024
1 parent 3602dad commit fc806f8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/gesture-handler/GestureDetectorProvider.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
5 changes: 0 additions & 5 deletions src/gesture-handler/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*
* Context
*/
export { GHContext } from './context/GHContext';

/*
* Providers
*/
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit fc806f8

Please sign in to comment.