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

[V3] StatusBar text color is not inverted correctly with dark-mode active #5446

Closed
Xetoxyc opened this issue Sep 2, 2019 · 12 comments
Closed

Comments

@Xetoxyc
Copy link

Xetoxyc commented Sep 2, 2019

Issue Description

Style for StatusBar is not applied correctly in Dark-Mode as we want a black TextColor in both modes.
We got following behaviour.

Dark-Mode = OFF
light => TextColor = White
dark => TextColor = Dark

Dark-Mode = ON
light => TextColor = White
dark => TextColor = White

Expected behaviour with Dark-Mode = ON would be
light => TextColor = White
dark => TextColor = Black

or

light => TextColor = Black
dark => TextColor = White

Steps to Reproduce / Code Snippets / Screenshots

statusBar: {
    visible: true,
    style: "light",
},

Environment

  • React Native Navigation version: 3.1.2-snapshot.486
  • React Native version: 0.60.3
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Device / 13.0 Beta 7 / Debug
@piuholo
Copy link

piuholo commented Sep 23, 2019

Now that iOS 13 with Dark Mode is properly released, this issue is quite urgent as it can break the user experience, for example in search bars.
For those that want to force their app to always use light mode and disregard the iOS user setting, you can set key UIUserInterfaceStyle to Light in the Info.plist file.

@stale
Copy link

stale bot commented Oct 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

@stale stale bot added the 🏚 stale label Oct 23, 2019
@djschilling
Copy link

The issue is not resolved.

@stale stale bot removed the 🏚 stale label Oct 23, 2019
@tothvoj-gl
Copy link

Any update on this? I see it as a quite high priority and urgent issue.

@GioLogist
Copy link

Might be somewhat related:
#5701

@vstukanov
Copy link

In my case I was also required to change View controller-based status bar appearance value to YES in Info.plist to make status bar text black.

@stale
Copy link

stale bot commented Jan 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

@stale stale bot added the 🏚 stale label Jan 3, 2020
@Xetoxyc
Copy link
Author

Xetoxyc commented Jan 3, 2020

Still not resolved and i think all people above wish to have a fix to use darkmode within their apps

@stale stale bot removed the 🏚 stale label Jan 3, 2020
@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

@stale stale bot added the 🏚 stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 9, 2020

The issue has been closed for inactivity.

@stale stale bot closed this as completed Feb 9, 2020
@guyca guyca reopened this Feb 10, 2020
yogevbd added a commit that referenced this issue Feb 10, 2020
anushnair pushed a commit to anushnair/react-native-navigation that referenced this issue Mar 26, 2020
…nto feature/rnnav-crash-fix-v5

* 'v5' of https://github.com/wix/react-native-navigation: (681 commits)
  f
  Update package.json version to 5.0.0-alpha.14 [ci skip]
  Fix status bar style on iOS 13
  Detach Component view from Component root view
  Update package.json version to 5.0.0-alpha.13 [ci skip]
  Fix unit tests
  Use CATransform3D
  Support anchor transition
  shared text animation fix
  Refactor sharedElement animator
  Fix status bar styles, Closes wix#5446
  Fix topBar options merging with default (wix#5918)
  Update package.json version to 5.0.0-alpha.11 [ci skip]
  Show warning when passing drawBehind false in default options
  Fix import syntax
  Allow reset topBar.title.color when color isn't provided (wix#5910)
  FIx e2e
  Fix e2e
  Fix e2e
  Add Platform prop to Button in Playground app
  ...

# Conflicts:
#	CHANGELOG.md
#	babel.config.js
#	docs/docs/Installing.md
#	docs/docs/events.md
#	docs/docs/showcases.md
#	docs/docs/styling.md
#	docs/docs/topBar-buttons.md
#	lib/android/app/build.gradle
#	lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java
#	lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java
#	lib/android/app/src/main/java/com/reactnativenavigation/parse/TitleOptions.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabsPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/ComponentPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/Presenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/SideMenuPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/presentation/StackPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java
#	lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/CollectionUtils.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/Functions.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/ImageLoader.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/NoOpPromise.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/ObjectUtils.java
#	lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/IdStack.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ParentController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/TitleBarButtonController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/TitleBarReactViewController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/button/IconResolver.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenter.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerBuilder.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarBackgroundViewController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/topbar/TopBarController.java
#	lib/android/app/src/main/java/com/reactnativenavigation/views/BottomTabs.java
#	lib/android/app/src/main/java/com/reactnativenavigation/views/Component.java
#	lib/android/app/src/main/java/com/reactnativenavigation/views/Fab.java
#	lib/android/app/src/main/java/com/reactnativenavigation/views/StackLayout.java
#	lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java
#	lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/NavigationReactNativeHost.java
#	lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/SyncUiImplementation.java
#	lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ComponentViewControllerTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackPresenterTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarControllerTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.java
#	lib/android/app/src/test/java/com/reactnativenavigation/views/TopBarTest.java
#	lib/ios/RNNBridgeManager.m
#	lib/ios/RNNBridgeModule.m
#	lib/ios/RNNCommandsHandler.h
#	lib/ios/RNNCommandsHandler.m
#	lib/ios/RNNControllerFactory.m
#	lib/ios/RNNLeafProtocol.h
#	lib/ios/RNNNavigationButtons.m
#	lib/ios/RNNNavigationController.m
#	lib/ios/RNNNavigationControllerPresenter.m
#	lib/ios/RNNRootViewController.m
#	lib/ios/RNNScreenTransition.h
#	lib/ios/RNNScreenTransition.m
#	lib/ios/RNNSideMenuChildVC.m
#	lib/ios/RNNSideMenuController.m
#	lib/ios/RNNTabBarController.m
#	lib/ios/RNNTabBarPresenter.m
#	lib/ios/RNNTransitionsOptions.h
#	lib/ios/RNNUIBarButtonItem.h
#	lib/ios/RNNUIBarButtonItem.m
#	lib/ios/RNNViewControllerPresenter.m
#	lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj
#	lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m
#	lib/ios/ReactNativeNavigationTests/RNNTabBarPresenterTest.m
#	lib/ios/UIViewController+RNNOptions.h
#	lib/ios/UIViewController+RNNOptions.m
#	lib/src/Navigation.ts
#	lib/src/adapters/Constants.ts
#	lib/src/adapters/NativeEventsReceiver.ts
#	lib/src/adapters/TouchablePreview.tsx
#	lib/src/adapters/UniqueIdProvider.ts
#	lib/src/commands/Commands.test.ts
#	lib/src/commands/Commands.ts
#	lib/src/commands/LayoutTreeCrawler.test.ts
#	lib/src/commands/LayoutTreeCrawler.ts
#	lib/src/commands/LayoutTreeParser.test.ts
#	lib/src/commands/LayoutTreeParser.ts
#	lib/src/commands/OptionsProcessor.test.ts
#	lib/src/commands/OptionsProcessor.ts
#	lib/src/components/ComponentRegistry.test.tsx
#	lib/src/components/ComponentWrapper.test.tsx
#	lib/src/components/ComponentWrapper.tsx
#	lib/src/components/Store.test.ts
#	lib/src/components/Store.ts
#	lib/src/events/ComponentEventsObserver.test.tsx
#	lib/src/events/ComponentEventsObserver.ts
#	lib/src/events/EventsRegistry.ts
#	lib/src/interfaces/Layout.ts
#	lib/src/interfaces/Options.ts
#	metro.config.js
#	package.json
#	playground/android/app/build.gradle
#	playground/android/app/src/main/AndroidManifest.xml
#	playground/android/build.gradle
#	playground/android/gradle.properties
#	playground/android/gradle/wrapper/gradle-wrapper.properties
#	playground/ios/playground.xcodeproj/project.pbxproj
#	playground/src/app.js
#	playground/src/context/index.js
#	playground/src/screens/BackHandlerModalScreen.js
#	playground/src/screens/BackHandlerScreen.js
#	playground/src/screens/ComplexLayout.js
#	playground/src/screens/ContextScreen.js
#	playground/src/screens/CustomDialog.js
#	playground/src/screens/CustomTransitionDestination.js
#	playground/src/screens/CustomTransitionOrigin.js
#	playground/src/screens/ModalScreen.js
#	playground/src/screens/OptionsScreen.js
#	playground/src/screens/PushedScreen.js
#	playground/src/screens/SearchScreen.js
#	playground/src/screens/SideMenuScreen.js
#	playground/src/screens/TextScreen.js
#	playground/src/screens/WelcomeScreen.js
#	playground/src/screens/complexlayouts/CustomDialogWithScroll.js
#	playground/src/screens/index.js
#	playground/src/testIDs.js
#	scripts/release.js
#	scripts/test-unit.js
@yogevbd yogevbd closed this as completed Mar 31, 2020
@Hemistone
Copy link

Any Updates?
I also changed View controller-based status bar appearance as true, but I think this setting can make react-native's StatusBar component not workable.
I'm not using any StatusBar component for now so it does not make any issues, but I'm curious about does react-native's StatusBar Component still works with View controller-based status bar appearance as true.

@Saliheen
Copy link

Saliheen commented Jan 8, 2024

Below code works for me

import {useEffect} from 'react';
import {StatusBar} from 'react-native';

const TranslucentStatusBar = ({isDarkSelected = false}) => {

  useEffect(() => {
    StatusBar.setBarStyle(isDarkSelected ? 'dark-content' : 'light-content');
  }, [isDarkSelected]);

  return (
    <>
      <StatusBar
        translucent={true}
        backgroundColor="transparent"
        animated={true}
      />
    </>
  );
};

export default TranslucentStatusBar;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants