-
Notifications
You must be signed in to change notification settings - Fork 645
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
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 KeyboardAwareScrollView
s. 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 { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Closed in favor of #147 |
Just make it can work normal in android.