-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
How to use with Expo? #461
Comments
What's the specific issue that you are encountering? You should be able to simply add the package using "yarn add" or "npm install" command and then use |
<!-- ... -->
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<!-- ... --> ^ This is not possible with Expo. Is it truly necessary, or are the docs out of date? |
Hi, I'm wondering the same. For an app I'd like a system similar to Intercom where customers can chat with an app admin easily (with images/files integration...). Intercom requires ejecting so this chat lib is a potential candidate as well as it may permit avoid ejecting to CRNA/Expo. As far as I know it's not possible to customize manifest without ejecting of Expo, so it would be nice to know if this is really required or not. @FaridSafi added this in doc so he may know why this is needed: 79b1964 Also note that it's possible the manifest already has this setting in expo, according to what I see: https://github.com/expo/expo/blob/master/exponent-view-template/android/app/src/main/AndroidManifest.xml#L14 I think it would be nice if someone build a sample app to demonstrate usage in Expo, and then to add to readme that this lib is compatible with Expo without ejecting. |
I submitted a PR to the docs to explain that this config is already done in Expo. |
@brentvatne Thanks for showing up and saving my day in almost all issues I encountered with expo! You are the hero! |
Did this actually work for anyone? I'm using Gifted.chat in Expo 18 and the keyboard is covering the text input. |
I created an example here: https://github.com/llamaluvr/expo-gifted-chat-example You can run it with When I did this, the keyboard hid the input toolbar and the bottom of the chat window- nothing was pushed up. Further, when I detached from Expo, I saw that AndroidManifest.xml had the required options, yet, when I ran it using So, I'm left wondering if this works correctly on Android at all. I guess I'll try it next with a plain react native project, though I don't see what difference that will make compared to a detached Expo project. |
Figured it out! Well, at least what is wrong. If you remove |
It's really unclear what repo this would even be an issue under, so I've posted the issue at https://forums.expo.io/t/android-theme-causes-window-not-to-resize-when-keyboard-is-open/1582 |
In the meantime, I'm using the following workaround of using a keyboard spacer. I'm having a hard time seeing any difference between this and the way it works outside of Expo.
|
I think the ideal solution here is to actually make this work without detaching |
You can set the status bar background color in app.json and that may help too (as it becomes opaque rather than transparent when this happens)
|
Clarified in #482. Thanks everyone! |
I follow the directions in git clone https://github.com/FaridSafi/react-native-gifted-chat and get
yarn run v0.27.5 npm ERR! A complete log of this run can be found in: |
Hello, I have found a way to show the TextInput by adding a props forceGetKeyboardHeight Please see this fix and vote for it: @FaridSafi , @kfiroo or @cooperka Please review it :) Thanks! |
@xcarpentier - can you explain how this works? i don't think these changes are resulting in the intended behavior (testing on android emulator with Android 8.0) |
@llamaluvr - Your solution at the top fixed the problem of the Android keyboard hiding the text inputs!! Life saver 👍 |
One note I forgot when I posted about how you could get the view to adjust by detaching from Expo and updating AndroidManifest.xml: you don't actually need to detach. Setting a backgroundColor for the androidStatusBar in app.json effectively makes the same change. Either way you do it, there's a pretty big consequence, though (and I don't think it has anything to do with Expo, but with RN in general) - you lose the transparent status bar. IMO it doesn't look as good and it mucked other things up in my app, which is why I'm sticking with adding the KeyboardSpacer. On that note, I'm really wondering if it's worth it for GiftedChat to try to handle moving the view based on the keyboard at all, or at least make it configurable to turn it off for those who don't want or need its handling. If there was an option to turn off GiftedChat's keyboard avoidance, I would handle keyboard avoidance like any other view in my app- by adding the spacer, regardless of platform. Some people add a spacer in their root component so they never have to worry about it again, but that doesn't work with GiftedChat because it also has it's own avoidance. IMO adding a spacer isn't that hard and puts the developer in full control. |
I also ran into these differences with In my own project, i've essentially normalised Android to behave in the same way as iOS. This way KeyboardAvoidingView just works out of the box! I left android to use the default Then i set the root view of my app to be the height of the window dimensions. This prevents the view from collapsing when the keyboard appears, acting essentially the same as on iOS. Anyway, thought i'd post that here in case it's useful. |
I solved by using
|
Since my original workaround is linked on the readme, I wanted to update on something we recently found. react-native-keyboard-spacer uses
However, it has the opposite problem that react-native-keyboard-spacer has with navigation chrome- headers throw it off. This can be resolved by setting I'll make a note to submit a PR tomorrow suggesting a documentation change to this effect. |
* adding forceGetKeyboardHeight props * fixes FaridSafi/react-native-gifted-chat#461
* adding forceGetKeyboardHeight props * fixes FaridSafi/react-native-gifted-chat#461
* adding forceGetKeyboardHeight props * fixes FaridSafi/react-native-gifted-chat#461
* adding forceGetKeyboardHeight props * fixes FaridSafi/react-native-gifted-chat#461
* adding forceGetKeyboardHeight props * fixes FaridSafi/react-native-gifted-chat#461
Trying to understand how to install this in Expo if I want to use Android?
The text was updated successfully, but these errors were encountered: