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

Error: Invalid prop gestureDetectorBridge supplied to React.Fragment while opening a screen on iOS #2010

Closed
tboba opened this issue Jan 15, 2024 · 2 comments · Fixed by #2013
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS

Comments

@tboba
Copy link
Member

tboba commented Jan 15, 2024

Description

It seems that PR #1913 has introduced a bug while opening (or going to another) screen. After opening any test from TestsExample and FabricTestExample, I'm receiving an error:

Warning: Invalid prop `gestureDetectorBridge` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.
Screen.Recording.2024-01-15.at.10.29.01.mov

Steps to reproduce

  1. Open any test case from TestsExample / FabricTestExample
  2. See that after opening an app / after going to another screen warning appears on the console and on the screen.

Snack or a link to a repository

https://github.com/software-mansion/react-native-screens

Screens version

3.29.0

React Native version

0.73.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 15 Pro (iOS 17.2)

Acknowledgements

Yes

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Jan 15, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: iOS This issue is specific to iOS label Jan 15, 2024
@tboba tboba added Repro provided A reproduction with a snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Jan 15, 2024
@tboba
Copy link
Member Author

tboba commented Jan 15, 2024

What's more interesting is that TestScreenAnimation does not report any warning, so it's probably a matter of wrapping the code with <GestureHandlerRootView style={{ flex: 1 }}> / GestureDetectorProvider.

@github-actions github-actions bot added Missing repro This issue need minimum repro scenario and removed Repro provided A reproduction with a snack or repo is provided labels Jan 15, 2024
tboba added a commit that referenced this issue Jan 18, 2024
…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
ja1ns pushed a commit to WiseOwlTech/react-native-screens that referenced this issue Oct 9, 2024
…rning for goBackGesture (software-mansion#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 software-mansion#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS
Projects
None yet
1 participant