@mpxjs/webpack-plugin 2.10.18-beta.3 → 2.10.18-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,7 +145,10 @@ const Input = forwardRef((props, ref) => {
145
145
  };
146
146
  const setKeyboardAvoidContext = () => {
147
147
  if (keyboardAvoid) {
148
- keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow: true };
148
+ // readyToShow 仅在从另一个输入框切换聚焦时为 true(ref 不同),
149
+ // 避免同一个输入框重复调用(onTouchStart + useEffect)或单次聚焦时误设为 true 导致无法正常失焦
150
+ const readyToShow = !!(keyboardAvoid.current && keyboardAvoid.current.ref !== nodeRef);
151
+ keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow };
149
152
  }
150
153
  };
151
154
  const onTouchStart = () => {
@@ -285,7 +285,10 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
285
285
 
286
286
  const setKeyboardAvoidContext = () => {
287
287
  if (keyboardAvoid) {
288
- keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow: true }
288
+ // readyToShow 仅在从另一个输入框切换聚焦时为 true(ref 不同),
289
+ // 避免同一个输入框重复调用(onTouchStart + useEffect)或单次聚焦时误设为 true 导致无法正常失焦
290
+ const readyToShow = !!(keyboardAvoid.current && keyboardAvoid.current.ref !== nodeRef)
291
+ keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard, readyToShow }
289
292
  }
290
293
  }
291
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.18-beta.3",
3
+ "version": "2.10.18-beta.4",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"