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
Android support? #2
Comments
Hello @cmmouritsen! Yes, it should work for Android as long as the keyboard events are registered but I think that those events are not yet supported: facebook/react-native#3468 Have you tried to use |
Just changing the events to keyboardDidShow and keyboardDidHide didn't seem On Thu, Nov 12, 2015 at 6:28 AM Álvaro Medina Ballester <
|
Ok, I would really like to have a PR for Android support. Let me know if I can help you :) |
I've started trying to add Android support: https://github.com/jblack10101/react-native-keyboard-aware-scroll-view. Android doesn't have handy events like keyboardDidShow and keyboardDidHide, so I'm extending the native ReactScrollView and checking if the keyboard is displayed in the onMeasure event. I'm running into an issue where it says that "ScrollView can host only one direct child", but in my test project, I have only one direct child View of KeyboardAwareScrollView, e.g.:
I'm using React Native 0.19.1 and here's the stack trace:
I'm posting this here in hopes that someone may have an idea, but I will continue to look into it. |
Hi @jblack10101! Which React Native version are you testing on? Under 0.19 I do get a resized scroll view in Android. |
Hey @alvaromb, I'm getting this exception with react-native node version 0.19.0 and in Java, com.facebook.react:react-native:0.19.0 and 0.19.1. Which versions are you using? |
I'm using 0.19, it's strange! Are you sure you're using only one child? |
Yea, I pulled the latest react-native from master last night and built using it. I added some log statements, and even though I have a View as the only child of the KeyboardAwareScrollView, it looks like it is adding the Text and TextInput elements as direct children of the ScrollView and ignoring the View. I'll continue investigating. |
That could be RN making some optimisations for you, IDK. Here https://github.com/APSL/react-native-keyboard-aware-scroll-view/blob/master/lib/KeyboardAwareScrollView.js#L25 you can see that this component just uses what you provide as children. Try to set some style into your container |
@jblack10101 How to register the react-native-keyboard-aware-scroll-view module in MainActivity.java for React Native 0.21 |
@karthickvkumar, sorry I've been on vacation and unable to respond, but the readme should have all of the information that you need to register the module. Please let me know if you have further questions. |
This helped me the most - ptomasroos/react-native-tab-navigator#48 For Android, it is a good idea to read up on android:windowSoftInputMode when dealing with the keyboard. Docs - http://developer.android.com/guide/topics/manifest/activity-element.html I struggled for a while getting a chat-style (sticky) keyboard bar along with the react-native-keyboard-aware-scroll-view module (version 0.0.6). As soon as I changed windowSoftInputMode in my main AndroidManifest.xml, it worked!
Also make sure you are subscribing to keyboardDidShow and keyboardDidHide on Android, for now (React Native 0.23.0). |
I'm using RN 0.24 and it seems like NativeModules.ScrollViewManager is not available on Android. |
It appears there is a pull request for android functionality (#4) but I have not heard if it actually works or not? I assume if it worked it would have been merged by now as android support seems like a nice addition. |
👍 up |
It's on the list @iSimonWeb, sorry for the delay :( |
+1 |
Just curious, why is it needed? Plain ScrollView works fine for me on android out of the box with |
I think there are some older Android versions that do not automatically scroll to the input fields @abhishiv. I've been very busy and I didn't had time yet to bring full Android support. |
I have |
I have the same issue as @lesniakania +1 about the extra space on Android. Should that be in another ticket? |
ping @alvaromb ;] |
@lesniakania How did you get the basic scrolling functionality to work? Mine just wont. |
I just used |
Hi all! I can't figure out what's the issue. Can you describe? :) |
For me the issue is that I want to use |
Ok @lesniakania! Let me check, we have several projects where we're using it in Android. |
Awesome, thanks :) |
I just reproduced the issue @lesniakania. Can you create a separate issue and we'll track it there? Thanks! |
Sure: #107 |
Has anyone been able to get this to work with Exponent? |
@alexprice91 Take a look at KeyboardAvoidingView, it might work for you. I was also trying to make it work with Expo but I had no luck with it. KeyboardAvoidingView did the trick in both iOS and Android. |
This does the trick. Thanks!! |
Has android support been added? It's working fine on ios, but on android nothing happens when the keyboard is opened. 😕 |
@OwenFlood I'll start the work after facebook/react-native#13129 is been merged. |
+1 Currently have to switch to RN's |
Folks, keep in mind that in Android you can use |
|
@Swordsman-Inaction did you get a chance to work on it? 46 is out now. |
@chirag04 I'm already working on it. 😀 |
Hello, I'm new to react-native and exponent (but know pretty well android and ios native dev) |
@graphee-gabriel Check out https://github.com/Palisand/kasv-expo. It's far from perfect, but it should help out. |
@Palisand I don't know anything about expo, but do you want to stick a link to your lib in the docs? What's the difference between using this library with expo and yours? |
Hmmmm @alvaromb I tried your code, but it did not change anything, still no scrolling on android. |
Ping @Swordsman-Inaction, who made the Android implementation. |
@graphee-gabriel Could you share more information? Which version? Code snippet? It's better to open an issue. |
For anyone looking for this scrolling behavior on Expo, you have to set the status bar to any solid color in app.json
Not sure why, but it works. |
@rxb I work too , but Now I can use KeyboardAvoidingView and ScrollView together when I set Thank |
@rxb Damn, thx you so much, i almost had a heart attack... |
The status bar thing did not work for me but i found a workaround making a component for it. Just use this component and replace EDIT: well it does work perfectly on this app, but i tried copying this component to another app that had the same problem, implemented it, and it does not work on the other app... This is really confusing, they have the same app.json settings etc... slightly frustrating :-)
|
@graphee-gabriel that worked and solved my 3 months long keyboard toggle problem (where I have tried lots of hacks previously). Thanks. |
adding enableOnAndroid worked for me without having to use the statusbar trick |
Should this work for Android? I was having an issue with a view in iOS and Android and I put this component in place. It seemed to fix the iOS version, but the Android version still behaves the same (the keyboard covers the content in the ScrollView).
The text was updated successfully, but these errors were encountered: