Skip to content

Commit c681ab5

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

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/KeyboardAwareHOC.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,12 @@ function KeyboardAwareHOC(
425425
currentlyFocusedField
426426
)
427427
}
428+
} else if (Platform.OS === 'harmony') {
429+
if (textInputBottomPosition > keyboardPosition) {
430+
this.setState({keyboardSpace: keyboardPosition},()=>{
431+
this.scrollForExtraHeightOnAndroid(textInputBottomPosition - keyboardPosition + totalExtraHeight)
432+
})
433+
}
428434
} else {
429435
// On android, the system would scroll the text input just
430436
// above the keyboard so we just neet to scroll the extra
@@ -534,7 +540,7 @@ function KeyboardAwareHOC(
534540
render() {
535541
const { enableOnAndroid, contentContainerStyle, onScroll } = this.props
536542
let newContentContainerStyle
537-
if (Platform.OS === 'android' && enableOnAndroid) {
543+
if ((Platform.OS === 'android' && enableOnAndroid) || Platform.OS === 'harmony') {
538544
newContentContainerStyle = [].concat(contentContainerStyle).concat({
539545
paddingBottom:
540546
((contentContainerStyle || {}).paddingBottom || 0) +

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-keyboard-aware-scroll-view",
3-
"version": "0.9.5-0.0.1",
3+
"version": "0.9.5-0.0.2",
44
"description": "A React Native ScrollView component that resizes when the keyboard appears.",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)