-
-
Notifications
You must be signed in to change notification settings - Fork 98
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 when using signals with react-native navigation #257
Comments
I am running into this same error. |
same here.. |
This issues happens in // React.createElement = WrapJsx(React.createElement);
// JsxDev.jsx && /* */ (JsxDev.jsx = WrapJsx(JsxDev.jsx));
// JsxPro.jsx && /* */ (JsxPro.jsx = WrapJsx(JsxPro.jsx));
// JsxDev.jsxs && /* */ (JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
// JsxPro.jsxs && /* */ (JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
// JsxDev.jsxDEV && /**/ (JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
// JsxPro.jsxDEV && /**/ (JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV)); So, I suggest to disable these lines at |
Facing the same issue with a BottomTabNavigator in React Native. |
Facing the same problem. |
I fixed this issue (it works for 1.2.1 version). You need to apply this patch for @react-navigation/core: diff --git a/node_modules/@react-navigation/core/src/Group.tsx b/node_modules/@react-navigation/core/src/Group.tsx
index 352ba31..893d2c2 100644
--- a/node_modules/@react-navigation/core/src/Group.tsx
+++ b/node_modules/@react-navigation/core/src/Group.tsx
@@ -12,3 +12,4 @@ export default function Group<
/* istanbul ignore next */
return null;
}
+Group.__isGroup = true;
\ No newline at end of file
diff --git a/node_modules/@react-navigation/core/src/Screen.tsx b/node_modules/@react-navigation/core/src/Screen.tsx
index 4ca4306..f116e61 100644
--- a/node_modules/@react-navigation/core/src/Screen.tsx
+++ b/node_modules/@react-navigation/core/src/Screen.tsx
@@ -15,3 +15,4 @@ export default function Screen<
/* istanbul ignore next */
return null;
}
+Screen.__isScreen = true;
\ No newline at end of file
diff --git a/node_modules/@react-navigation/core/src/useNavigationBuilder.tsx b/node_modules/@react-navigation/core/src/useNavigationBuilder.tsx
index 76442df..e1c8632 100644
--- a/node_modules/@react-navigation/core/src/useNavigationBuilder.tsx
+++ b/node_modules/@react-navigation/core/src/useNavigationBuilder.tsx
@@ -93,7 +93,7 @@ const getRouteConfigsFromChildren = <
ScreenConfigWithParent<State, ScreenOptions, EventMap>[]
>((acc, child) => {
if (React.isValidElement(child)) {
- if (child.type === Screen) {
+ if (child.type?.__isScreen) {
// We can only extract the config from `Screen` elements
// If something else was rendered, it's probably a bug
@@ -121,7 +121,7 @@ const getRouteConfigsFromChildren = <
return acc;
}
- if (child.type === React.Fragment || child.type === Group) {
+ if (child.type === React.Fragment || child.type?.__isGroup) {
if (!isValidKey(child.props.navigationKey)) {
throw new Error(
`Got an invalid 'navigationKey' prop (${JSON.stringify(
|
The error is easy to replicate.
packadge.json
How to reproduce.
example
I have another file containing an exported signal
Once I import this signal inside the Login component and use it there, I get the error
Error: A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found 'Screen' for the screen 'Login'). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.
The text was updated successfully, but these errors were encountered: