Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ScreenNativeComponent.ts #2016

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

WoLewicki
Copy link
Member

As requested by @tboba

tboba and others added 2 commits January 18, 2024 11:21
…rning for goBackGesture (#2013)

## Description
Previously, after going from one screen to another (or after opening the
app) there was an error regarding ScreenGestureDetector:

`Warning: Invalid prop 'gestureDetectorBridge' supplied to
'React.Fragment'. React.Fragment can only have 'key' and 'children'
props.`

This error indicates that we were passing props from
ScreenGestureDetector to React.Fragment. Indeed, after looking onto the
default value of GHContext, there was a Fragment that was receiving
invalid props.
This PR fixes this by changing the look of React.Fragment, so we won't
pass the props further.

Also, I've added a warning that is being shown when user tries to use
`goBackGesture` and the navigator is not wrapped in
ScreenGestureDetector.

Fixes #2010.

## Changes

- Fix warning of React.Fragment when the ScreenGestureDetector isn't
mounted
- Add warning when user tries to use `goBackGesture` and the navigator
is not wrapped in ScreenGestureDetector
- Reformated code a bit

## Screenshots / GIFs

### Before


https://github.com/software-mansion/react-native-screens/assets/23281839/f3517b73-de80-45a5-847e-bd817d3d2682

### After

Video shows behavior on going from one screen to another and a warning
when there's prop `goBackGesture` without ScreenGestureProvider.


https://github.com/software-mansion/react-native-screens/assets/23281839/7b477ea6-08cc-40ed-afd5-879675776007

## Test code and steps to reproduce

You can test the changes in a several ways:
- By checking Screen animation example from ScreensExample
- By checking Test42 from TestsExample
- By checking TestScreenAnimation from FabricTestExample

## Checklist

- [X] Included code example that can be used to test this change
- [x] Ensured that CI passes
@WoLewicki WoLewicki changed the base branch from main to WoLewicki-change-event-name January 18, 2024 10:31
@WoLewicki WoLewicki merged commit 9a6c91d into WoLewicki-change-event-name Jan 18, 2024
4 of 5 checks passed
@WoLewicki WoLewicki deleted the WoLewicki-patch-2 branch January 18, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants