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

TVOS does not support dark appearance #2222

Closed
alduzy opened this issue Jul 2, 2024 · 1 comment · Fixed by #2237
Closed

TVOS does not support dark appearance #2222

alduzy opened this issue Jul 2, 2024 · 1 comment · Fixed by #2237
Assignees
Labels
Platform: tvOS Issue related with tvOS compatibility Repro provided A reproduction with a snack or repo is provided

Comments

@alduzy
Copy link
Member

alduzy commented Jul 2, 2024

Description

When trying the TVOSExample app with device's appearance set to dark i noticed the header title is almost invisible.
There is a difference in how the modal header is presented as well. The app looks fine when used with appearance set to light. It's worth noting I did not pass any extra theme to NavigationContainer.

Screenshots

light dark
Screenshot 2024-07-02 at 10 09 37 Screenshot 2024-07-02 at 10 14 41
Screenshot 2024-07-02 at 10 09 30 Screenshot 2024-07-02 at 10 14 50

Expected behaviour

The app should not change it's look based on device's appearance until it is intended by passing theme to NavigationContainer. That's how it works on iOS and android.

Steps to reproduce

  1. Open TVOSExample app
  2. Toggle device's appearance
  3. See changes in the app

Snack or a link to a repository

https://github.com/software-mansion/react-native-screens/tree/main/TVOSExample

Screens version

3.32.0

React Native version

0.74.1

Platforms

tvOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Jul 2, 2024
Copy link

github-actions bot commented Jul 2, 2024

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: tvOS Issue related with tvOS compatibility label Jul 2, 2024
@alduzy alduzy added Repro provided A reproduction with a snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Jul 2, 2024
alduzy added a commit that referenced this issue Jul 15, 2024
## Description

This PR intents to fix navigation bar appearance customization on tvOS.

Now it's impossible to customize the navigation bar on tvOS. The
options, such as `headerTintColor` are not applied at all and the
defaults are making it hard to read when the appearance is set to `dark`
on the device:
- title text color defaults to white
- backgroundColor of modal screens header defaults to dark gray

In current implementation the appearance is set on the navigationItem,
like this: `navigationItem.standardAppearance = appearance`. Out of
curiosity I tried setting the appearance on navigationBar as found in
[this
article](https://developer.apple.com/documentation/uikit/uinavigationcontroller/customizing_your_app_s_navigation_bar?language=objc),
like this: `navigationBar.standardAppearance = appearance` and I got
following error: `New Bar Appearance API is not supported on this
version of tvOS. Use legacy customization`.

Looks like the `UINavigationBarAppearance` does not work for us although
it should be fine on tvOS 13+ according to the
[docs](https://developer.apple.com/documentation/uikit/uinavigationbarappearance?language=objc).
I found using the [legacy
customizations](https://developer.apple.com/documentation/uikit/uinavigationbar/legacy_customizations?language=objc)
to be the only working solution.

Fixes #2222

## Changes

- updating appearance manually for tvOS

## Screenshots / GIFs

| `before` | `after` |
|--------|--------|
| ![Screenshot 2024-07-08 at 10 46
27](https://github.com/software-mansion/react-native-screens/assets/91994767/99b7dcfb-9a0d-4f5d-924b-a96d3c71669b)
| ![Screenshot 2024-07-08 at 10 45
18](https://github.com/software-mansion/react-native-screens/assets/91994767/927a2026-5972-428f-9dd1-f422e1f194db)
|
| ![Screenshot 2024-07-08 at 10 46
42](https://github.com/software-mansion/react-native-screens/assets/91994767/d9ab8a59-3789-4cf7-b11a-10a39bcae0f1)
| ![Screenshot 2024-07-08 at 10 45
33](https://github.com/software-mansion/react-native-screens/assets/91994767/45e00286-5f5c-47d2-8e08-4f0bcc8ecd04)
|

## Test code and steps to reproduce

- Use the `TVOSExample`
- Toggle light/dark appearance on the device
- Customize header options, such as `headerTintColor`

## Checklist

- [x] Ensured that CI passes
ja1ns pushed a commit to WiseOwlTech/react-native-screens that referenced this issue Oct 9, 2024
## Description

This PR intents to fix navigation bar appearance customization on tvOS.

Now it's impossible to customize the navigation bar on tvOS. The
options, such as `headerTintColor` are not applied at all and the
defaults are making it hard to read when the appearance is set to `dark`
on the device:
- title text color defaults to white
- backgroundColor of modal screens header defaults to dark gray

In current implementation the appearance is set on the navigationItem,
like this: `navigationItem.standardAppearance = appearance`. Out of
curiosity I tried setting the appearance on navigationBar as found in
[this
article](https://developer.apple.com/documentation/uikit/uinavigationcontroller/customizing_your_app_s_navigation_bar?language=objc),
like this: `navigationBar.standardAppearance = appearance` and I got
following error: `New Bar Appearance API is not supported on this
version of tvOS. Use legacy customization`.

Looks like the `UINavigationBarAppearance` does not work for us although
it should be fine on tvOS 13+ according to the
[docs](https://developer.apple.com/documentation/uikit/uinavigationbarappearance?language=objc).
I found using the [legacy
customizations](https://developer.apple.com/documentation/uikit/uinavigationbar/legacy_customizations?language=objc)
to be the only working solution.

Fixes software-mansion#2222

## Changes

- updating appearance manually for tvOS

## Screenshots / GIFs

| `before` | `after` |
|--------|--------|
| ![Screenshot 2024-07-08 at 10 46
27](https://github.com/software-mansion/react-native-screens/assets/91994767/99b7dcfb-9a0d-4f5d-924b-a96d3c71669b)
| ![Screenshot 2024-07-08 at 10 45
18](https://github.com/software-mansion/react-native-screens/assets/91994767/927a2026-5972-428f-9dd1-f422e1f194db)
|
| ![Screenshot 2024-07-08 at 10 46
42](https://github.com/software-mansion/react-native-screens/assets/91994767/d9ab8a59-3789-4cf7-b11a-10a39bcae0f1)
| ![Screenshot 2024-07-08 at 10 45
33](https://github.com/software-mansion/react-native-screens/assets/91994767/45e00286-5f5c-47d2-8e08-4f0bcc8ecd04)
|

## Test code and steps to reproduce

- Use the `TVOSExample`
- Toggle light/dark appearance on the device
- Customize header options, such as `headerTintColor`

## Checklist

- [x] Ensured that CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: tvOS Issue related with tvOS compatibility Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant