Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,16 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps

const setKeyboardAvoidContext = () => {
if (keyboardAvoid) {
keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard }
keyboardAvoid.current = {
cursorSpacing,
ref: nodeRef,
adjustPosition,
holdKeyboard,
// fix: iOS 会在 onFocus 之前触发 keyboardWillShow 并且赋值 keyboardHeight
// 这里手动同步下 keyboardHeight,防止 onFocus setKeyboardAvoidContext 删掉 keyboardHeight
// 导致 iOS 后续 bindfoucus 触发条件失败
keyboardHeight: keyboardAvoid?.current?.keyboardHeight
}
}
}

Expand Down Expand Up @@ -318,6 +327,9 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
if (keyboardAvoid?.current?.onKeyboardShow) {
keyboardAvoid.current.onKeyboardShow = undefined
}
if (keyboardAvoid?.current?.keyboardHeight) {
keyboardAvoid.current.keyboardHeight = undefined
}
}
if (keyboardAvoid?.current) {
// 有 keyboardAvoiding
Expand Down