Closed 1280103995 closed 2 years ago
Use push / replace / pop stackEntry: https://github.com/zoontek/react-native-bars#statusbarpushstackentry
This does exactly what you want.
Use push / replace / pop stackEntry: https://github.com/zoontek/react-native-bars#statusbarpushstackentry
This does exactly what you want.
I tried these methods, but they didn't work.
They are used internally by the components, check usage: https://github.com/zoontek/react-native-bars/blob/3e77d45b72e527e71e35cf43eac1eb4165c5a0ca/src/StatusBar.tsx#L81
I don't know why it was changed to light-content
at the end. When I commented out barStyle, the pushStackEntry
method worked normally.
// Update the current props values.
StatusBar.mergedProps = {
...lastEntry,
barStyle: "light-content",
};
Same in NavigationBar.
Indeed, it's was a default for when lastEntry was null (const mergedProps = { barStyle: "light-content", ...lastEntry }
).
I commited something stupid, sorry (not even the right order). Just published the 1.1.1
that fix that.
Indeed, it's was a default for when lastEntry was null (
const mergedProps = { barStyle: "light-content", ...lastEntry }
). I commited something stupid, sorry (not even the right order). Just published the1.1.1
that fix that.
Great!
Why it is needed?
Sometimes people don't want to update barStyle by rendering components. Therefore, providing static methods can meet these needs.
Currently I switch screens back and forth in the TabBar of
react-navigation
, and the barStyle has not changed (rendered by components). Therefore, I want to change the barStyle in a way similar tonavigation.addListener('focus')
.:grin:Possible implementation
Add the setBarStyle method to the component.
StatusBar.tsx
NavigationBar.tsx
Code sample