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

freezeEnabled is not a function #2302

Closed
Randall71 opened this issue Aug 13, 2024 · 7 comments
Closed

freezeEnabled is not a function #2302

Randall71 opened this issue Aug 13, 2024 · 7 comments
Assignees
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS

Comments

@Randall71
Copy link

Description

My application works normally but when I add the React compiler I get this error and I can no longer launch my application in development mode.

After adjusting the configuration like this and my application works as before with the compiler, so I put this here in case there is something to review, otherwise feel free to close it

diff --git a/node_modules/react-native-screens/src/components/ScreenStack.tsx b/node_modules/react-native-screens/src/components/ScreenStack.tsx
index 46043b6..8a661fa 100644
--- a/node_modules/react-native-screens/src/components/ScreenStack.tsx
+++ b/node_modules/react-native-screens/src/components/ScreenStack.tsx
@@ -21,7 +21,7 @@ function ScreenStack(props: ScreenStackProps) {
     const { props, key } = child;
     const descriptor = props?.descriptor ?? props?.descriptors?.[key];
     const isFreezeEnabled =
-      descriptor?.options?.freezeOnBlur ?? freezeEnabled();
+      descriptor?.options?.freezeOnBlur ;
 
     // On Fabric, when screen is frozen, animated and reanimated values are not updated
     // due to component being unmounted. To avoid this, we don't freeze the previous screen there

Steps to reproduce

--

Snack or a link to a repository

--

Screens version

3.34.0

React Native version

0.74.5

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

Expo managed workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

Samsung Galaxy Tab A7 (Android 12)

Acknowledgements

Yes

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Aug 13, 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 Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS Missing info The user didn't precise the problem enough labels Aug 13, 2024
Copy link

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Steps to reproduce and Snack or a link to a repository sections.

@parsadotsh
Copy link

I run into the same issue (I have react-compiler on) when I update certain dependencies:
image

@avoc-ado
Copy link

avoc-ado commented Aug 17, 2024

2 distinct workarounds:
1: add freezeOnBlur to every screen.

<Stack.Screen
  name="(tabs)"
  options={{
    freezeOnBlur: false,
  }}
/>

2: make a yarn patch to replace the freezeEnabled() call with true/false

@somangoi
Copy link

In my case, this error happened when I updated "react-native-screens" from ~3.29.0 to 3.31.1. When I downgraded to ~3.29.0, it got back normal.

@jeroenptrs
Copy link

Patching freezeEnabled still causes issues when I switch tabs with expo-router, getting Error: Rendered fewer hooks than expected. when I do.

Anyone else experiencing this?

@alduzy
Copy link
Member

alduzy commented Oct 17, 2024

I believe #2410 fixes the issue unintentionally 😄
Try applying the following patch:

diff --git a/node_modules/react-native-screens/src/components/ScreenStack.tsx b/node_modules/react-native-screens/src/components/ScreenStack.tsx
index 1783dcf..e08dbff 100644
--- a/node_modules/react-native-screens/src/components/ScreenStack.tsx
+++ b/node_modules/react-native-screens/src/components/ScreenStack.tsx
@@ -1,5 +1,6 @@
 import React from 'react';
-import { ScreenStackProps, freezeEnabled } from 'react-native-screens';
+import { ScreenStackProps } from '../types';
+import { freezeEnabled } from '../core';
 import DelayedFreeze from './helpers/DelayedFreeze';
 
 // Native components

@alduzy alduzy closed this as completed Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS
Projects
None yet
Development

No branches or pull requests

6 participants