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

KeyboardProvider breaks translucent system navigation bar #119

Closed
whalemare opened this issue Feb 23, 2023 · 5 comments · Fixed by #120
Closed

KeyboardProvider breaks translucent system navigation bar #119

whalemare opened this issue Feb 23, 2023 · 5 comments · Fixed by #120
Assignees
Labels
🤖 android Android specific 🐛 bug Something isn't working

Comments

@whalemare
Copy link

Describe the bug
When I wrap my app with

return <KeyboardProvider statusBarTranslucent>{children}</KeyboardProvider>

Android system navigation bar becomes colored, not translucent

Code snippet

return <KeyboardProvider statusBarTranslucent>{children}</KeyboardProvider>

styles.xml

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:forceDarkAllowed" tools:ignore="NewApi">false</item>

        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
        <item name="android:navigationBarColor">@android:color/transparent</item>
    </style>

Repo for reproducing
I can do it later if you need it

To Reproduce

  1. Wrap app with KeyboardProvider
  2. Use translucent navigation
  3. Run app

Expected behavior
Снимок экрана 2023-02-23 в 12 56 00

Actual behavior
Снимок экрана 2023-02-23 в 12 54 46

Smartphone (please complete the following information):

  • Desktop OS: MacOS
  • Device: Android Nexus 5
  • OS: API 33
  • RN version: 0.71.2
  • RN architecture: old, paper
  • JS engine: Hermes
  • Library version: 1.4.3

Additional context
no applicable

@whalemare whalemare added the 🐛 bug Something isn't working label Feb 23, 2023
@kirillzyusko
Copy link
Owner

Hi @whalemare

Nice point! Actually I think it kind of expected behavior, since in the code I specify it like

Which literally means "apply default padding". I think I need to introduce navigationBarTranslucent prop to make it configurable. For now you can use patch-package and instead of this line simply specify 0 (just remove insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom ?: and leave 0).

Please, let me know, if the "fix" with substituting 0 instead of ternary operator actually helps or not. If it helps then I will create a PR soon 👀

@kirillzyusko kirillzyusko added the 🤖 android Android specific label Feb 23, 2023
@whalemare
Copy link
Author

Yes, it helps! Thanks a lot

@kirillzyusko
Copy link
Owner

@whalemare awesome! I will submit a PR in next few days 👀

kirillzyusko added a commit that referenced this issue Feb 28, 2023
## 📜 Description

Added new `navigationBarTranslucent` prop on `KeyboardProvider`.

## 💡 Motivation and Context

To make it more customizable and support translucent navigation bar I
decided to add a new prop called `navigationBarTranslucent`. This prop
follows the same pattern as `statusBarTranslucent`.

Fixes
#119

## 📢 Changelog

### JS
- updated specs for fabric codegen;

### Android
- added handling of new property (if property is set to `true`, then we
are setting 0 bottom padding - the same logic is already used for
controling status bar transparency);

## 🤔 How Has This Been Tested?

Manually tested on:
- Pixel 3a (API 33, emulator);
- Pixel 6 Pro (API 28, emulator)

## 📸 Screenshots (if appropriate):

|Before|After|
|-------|---------------|
|<img width="226" alt="image"
src="https://user-images.githubusercontent.com/22820318/221593460-a65f9136-ae60-40e0-8243-154c252dc903.png">|<img
width="226" alt="image"
src="https://user-images.githubusercontent.com/22820318/221593746-e56fc41a-cf07-43d0-a2be-ab948a022897.png">|

## 📝 Checklist

- [x] CI successfully passed
@kirillzyusko
Copy link
Owner

I've merged a PR that adds new property called navigationBarTranslucent on KeyboardProvider

So you'll need to use:

<KeyboardProvider navigationBarTranslucent>
...
</KeyboardProvider>

In order not to break translucency specified by android styles.

@kirillzyusko
Copy link
Owner

Fixed in 1.4.4 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Android specific 🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants