-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Wrapping my App with <KeyboardProvider> adds space on top and bottom of the screen. #587
Comments
@e-biba-ofti have you tried to specify statusBarTranslucent and navigationBarTranslucent props on |
@kirillzyusko |
@edisoni1995 when you wrap app in On your screenshot these white paddings most likely are caused by this fact (i. e. it's paddings from
I think in your case it'll be safe to add Can you share here two screenshots side by side:
In my understanding these screenshots should be identical. |
@e-biba-ofti would you be able to provide a minimal reproduction example? Something is definetely going wrong here, but without a code I can not say what exactly 😔 Would you be able also to try to comment out this line: Line 58 in 7c9c450
And re-run app again? |
@kirillzyusko that would be very difficult to create for now but I will try to find a minimal reproducable example. I did the change in the android file and re-build android but nothing changed. |
@e-biba-ofti got you! Then minimal reproduction example is highly appreciate - it can significantly reduce the time needed for fixing this problem! ❤️ |
The issue will be resolved soon - it's been merged to |
@RayKay91 oh, yeah, you are right, good catch! @e-biba-ofti did you use |
Yes I am using |
Well @e-biba-ofti I really can't help here 😔 If you can provide a reproduction example that would be a dope and would significantly reduce time for fixing 🙏 |
@rranjan14 what is the exact version of |
here you go @kirillzyusko |
@rranjan14 okay, you'll need to add a patch like https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/example/patches/react-native-screens%2B3.34.0.patch or apply changes from this PR: software-mansion/react-native-screens#2301 Both patches are identical. Hopefully new version of Alternatively you can downgrade your version to |
@kirillzyusko I have been following this issue for some time now. I have tried this but to no avail sadly 😕 |
@rranjan14 okay, then, please, create a small reproduction example and I will have a look on it 👀 By the way - did you specify |
@kirillzyusko I did. And also, I am using |
Well, interesting 🤔 Can you provide a minimal reproduction example?
|
@kirillzyusko unfortunately I do not see this happening in a new project. I suspect this is a configuration issue at my end. I have tried too many things to solve but the outcome is always same. Also, what i observed is, when the value of top inset returned is not 0 from |
@rranjan14 but you can try to simplify your project. In the end you'll end up with a project, where you have 5-6 files and where the issue is reproducible. And then you can share that project (or create a new project and copy all changes from your simplified project to a new project) 👀 |
@kirillzyusko its a big task. I'd surely try this. Will share the simplified project when I can. Thanks a lot! 🫡 |
In case it helps, I had the same problem and adding
|
Working on a reproduction I see weird things happening both at the top and the bottom of the screen at the same time Here's a link to the code used for the screenshot above If I add I simplified the code for the reproduction even more. Now it's just two files. // _layout.tsx
import { Stack } from "expo-router";
import { KeyboardProvider } from "react-native-keyboard-controller";
export default function RootLayout() {
return (
<KeyboardProvider>
<Stack />
</KeyboardProvider>
);
} // index.tsx
import React from "react";
import { Text, ScrollView, StyleSheet } from "react-native";
export default function App() {
return (
<ScrollView contentContainerStyle={styles.scrollViewContainer}>
<Text>Foobar</Text>
</ScrollView>
);
}
const styles = StyleSheet.create({
scrollViewContainer: {
backgroundColor: "lightpink",
flexGrow: 1,
},
}); |
Can you try adding the |
@rranjan14 Thanks! That seems to have improved things 🙂 Now I just need to start slowly adding things back one by one and see how far I can take it until my app breaks again 😆 |
|
@kirillzyusko Thank you! That might explain why rnkc sometimes just stops working altogether for me. Is there any kind of workaround right now? Or do I need to downgrade to earlier version of react-native-screens? |
Well, this is the most proper way to resolve that now 👍 Another workaround that I discovered is mounting |
@e-biba-ofti I also believe that #744 should fix the reported problem (after re-reading our conversation). Could you please check that? 🙏 |
## 📜 Description Execute monkey-patch applying earlier than `StatusBar` modifications. ## 💡 Motivation and Context It happens when `KeyboardProvider` had direct child as `StatusBar` - and such thing can happen in `expo-router`, for example: https://github.com/expo/expo/blob/5f40a80019bb6b892eda94dd244fdc0df8880ccb/packages/expo-router/src/ExpoRoot.tsx#L57 To prevent this problem I'm executing monkey patch applying in "layout effect" instead of plain "effect". This gives me a precious time and an ability to apply patch earlier and thus re-direct a call to my module. And if we dig a little bit deeper. When `KeyboardProvider` gets mounted the `useLayoutEffect` will be fired after component mount. On contrast `StatusBar` will try to change its properties in `componentDidMount`. And technically `componentDidMount` will be executed first (before `useLayoutEffect`). But `StatusBar` schedules update via `setImmediate` and `setImmediate` will execute its callback after `useLayoutEffect`, so this fix should work 🙂 Closes #708 #587 ## 📢 Changelog ### Android - apply monkey patch in layout effect to be sure monkey patch can be applied earlier than first call to `StatusBar` module (if `KeyboardProvider` and `StatusBar` were mounted simultaneously). ## 🤔 How Has This Been Tested? Tested manually in https://github.com/NyoriK/keyboard-controller-test-project ## 📸 Screenshots (if appropriate): https://github.com/user-attachments/assets/6e259ffe-de59-46a6-b9a6-26de05698b06 ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
The issue was automatically closed because I merged the PR. I'm going to publish a fix to npm under If you still encounter this problem, then please open a new issue with all necessary information (such as reproduction example etc.) I strongly believe, that the merged PR should resolve this problem! ❤️ |
Can confirm it fixed the issue for me! I was using react-native-edge-to-edge as a workaround but just removed that and bumped the keyboard-controller to 1.15.2 and there's no extra padding above or below. Thank you! :D |
Yooohooo @RayKay91 🎉 Glad it resolved the problem! 😊 |
@kirillzyusko Thanks for working on this issue! |
Sure ❤️ |
Describe the bug
When wrapping my app with
KeyboardProvider
it adds space looks like it tries to do the same<SafeAreaView>
does but I am already using<SafeAreaView>
partially in my app as in some screens is not needed. If I just disable it<KeyboardProvider enabled={false}>
then the app shows in full view.Expected behavior
The app should show in full screen
Screenshots
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: