Open okwasniewski opened 2 weeks ago
Hi @okwasniewski ,
I've been reviewing the freezeOnBlur
implementation in the JS bottom tabs. In that setup, freezeOnBlur
is passed as a screenOptions
from Tab.navigator or directly in the options
for each Screen. It ultimately propagates this prop to Screens from react-native-screens
(code reference).
This approach leverages react-freeze
to manage screen freezing.
However, for NativeBottomTabs, we're using platform-specific APIs to create the bottom tabs, which means we aren’t leveraging react-native-screens
. Given this, would you recommend a custom approach to achieve similar functionality for freezeOnBlur
?
One possibility might be to use information about loaded tabs to manage freezing behaviour (see reference).
Additionally, enableFreeze()
currently has no effect in NativeBottomTabs
, I’m curious if you’d suggest any alternative approaches or improvements here.
Thanks for your guidance!
Hey @shubhamguptadream11,
Thanks for looking into this!
I was thinking that we can take the JS implementation and wrap each screen with ScreenFallback
.
We are currently wrapping each screen with View anyways so this can be changed to the ScreenFallback:
This should be an optional peer dependency as this prop will be optional.
Looks like in V7 its called detachInactiveScreens
It's purpose is to save memory by detaching the view.
But to make freezeOnBlur
works, detachInactiveScreens must be true
which is it's default value.
freezeOnBlur
Boolean indicating whether to prevent inactive screens from re-rendering. Defaults to false. Defaults to true when enableFreeze() from react-native-screens package is run at the top of the application.
Requires react-native-screens version >=3.16.0.
Only supported on iOS and Android.