Comments (5)
Thank you @kirillzyusko. I think I had a wrong understanding of adjustPan. And I think I get your point for the goal of the library.
Thank your for the clarification 🙏. I'll be closing this as it is not really a bug.
from react-native-keyboard-controller.
Hey @itsramiel
When you wrap app in KeyboardProvider
it will move app in edge-to-edge mode on Android (and in this mode app is not resizing window automatically - this is your first video).
Note
If you want to return to default behavior, then you'll need to use useKeyboardController
and disable/enable module where you need calling setEnabled(false)
or setEnabled(true)
(on Provider level you can disable module initially and enable only where you need).
Regarding adjustPan
behavior - yes it'll affect how window is resized. Again if you want to match iOS behavior and write cross platform code, you need to go to edge-to-edge mode and set windowSoftInputMode
to adjustResize
(and in this case you need to handle keyboard appearance on your own).
I hope I answered on your question - but if not, then please feel free to ask additional questions 😊
Maybe documentation can be somehow improved?
from react-native-keyboard-controller.
Hey @kirillzyusko
Hmm okay so I think I got the first point and that is when you wrap the app with the provider that app stops resizing because that how android behaves in edge to edge.
However I still don't get the second point. If wrapping the app with the provider stops the resizing why does it go back to resizing when I was setting the windowSoftInputMode to adjustPan? From what I understood that windowSoftInputMode will not longer affect and it will always pan.
Now just a general comment here. I think integrating this library to an existing brownfield project is quite cumbersome annoying. I would have loved if the library only affects where it is used. If I need a KeyboardAvoidView
then I just use it in that screen while knowing my windowSoftInputMode
is not altered. I see how this can be worked around by enablind/disabling the module but yeah I would have loved it if it was less intrusive
from react-native-keyboard-controller.
However I still don't get the second point. If wrapping the app with the provider stops the resizing why does it go back to resizing when I was setting the windowSoftInputMode to adjustPan? From what I understood that windowSoftInputMode will not longer affect and it will always pan.
Actually it will affect. adjustPan
will move a content. To understand the difference between soft input modes you can have a look on this post.
When you enter edge-to-edge and specify adjustResize
-> window will not be resized anymore:
Screen.Recording.2024-03-07.at.17.52.29.mov
But If you are in edge-to-edge
and use adjustPan
- it will translate the content of the screen:
Screen.Recording.2024-03-07.at.17.54.37.mov
I think I wrote slightly incorrect information in documentation? Would you mind to point me to the documentation where I wrote such information (that window with edge-to-edge
and adjustPan
will not move the content? I remember I wrote something somewhere, but can not find it right now...).
Now just a general comment here. I think integrating this library to an existing brownfield project is quite cumbersome annoying. I would have loved if the library only affects where it is used. If I need a KeyboardAvoidView then I just use it in that screen while knowing my windowSoftInputMode is not altered. I see how this can be worked around by enablind/disabling the module but yeah I would have loved it if it was less intrusive
The problem is that in react-native you can not simply rely on the component usage. For example if you are using react-navigation
and use KeyboardAvoidingView
on screen A
. Then you go in stack navigator to screen B
(and in this screen you want to use default resizing mechanisms). On screen A
the KeyboardAvoidingView
is still mounted - does it mean that you want to use library functionality? No, because you want to use default resizing mechanism based on windowSoftInputMode
.
That's why this library provides primitives (enabling/disabling module, setting windowSoftInputMode
in runtime) so that you can implement any logic inside your app (with any navigation library) and assure a gradual adoption.
If you want to write the component that will enable library when it gets mounted, you can create your own component, for example:
const KeyboardAvoidingViewWithAutoActivation = ({children}) => {
const {setEnabled} = useKeyboardController();
// or any other condition for activation, for example when screen becomes focused/unfocused
useEffect(() => {
setEnabled(true);
return () => setEnabled(false);
}, []);
return (
<KeyboardAvoidingView>{children}</KeyboardAvoidingView>
)
}
from react-native-keyboard-controller.
@itsramiel my pleasure 😊
By the way, if you have an suggestions for documentation improvements - I'll be happy to hear them 😊
from react-native-keyboard-controller.
Related Issues (20)
- `useFocusedInputHandler` and `onChangeText` handler ignores an input from `react-native-text-input-mask` on iOS
- Incorrect KeyboardAvoidingView calculations on Android HOT 5
- Slow back scroll on `KeyboardAwareScollView` on some Android devices HOT 1
- Check for `ScrollView` ancestor in `KeyboardAwareScrollView`
- `onScroll` on `KeyboardAwareScrollView` is not fired
- KeyboardAwareScrollView not working on first load of the app after fresh install in production iOS builds HOT 1
- Bottom Sheet component compatibility/custom native wrapper(long-term feature) HOT 4
- KeyboardAwareScrollView scrolling too much when pasting a lot of content in multiline inputibox HOT 8
- KeyboardAwareScrollView has no ref prop HOT 3
- [ios] build error 'react_native_keyboard_controller-Swift.h' file not found HOT 8
- modal looks weird after use TextInput on KeyboardAwareScrollView HOT 13
- Animated keyboard values do not update if the focussed TextInput exists within a modal HOT 9
- Compilation Error on iOS with Fabric and `useFrameworks: 'static'` HOT 3
- Add an ability to show views over the keyboard (when it's open)
- KeyboardToolbar component with different text input types
- useKeyboardAnimation hook always returns 0 HOT 9
- Weird Scroll when change text event fires on android 9 and 10 HOT 13
- is there any hooks that i can use to determine if keyboard is visible or not? HOT 3
- Opening Modal prevents proper resizing of layout HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-keyboard-controller.