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
fix(iOS)!: Add system
/systemInverted
prop for statusBarStyle
#2106
base: main
Are you sure you want to change the base?
Conversation
system
/systemInverted
prop for statusBarStylesystem
/systemInverted
prop for statusBarStyle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments, if it is going to be introduced in new version, we can get rid of the previous values totally.
@@ -268,6 +268,10 @@ const RouteView = ({ | |||
const Screen = React.useContext(ScreenContext); | |||
const { dark } = useTheme(); | |||
|
|||
if (statusBarStyle === 'auto') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some warning that the behavior changed and you should use system
? Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding some note in the changelog should be sufficient - especially, if we want to merge this for v4 😄
@@ -44,11 +44,11 @@ + (UIStatusBarStyle)statusBarStyleForRNSStatusBarStyle:(RNSStatusBarStyle)status | |||
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 | |||
if (@available(iOS 13.0, *)) { | |||
switch (statusBarStyle) { | |||
case RNSStatusBarStyleAuto: | |||
case RNSStatusBarStyleSystem: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone passes RNSStatusBarStyleAuto
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, since we're not controlling the behavior of auto
prop on the native side (it's handled on JS with the dark
prop from useTheme()), I believe we don't need to handle the case of auto
here.
*/ | ||
statusBarStyle?: 'inverted' | 'auto' | 'light' | 'dark'; | ||
statusBarStyle?: 'auto' | 'system' | 'systemInverted' | 'light' | 'dark'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now inverted
and auto
will not be available at all? If so, I guess it will land in v4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most likely. I was thinking if we want to keep inverted
option that will be reverse of auto
(or just keep it as a fallback option to systemInverted
), but I'm for introducing this change on v4, yeah.
system
/systemInverted
prop for statusBarStylesystem
/systemInverted
prop for statusBarStyle
Description
This PR intents to fix an issue, where headers were not styled correctly in react-navigation. It adds two new props:
system
andsystemInverted
that will be used for setting system-based theme of status bar. These were previously in screens, but were not used by default, since we were mostly relying on react-navigation's dark theme. As we still want to rely on the theme, configured in NavigationContainer, this PR also adds newauto
prop, that will usedark
setting fromuseTheme
hook to control, whether there should belight
ordark
theme set.Note: this change is meant to be breaking, since it changes default behavior of statusBarStyle and removes
inverted
prop (replaced bysystemInverted
).Fixes #2083, react-navigation/react-navigation#11397
Changes
auto
andinverted
props tosystem
andsystemInverted
auto
prop for setting theme, according to the one from react-navigation.Screenshots / GIFs
8mb.video-okl-CHWyXdN5.mp4
I've managed to compress 335mb into 6mb - I'd recommend watching this on fullscreen mode 😨
Test code and steps to reproduce
I've mostly edited Test2069.tsx to add a theme for NavigationContainer 👇
Code preview
Checklist