@mpxjs/webpack-plugin 2.10.18-beta.5 → 2.10.18-beta.7
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.
- package/lib/runtime/components/react/dist/mpx-input.jsx +3 -8
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +9 -0
- package/lib/runtime/components/react/mpx-input.tsx +2 -9
- package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +10 -0
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
import { forwardRef, useRef, useState, useContext, useEffect, createElement } from 'react';
|
|
41
41
|
import { TextInput } from 'react-native';
|
|
42
42
|
import { warn } from '@mpxjs/utils';
|
|
43
|
-
import { useUpdateEffect, useTransformStyle, useLayout, extendObject
|
|
43
|
+
import { useUpdateEffect, useTransformStyle, useLayout, extendObject } from './utils';
|
|
44
44
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
45
45
|
import useNodesRef from './useNodesRef';
|
|
46
46
|
import { FormContext, KeyboardAvoidContext } from './context';
|
|
@@ -285,11 +285,6 @@ const Input = forwardRef((props, ref) => {
|
|
|
285
285
|
? nodeRef.current?.focus()
|
|
286
286
|
: nodeRef.current?.blur();
|
|
287
287
|
}, [isAutoFocus]);
|
|
288
|
-
// 使用 multiline 来修复光标位置问题
|
|
289
|
-
// React Native 的 TextInput 在 textAlign center + placeholder 时光标会跑到右边
|
|
290
|
-
// 这个问题只在 Android 上出现
|
|
291
|
-
// 参考:https://github.com/facebook/react-native/issues/28794 (Android only)
|
|
292
|
-
const needMultilineFix = isAndroid && !multiline;
|
|
293
288
|
const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
|
|
294
289
|
ref: nodeRef,
|
|
295
290
|
style: extendObject({}, normalStyle, layoutStyle),
|
|
@@ -308,7 +303,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
308
303
|
underlineColorAndroid: 'rgba(0,0,0,0)',
|
|
309
304
|
textAlignVertical: textAlignVertical,
|
|
310
305
|
placeholderTextColor: placeholderStyle?.color,
|
|
311
|
-
multiline: multiline
|
|
306
|
+
multiline: !!multiline,
|
|
312
307
|
onTouchStart,
|
|
313
308
|
onTouchEnd,
|
|
314
309
|
onFocus,
|
|
@@ -317,7 +312,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
317
312
|
onSelectionChange,
|
|
318
313
|
onContentSizeChange,
|
|
319
314
|
onSubmitEditing: bindconfirm && onSubmitEditing
|
|
320
|
-
},
|
|
315
|
+
}, !!multiline && confirmType === 'return' ? {} : { enterKeyHint: confirmType }), [
|
|
321
316
|
'type',
|
|
322
317
|
'password',
|
|
323
318
|
'placeholder-style',
|
|
@@ -73,6 +73,15 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
73
73
|
clearTimerScrollTo();
|
|
74
74
|
};
|
|
75
75
|
}, []);
|
|
76
|
+
// `contentOffset` prop sets visual position but does not fire scroll events,
|
|
77
|
+
// so `offsetYShared` (from `useScrollViewOffset`) stays at 0 until the user scrolls.
|
|
78
|
+
// Directly sync it whenever `itemRawH` is established so wheel animation renders correctly.
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!itemRawH || dragging.current || scrolling.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
offsetYShared.value = activeIndex.current * itemRawH;
|
|
84
|
+
}, [itemRawH]);
|
|
76
85
|
useEffect(() => {
|
|
77
86
|
if (!scrollViewRef.current ||
|
|
78
87
|
!itemRawH ||
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
NativeTouchEvent
|
|
55
55
|
} from 'react-native'
|
|
56
56
|
import { warn } from '@mpxjs/utils'
|
|
57
|
-
import { useUpdateEffect, useTransformStyle, useLayout, extendObject,
|
|
57
|
+
import { useUpdateEffect, useTransformStyle, useLayout, extendObject, isIOS } from './utils'
|
|
58
58
|
import useInnerProps, { getCustomEvent } from './getInnerListeners'
|
|
59
59
|
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
60
60
|
import { FormContext, FormFieldValue, KeyboardAvoidContext } from './context'
|
|
@@ -472,12 +472,6 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
472
472
|
: (nodeRef.current as TextInput)?.blur()
|
|
473
473
|
}, [isAutoFocus])
|
|
474
474
|
|
|
475
|
-
// 使用 multiline 来修复光标位置问题
|
|
476
|
-
// React Native 的 TextInput 在 textAlign center + placeholder 时光标会跑到右边
|
|
477
|
-
// 这个问题只在 Android 上出现
|
|
478
|
-
// 参考:https://github.com/facebook/react-native/issues/28794 (Android only)
|
|
479
|
-
const needMultilineFix = isAndroid && !multiline
|
|
480
|
-
|
|
481
475
|
const innerProps = useInnerProps(
|
|
482
476
|
extendObject(
|
|
483
477
|
{},
|
|
@@ -501,7 +495,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
501
495
|
underlineColorAndroid: 'rgba(0,0,0,0)',
|
|
502
496
|
textAlignVertical: textAlignVertical,
|
|
503
497
|
placeholderTextColor: placeholderStyle?.color,
|
|
504
|
-
multiline: multiline
|
|
498
|
+
multiline: !!multiline,
|
|
505
499
|
onTouchStart,
|
|
506
500
|
onTouchEnd,
|
|
507
501
|
onFocus,
|
|
@@ -511,7 +505,6 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
511
505
|
onContentSizeChange,
|
|
512
506
|
onSubmitEditing: bindconfirm && onSubmitEditing
|
|
513
507
|
},
|
|
514
|
-
needMultilineFix ? { numberOfLines: 1 } : {},
|
|
515
508
|
!!multiline && confirmType === 'return' ? {} : { enterKeyHint: confirmType }
|
|
516
509
|
),
|
|
517
510
|
[
|
|
@@ -136,6 +136,16 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
136
136
|
}
|
|
137
137
|
}, [])
|
|
138
138
|
|
|
139
|
+
// `contentOffset` prop sets visual position but does not fire scroll events,
|
|
140
|
+
// so `offsetYShared` (from `useScrollViewOffset`) stays at 0 until the user scrolls.
|
|
141
|
+
// Directly sync it whenever `itemRawH` is established so wheel animation renders correctly.
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (!itemRawH || dragging.current || scrolling.current) {
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
offsetYShared.value = activeIndex.current * itemRawH
|
|
147
|
+
}, [itemRawH])
|
|
148
|
+
|
|
139
149
|
useEffect(() => {
|
|
140
150
|
if (
|
|
141
151
|
!scrollViewRef.current ||
|