Skip to content

fix: [Issues: #4] 修复组件在页面触底的时候,虚拟键盘弹出,聚焦的输入框组件被遮挡问题 #5

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

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/KeyboardAwareHOC.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ function KeyboardAwareHOC(
currentlyFocusedField
)
}
} else if (Platform.OS === 'harmony') {
if (textInputBottomPosition > keyboardPosition) {
this.setState({keyboardSpace: keyboardPosition},()=>{
this.scrollForExtraHeightOnAndroid(textInputBottomPosition - keyboardPosition + totalExtraHeight)
})
}
} else {
// On android, the system would scroll the text input just
// above the keyboard so we just neet to scroll the extra
Expand Down Expand Up @@ -534,7 +540,7 @@ function KeyboardAwareHOC(
render() {
const { enableOnAndroid, contentContainerStyle, onScroll } = this.props
let newContentContainerStyle
if (Platform.OS === 'android' && enableOnAndroid) {
if ((Platform.OS === 'android' && enableOnAndroid) || Platform.OS === 'harmony') {
newContentContainerStyle = [].concat(contentContainerStyle).concat({
paddingBottom:
((contentContainerStyle || {}).paddingBottom || 0) +
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-keyboard-aware-scroll-view",
"version": "0.9.5-0.0.1",
"version": "0.9.5-0.0.2",
"description": "A React Native ScrollView component that resizes when the keyboard appears.",
"main": "index.js",
"types": "index.d.ts",
Expand Down