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

enableFreeze can not prevent re-render caused by useIsFocused hook #2005

Open
sunhx-shx opened this issue Jan 8, 2024 · 3 comments
Open
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@sunhx-shx
Copy link

sunhx-shx commented Jan 8, 2024

Description

there have two screen in my application, I press one item navigate to detail screen, when I get into detail screen, the last search screen re-rendered, I used the useIsFocused hook in search.jsx,
the react navigation doc show that using useIsFocused hook triggers a re-render for the screen when it changes focus, Is this the reason? This can show the enableFreeze can not freeze screen which called useIsFocused?

one two

Steps to reproduce

  1. set enableFreeze(true) in app.js
    2.Navigate to search screen.
    3.tap item to detail screen
    4.when get into detail screen, search screen re-render

Snack or a link to a repository

https://snack.expo.dev/hz-a9zzR7

Screens version

~3.20.0

React Native version

0.71.14

Platforms

iOS

JavaScript runtime

JSC

Workflow

Expo bare workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 14 pro max

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided labels Jan 8, 2024
@tboba
Copy link
Member

tboba commented Jan 8, 2024

Hi @sunhx-shx, thank you for creating this issue!
Do you know if this issue still exists on the newest version of react-native-screens? Have you tried to install 3.29.0 version and create a custom development bundle (with npx expo prebuild)?

Also, could you create a repro with similar hierarchy of screens that you have (currently I cannot reproduce this issue, nothing re-renders for me 😕)

@sunhx-shx
Copy link
Author

sunhx-shx commented Jan 8, 2024

Hi @sunhx-shx, thank you for creating this issue! Do you know if this issue still exists on the newest version of react-native-screens? Have you tried to install 3.29.0 version and create a custom development bundle (with npx expo prebuild)?

Also, could you create a repro with similar hierarchy of screens that you have (currently I cannot reproduce this issue, nothing re-renders for me 😕)

@tboba hi thanks for the reply!
Sorry, I made a error in the description of second image above , it should be when i get into detail screen, the previous Search screen re-rendered.

I’ve tried on the newest version of react-native-screens, but the issue still exists.
I've reproduced the issue here: https://github.com/sunhx-shx/furniture_mall
Thanks♪(・ω・)ノ

@sunhx-shx
Copy link
Author

@tboba Can you reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests

2 participants