Skip to content

simple android support #70

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

Closed
wants to merge 2 commits into from
Closed

simple android support #70

wants to merge 2 commits into from

Conversation

zzycami
Copy link

@zzycami zzycami commented Oct 24, 2016

Just make it can work normal in android.

Copy link
Collaborator

@alvaromb alvaromb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash with multiple scroll views. The solution is to port UIManager.viewIsDescendantOf to Android in the RN core.

}
})
if (Platform.OS == 'android') {
this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to fail in Android if there are in the same scene multiple KeyboardAwareScrollViews. All will receive the event but the ones that doesn't include the input as a descendant will crash.

})
if (Platform.OS == 'android') {
this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField)
}else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add an space before else.

(isAncestor) => {
if (isAncestor) {
// Check if the TextInput will be hidden by the keyboard
UIManager.measureInWindow(currentlyFocusedField, (x, y, width, height) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only viewIsDescendantOf is not available in Android, this could be included in your PR too.

if (Platform.OS == 'ios') {
this.keyboardWillShowEvent = Keyboard.addListener('keyboardWillShow', this.updateKeyboardSpace)
this.keyboardWillHideEvent = Keyboard.addListener('keyboardWillHide', this.resetKeyboardSpace)
}else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space again.

this.keyboardWillShowEvent = Keyboard.addListener('keyboardWillShow', this.updateKeyboardSpace)
this.keyboardWillHideEvent = Keyboard.addListener('keyboardWillHide', this.resetKeyboardSpace)
}else {
this.keyboardWillShowEvent = Keyboard.addListener('keyboardDidShow', this.updateKeyboardSpace)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noob question here. Why using different events for Android and iOS?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvaromb Android doesn't have keyboardWillShow event :/

Copy link

@rahulrajeevan rahulrajeevan Feb 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alvaromb & @grsabreu You can directly replace keyboardWillShow & keyboardWillHide with keyboardDidShow and keyboardDidHide . You don't need to check the platform .keyboardDidShow and keyboardDidHide trigger for both IOS and android

@zzycami
Copy link
Author

zzycami commented Oct 25, 2016

UIManager.viewIsDescendantOf is not available in android. If this scroll view not contain input, we do not use this component. Anyway, hoping you can add android supporting

@alvaromb
Copy link
Collaborator

Closed in favor of #147

@alvaromb alvaromb closed this Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants