-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
useAnimatedKeyboard break navigation color #6043
Comments
Hey! 👋 It looks like you've omitted a few important sections from the issue template. Please complete Snack or a link to a repository section. |
This might also be relevant, these are the settings of the nav bar:
|
bottom inset from |
Hi, could you provide a snack or repo with reproduction and some steps or video what's the issue? At this point, I'm not sure.
But does this cause any problems for you? It's is possible that it changes - we turn immersive mode to listen to keyboard changes and apply margins to compensate for that. |
@maciekstosio I can confirm including Repro steps:
Maybe related to this call? Lines 78 to 80 in 4e75ca1
seems related: https://stackoverflow.com/questions/64153785/android-11-window-setdecorfitssystemwindow-doesnt-show-screen-behind-status-a |
What is the purpose of Line 65 in 3188d92
that seems to be what's causing the issue -- if I update insets to if (mKeyboard.getState() == KeyboardState.OPEN) {
mKeyboard.updateHeight(insets);
mNotifyAboutKeyboardChange.call();
}
setWindowInsets(defaultInsets);
updateInsets(0, 0); // <-- added this line
return defaultInsets; |
Hi, sorry for long delay and thank you for your input. To observe keyboard changes we need I guess this will be the same problem as with status bar where we just have special flag for that - |
Btw as a workaround maybe you could use |
How can I disable padding of the bottom navigation? I want to fill the whole screen |
@computerjazz Hi, I added PR that adds a flag that removes the inset for bottom navigation (#6431), but I'm debugging the "clean up" behavior. Correct me If I'm wrong - when you run your snack without |
@maciekstosio I think you have it flipped -- when I run the app without When I add |
@computerjazz Hmm, but is it? I mean on the initial load, not when you build it with |
I've switched into using |
## Summary Resolves #6043. For StatusBar we have a flag that removes top padding when we want to render RN stuff "under" StatusBar. A similar problem was raised in #6043, but for NavigationBar, so I added another flag `isNavigationBarTranslucentAndroid` that removes bottom padding as well. Currently, I see no way to make it automatic. I tried one approach to remove the flags in #5889, but it doesn't seem to be the performant solution. ## Preview |Before|After without flag|After with flag| |-|-|-| |<img width="602" alt="before" src="https://github.com/user-attachments/assets/0032efbe-342a-4e06-81ee-f7351bb032f7">|<img width="602" alt="after-without-flag" src="https://github.com/user-attachments/assets/6f259329-9bf4-4bbb-8ce4-32d671e65a5a">|<img width="602" alt="after-with-flag" src="https://github.com/user-attachments/assets/81c43052-f3b3-4a3b-a9cb-bd974e851c43">| ## Test plan Testing is a bit tricky, because an example from the issue uses a navigation bar package from Expo, which requires Expo and our example app doesn't have Expo. What I did: <details> <summary>Steps</summary> ```bash # clone reanimated from current branch git clone https://github.com/software-mansion/react-native-reanimated.git # checkout current branch git checkout @maciekstosio/Add-support-for-isNavigationBarTranslucentAndroid # install yarn && yarn build # build npm package cd packages/react-native-reanimated ./createNPMPackage.sh --fresh # next, create simple expo project npx create-expo-stack # install library for navigation bar npx expo install expo-navigation-bar # install reanimated npx expo install react-native-reanimated # replace in package.json path to locally-build package i.e.: "react-native-reanimated": "file:react-native-reanimated.tgz" # yarn install # npx expo run:android ``` </details> <details> <summary>App.tsx to test</summary> ```jsx import * as NavigationBar from 'expo-navigation-bar'; import React, { useEffect } from 'react'; import Animated, { useAnimatedKeyboard, useAnimatedStyle, } from 'react-native-reanimated'; import { Platform, StatusBar, StyleSheet, TextInput, View, Text, Button, } from 'react-native'; export default function EmptyExample() { const keyboard = useAnimatedKeyboard({ isNavigationBarTranslucentAndroid: true, }); const animatedStyles = useAnimatedStyle(() => ({ transform: [{ translateY: -keyboard.height.value }], })); useEffect(() => { StatusBar.setBarStyle('dark-content'); NavigationBar.setBackgroundColorAsync('transparent'); }, []); return ( <Animated.View style={[ styles.container, animatedStyles, { justifyContent: 'flex-end', borderWidth: 5, borderColor: '#ff0' }, ]}> <View style={[ styles.center, { height: 200, backgroundColor: '#f0f', borderWidth: 5, borderColor: '#0ff', }, ]}> <Text>{`Android ${Platform.constants['Release']}`}</Text> <TextInput placeholder="Test" /> </View> </Animated.View> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'rgba(255,0,255,0.2)' }, center: { justifyContent: 'center', alignItems: 'center' }, }); ``` </details>
Description
After upgrading to the latest version with expo@51 when I use
keyboardInfoAnimated
inside of a modal I've started observing changes in the color of bottom navigation on Android.Steps to reproduce
keyboardInfoAnimated
from inside of a modalSnack or a link to a repository
Reanimated version
3.11.0
React Native version
0.74.1
Platforms
Android
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: