@mpxjs/webpack-plugin 2.10.16-beta.6 → 2.10.16-beta.8

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.
@@ -10,6 +10,7 @@ export type KeyboardAvoidContextValue = MutableRefObject<{
10
10
  cursorSpacing: number
11
11
  ref: MutableRefObject<any>
12
12
  adjustPosition: boolean
13
+ holdKeyboard?: boolean
13
14
  keyboardHeight?: number
14
15
  onKeyboardShow?: () => void
15
16
  } | null>
@@ -7,6 +7,7 @@ export type KeyboardAvoidContextValue = MutableRefObject<{
7
7
  cursorSpacing: number;
8
8
  ref: MutableRefObject<any>;
9
9
  adjustPosition: boolean;
10
+ holdKeyboard?: boolean;
10
11
  keyboardHeight?: number;
11
12
  onKeyboardShow?: () => void;
12
13
  } | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACjF,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAG7D,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;IAC/C,aAAa,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;CAC/D,CAAC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;IACvD,aAAa,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;CAC5B,GAAG,IAAI,CAAC,CAAA;AAET,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;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import { Camera } from 'react-native-vision-camera';
3
2
  interface CameraProps {
4
3
  mode?: 'normal' | 'scanCode';
5
4
  resolution?: 'low' | 'medium' | 'high';
@@ -23,6 +22,6 @@ interface CameraProps {
23
22
  type HandlerRef<T, P> = {
24
23
  current: T | null;
25
24
  };
26
- declare const _camera: React.ForwardRefExoticComponent<CameraProps & React.RefAttributes<HandlerRef<Camera, CameraProps>>>;
25
+ declare const _camera: React.ForwardRefExoticComponent<CameraProps & React.RefAttributes<HandlerRef<any, CameraProps>>>;
27
26
  export default _camera;
28
27
  //# sourceMappingURL=mpx-camera.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mpx-camera.d.ts","sourceRoot":"","sources":["../mpx-camera.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2E,MAAM,OAAO,CAAA;AAC/F,OAAO,EAAE,MAAM,EAAuE,MAAM,4BAA4B,CAAA;AAIxH,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;IACtC,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAA;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAChD,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAC/D,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE;Q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B,CAAA;AAID,QAAA,MAAM,OAAO,kGAmNX,CAAA;AAIF,eAAe,OAAO,CAAA"}
@@ -1,8 +1,18 @@
1
1
  import React, { forwardRef, useRef, useCallback, useContext, useState, useEffect } from 'react';
2
- import { Camera, useCameraDevice, useCodeScanner, useCameraFormat } from 'react-native-vision-camera';
2
+ // import { Camera, useCameraDevice, useCodeScanner, useCameraFormat } from 'react-native-vision-camera'
3
3
  import { getCustomEvent } from './getInnerListeners';
4
+ import { noop } from '@mpxjs/utils';
4
5
  import { RouteContext } from './context';
6
+ const qualityValue = {
7
+ high: 90,
8
+ normal: 75,
9
+ low: 50,
10
+ original: 100
11
+ };
12
+ let RecordRes = null;
5
13
  const _camera = forwardRef((props, ref) => {
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
15
+ const { Camera, useCameraDevice, useCodeScanner, useCameraFormat } = require('react-native-vision-camera');
6
16
  const cameraRef = useRef(null);
7
17
  const { mode = 'normal', resolution = 'medium', devicePosition = 'back', flash = 'auto', frameSize = 'medium', bindinitdone, bindstop, bindscancode } = props;
8
18
  const isPhoto = mode === 'normal';
@@ -73,30 +83,112 @@ const _camera = forwardRef((props, ref) => {
73
83
  setZoom: (zoom) => {
74
84
  setZoomValue(zoom);
75
85
  },
76
- getTakePhoto: () => {
77
- return cameraRef.current?.takePhoto;
86
+ takePhoto: (options = {}) => {
87
+ const { success = noop, fail = noop, complete = noop } = options;
88
+ cameraRef.current?.takePhoto?.({
89
+ quality: qualityValue[options.quality || 'normal']
90
+ }).then((res) => {
91
+ const result = {
92
+ errMsg: 'takePhoto:ok',
93
+ tempImagePath: res.path
94
+ };
95
+ success(result);
96
+ complete(result);
97
+ }).catch(() => {
98
+ const result = {
99
+ errMsg: 'takePhoto:fail'
100
+ };
101
+ fail(result);
102
+ complete(result);
103
+ });
78
104
  },
79
- getStartRecord: () => {
80
- return cameraRef.current?.startRecording;
105
+ startRecord: (options = {}) => {
106
+ let { timeout = 30, success = noop, fail = noop, complete = noop, timeoutCallback = noop } = options;
107
+ timeout = timeout > 300 ? 300 : timeout;
108
+ let recordTimer = null;
109
+ let isTimeout = false;
110
+ try {
111
+ const result = {
112
+ errMsg: 'startRecord:ok'
113
+ };
114
+ success(result);
115
+ complete(result);
116
+ cameraRef.current?.startRecording?.({
117
+ onRecordingError: (error) => {
118
+ if (recordTimer)
119
+ clearTimeout(recordTimer);
120
+ const errorResult = {
121
+ errMsg: 'startRecord:fail during recording',
122
+ error: error
123
+ };
124
+ timeoutCallback(errorResult);
125
+ },
126
+ onRecordingFinished: (video) => {
127
+ RecordRes = video;
128
+ if (recordTimer)
129
+ clearTimeout(recordTimer);
130
+ }
131
+ });
132
+ recordTimer = setTimeout(() => {
133
+ isTimeout = true;
134
+ cameraRef.current?.stopRecording().catch(() => {
135
+ // 忽略停止录制时的错误
136
+ });
137
+ }, timeout * 1000);
138
+ }
139
+ catch (error) {
140
+ if (recordTimer)
141
+ clearTimeout(recordTimer);
142
+ const result = {
143
+ errMsg: 'startRecord:fail ' + (error.message || 'unknown error')
144
+ };
145
+ fail(result);
146
+ complete(result);
147
+ }
81
148
  },
82
- getStopRecord: () => {
83
- return cameraRef.current?.stopRecording;
149
+ stopRecord: (options = {}) => {
150
+ const { success = noop, fail = noop, complete = noop } = options;
151
+ try {
152
+ cameraRef.current?.stopRecording().then(() => {
153
+ setTimeout(() => {
154
+ if (RecordRes) {
155
+ const result = {
156
+ errMsg: 'stopRecord:ok',
157
+ tempVideoPath: RecordRes?.path,
158
+ duration: RecordRes.duration * 1000 // 转成ms
159
+ };
160
+ RecordRes = null;
161
+ success(result);
162
+ complete(result);
163
+ }
164
+ }, 200); // 延时200ms,确保录制结果已准备好
165
+ }).catch((e) => {
166
+ const result = {
167
+ errMsg: 'stopRecord:fail ' + (e.message || 'promise rejected')
168
+ };
169
+ fail(result);
170
+ complete(result);
171
+ });
172
+ }
173
+ catch (error) {
174
+ const result = {
175
+ errMsg: 'stopRecord:fail ' + (error.message || 'unknown error')
176
+ };
177
+ fail(result);
178
+ complete(result);
179
+ }
84
180
  }
85
181
  };
86
182
  if (navigation) {
87
183
  navigation.camera = camera;
88
184
  }
89
- // 所有 Hooks 调用完成后再进行条件判断
90
- if (hasPermission === null) {
91
- return null;
92
- }
93
185
  if (!hasPermission) {
94
186
  return null;
95
187
  }
96
188
  if (!device) {
97
189
  return null;
98
190
  }
99
- return (<Camera ref={cameraRef} isActive={true} photo={isPhoto} video={true} onInitialized={onInitialized} onStopped={onStopped} device={device} flash={flash} format={format} codeScanner={!isPhoto ? codeScanner : undefined} style={{ flex: 1 }} zoom={zoomValue} {...props}/>);
191
+ return (<Camera ref={cameraRef} isActive={true} photo={true} video={true} onInitialized={onInitialized} onStopped={onStopped} device={device} flash={flash} format={format} codeScanner={!isPhoto ? codeScanner : undefined} style={{ flex: 1 }} zoom={zoomValue} {...props}/>);
100
192
  });
101
193
  _camera.displayName = 'MpxCamera';
102
194
  export default _camera;
@@ -32,6 +32,7 @@ export interface InputProps {
32
32
  'parent-width'?: number;
33
33
  'parent-height'?: number;
34
34
  'adjust-position': boolean;
35
+ 'hold-keyboard'?: boolean;
35
36
  bindinput?: (evt: NativeSyntheticEvent<TextInputTextInputEventData> | unknown) => void;
36
37
  bindfocus?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
37
38
  bindblur?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"mpx-input.d.ts","sourceRoot":"","sources":["../mpx-input.tsx"],"names":[],"mappings":";AAwCA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,mCAAmC,EACnC,SAAS,EACT,iCAAiC,EACjC,uBAAuB,EAEvB,+BAA+B,EAEhC,MAAM,cAAc,CAAA;AAIrB,OAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvD,KAAK,UAAU,GAAG,IAAI,CACpB,SAAS,GAAG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D,QAAA,MAAM,KAAK,mJAwYT,CAAA;AAIF,eAAe,KAAK,CAAA"}
@@ -18,7 +18,7 @@
18
18
  * ✔ selection-start
19
19
  * ✔ selection-end
20
20
  * ✔ adjust-position
21
- * hold-keyboard
21
+ * hold-keyboard
22
22
  * ✘ safe-password-cert-path
23
23
  * ✘ safe-password-length
24
24
  * ✘ safe-password-time-stamp
@@ -52,7 +52,7 @@ const keyboardTypeMap = {
52
52
  digit: isIOS ? 'decimal-pad' : 'numeric'
53
53
  };
54
54
  const Input = forwardRef((props, ref) => {
55
- const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
55
+ const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, 'hold-keyboard': holdKeyboard = false, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
56
56
  // private
57
57
  multiline, 'auto-height': autoHeight, bindlinechange } = props;
58
58
  const formContext = useContext(FormContext);
@@ -145,7 +145,7 @@ const Input = forwardRef((props, ref) => {
145
145
  };
146
146
  const setKeyboardAvoidContext = () => {
147
147
  if (keyboardAvoid) {
148
- keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition };
148
+ keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard };
149
149
  }
150
150
  };
151
151
  const onTouchStart = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"mpx-keyboard-avoiding-view.d.ts","sourceRoot":"","sources":["../mpx-keyboard-avoiding-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAuD,SAAS,EAA0C,MAAM,cAAc,CAAA;AAKrI,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,qBAAqB,CAAC,EAAE,SAAS,CAAA;CAClC,CAAA;AAED,QAAA,MAAM,oBAAoB;iDAAgD,sBAAsB;;CA8G/F,CAAA;AAID,eAAe,oBAAoB,CAAA"}
1
+ {"version":3,"file":"mpx-keyboard-avoiding-view.d.ts","sourceRoot":"","sources":["../mpx-keyboard-avoiding-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAuD,SAAS,EAA0C,MAAM,cAAc,CAAA;AAKrI,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,qBAAqB,CAAC,EAAE,SAAS,CAAA;CAClC,CAAA;AAED,QAAA,MAAM,oBAAoB;iDAAgD,sBAAsB;;CAiH/F,CAAA;AAID,eAAe,oBAAoB,CAAA"}
@@ -38,6 +38,9 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
38
38
  };
39
39
  const onTouchEnd = ({ nativeEvent }) => {
40
40
  if (nativeEvent.origin !== 'input') {
41
+ if (keyboardAvoid?.current?.holdKeyboard) {
42
+ return;
43
+ }
41
44
  Keyboard.isVisible() && Keyboard.dismiss();
42
45
  }
43
46
  };
@@ -1,8 +1,16 @@
1
1
  import React, { forwardRef, useRef, useCallback, useContext, useState, useEffect } from 'react'
2
- import { Camera, useCameraDevice, useCodeScanner, useCameraFormat, useFrameProcessor } from 'react-native-vision-camera'
2
+ // import { Camera, useCameraDevice, useCodeScanner, useCameraFormat } from 'react-native-vision-camera'
3
3
  import { getCustomEvent } from './getInnerListeners'
4
+ import { noop } from '@mpxjs/utils'
4
5
  import { RouteContext } from './context'
5
6
 
7
+ const qualityValue = {
8
+ high: 90,
9
+ normal: 75,
10
+ low: 50,
11
+ original: 100
12
+ }
13
+
6
14
  interface CameraProps {
7
15
  mode?: 'normal' | 'scanCode'
8
16
  resolution?: 'low' | 'medium' | 'high'
@@ -16,20 +24,44 @@ interface CameraProps {
16
24
  bindscancode?: (result: { type: string, data: string }) => void
17
25
  }
18
26
 
27
+ interface TakePhotoOptions {
28
+ quality?: 'high' | 'normal' | 'low' | 'original'
29
+ success?: (result: { errMsg: string, tempImagePath: string }) => void
30
+ fail?: (result: { errMsg: string }) => void
31
+ complete?: (result: { errMsg: string, tempImagePath?: string }) => void
32
+ }
33
+
34
+ interface RecordOptions {
35
+ timeout?: number
36
+ success?: (result: { errMsg: string }) => void
37
+ fail?: (result: { errMsg: string, error?: any }) => void
38
+ complete?: (result: { errMsg: string }) => void
39
+ timeoutCallback?: (result: { errMsg: string, error?: any }) => void
40
+ }
41
+
42
+ interface StopRecordOptions {
43
+ success?: (result: { errMsg: string, tempVideoPath: string, duration: number }) => void
44
+ fail?: (result: { errMsg: string }) => void
45
+ complete?: (result: { errMsg: string, tempVideoPath?: string, duration?: number }) => void
46
+ }
47
+
19
48
  interface CameraRef {
20
49
  setZoom: (zoom: number) => void
21
- getTakePhoto: () => (() => Promise<any>) | undefined
22
- getStartRecord: () => ((options: any) => void) | undefined
23
- getStopRecord: () => (() => void) | undefined
50
+ takePhoto: (options?: TakePhotoOptions) => void
51
+ startRecord: (options?: RecordOptions) => void
52
+ stopRecord: (options?: StopRecordOptions) => void
24
53
  }
25
54
 
26
55
  type HandlerRef<T, P> = {
27
- // 根据实际的 HandlerRef 类型定义调整
28
56
  current: T | null
29
57
  }
30
58
 
31
- const _camera = forwardRef<HandlerRef<Camera, CameraProps>, CameraProps>((props: CameraProps, ref): JSX.Element | null => {
32
- const cameraRef = useRef<Camera>(null)
59
+ let RecordRes: any = null
60
+
61
+ const _camera = forwardRef<HandlerRef<any, CameraProps>, CameraProps>((props: CameraProps, ref): JSX.Element | null => {
62
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
63
+ const { Camera, useCameraDevice, useCodeScanner, useCameraFormat } = require('react-native-vision-camera')
64
+ const cameraRef = useRef<any>(null)
33
65
  const {
34
66
  mode = 'normal',
35
67
  resolution = 'medium',
@@ -70,7 +102,7 @@ const _camera = forwardRef<HandlerRef<Camera, CameraProps>, CameraProps>((props:
70
102
 
71
103
  const codeScanner = useCodeScanner({
72
104
  codeTypes: ['qr', 'ean-13'],
73
- onCodeScanned: (codes) => {
105
+ onCodeScanned: (codes: any[]) => {
74
106
  const result = codes.map(code => code.value).join(',')
75
107
  bindscancode && bindscancode(getCustomEvent('scancode', {}, {
76
108
  detail: {
@@ -115,26 +147,103 @@ const _camera = forwardRef<HandlerRef<Camera, CameraProps>, CameraProps>((props:
115
147
  setZoom: (zoom: number) => {
116
148
  setZoomValue(zoom)
117
149
  },
118
- getTakePhoto: () => {
119
- return cameraRef.current?.takePhoto
150
+ takePhoto: (options: TakePhotoOptions = {}) => {
151
+ const { success = noop, fail = noop, complete = noop } = options
152
+ cameraRef.current?.takePhoto?.({
153
+ quality: qualityValue[options.quality || 'normal'] as number
154
+ } as any).then((res: { path: any }) => {
155
+ const result = {
156
+ errMsg: 'takePhoto:ok',
157
+ tempImagePath: res.path
158
+ }
159
+ success(result)
160
+ complete(result)
161
+ }).catch(() => {
162
+ const result = {
163
+ errMsg: 'takePhoto:fail'
164
+ }
165
+ fail(result)
166
+ complete(result)
167
+ })
120
168
  },
121
- getStartRecord: () => {
122
- return cameraRef.current?.startRecording
169
+ startRecord: (options: RecordOptions = {}) => {
170
+ let { timeout = 30, success = noop, fail = noop, complete = noop, timeoutCallback = noop } = options
171
+ timeout = timeout > 300 ? 300 : timeout
172
+ let recordTimer: NodeJS.Timeout | null = null
173
+ let isTimeout = false
174
+ try {
175
+ const result = {
176
+ errMsg: 'startRecord:ok'
177
+ }
178
+ success(result)
179
+ complete(result)
180
+
181
+ cameraRef.current?.startRecording?.({
182
+ onRecordingError: (error: any) => {
183
+ if (recordTimer) clearTimeout(recordTimer)
184
+ const errorResult = {
185
+ errMsg: 'startRecord:fail during recording',
186
+ error: error
187
+ }
188
+ timeoutCallback(errorResult)
189
+ },
190
+ onRecordingFinished: (video: any) => {
191
+ RecordRes = video
192
+ if (recordTimer) clearTimeout(recordTimer)
193
+ }
194
+ })
195
+
196
+ recordTimer = setTimeout(() => { // 超时自动停止
197
+ isTimeout = true
198
+ cameraRef.current?.stopRecording().catch(() => {
199
+ // 忽略停止录制时的错误
200
+ })
201
+ }, timeout * 1000)
202
+ } catch (error: any) {
203
+ if (recordTimer) clearTimeout(recordTimer)
204
+ const result = {
205
+ errMsg: 'startRecord:fail ' + (error.message || 'unknown error')
206
+ }
207
+ fail(result)
208
+ complete(result)
209
+ }
123
210
  },
124
- getStopRecord: () => {
125
- return cameraRef.current?.stopRecording
211
+ stopRecord: (options: StopRecordOptions = {}) => {
212
+ const { success = noop, fail = noop, complete = noop } = options
213
+ try {
214
+ cameraRef.current?.stopRecording().then(() => {
215
+ setTimeout(() => {
216
+ if (RecordRes) {
217
+ const result = {
218
+ errMsg: 'stopRecord:ok',
219
+ tempVideoPath: RecordRes?.path,
220
+ duration: RecordRes.duration * 1000 // 转成ms
221
+ }
222
+ RecordRes = null
223
+ success(result)
224
+ complete(result)
225
+ }
226
+ }, 200) // 延时200ms,确保录制结果已准备好
227
+ }).catch((e: any) => {
228
+ const result = {
229
+ errMsg: 'stopRecord:fail ' + (e.message || 'promise rejected')
230
+ }
231
+ fail(result)
232
+ complete(result)
233
+ })
234
+ } catch (error: any) {
235
+ const result = {
236
+ errMsg: 'stopRecord:fail ' + (error.message || 'unknown error')
237
+ }
238
+ fail(result)
239
+ complete(result)
240
+ }
126
241
  }
127
242
  }
128
-
129
243
  if (navigation) {
130
244
  navigation.camera = camera
131
245
  }
132
246
 
133
- // 所有 Hooks 调用完成后再进行条件判断
134
- if (hasPermission === null) {
135
- return null
136
- }
137
-
138
247
  if (!hasPermission) {
139
248
  return null
140
249
  }
@@ -147,7 +256,7 @@ const _camera = forwardRef<HandlerRef<Camera, CameraProps>, CameraProps>((props:
147
256
  <Camera
148
257
  ref={cameraRef}
149
258
  isActive={true}
150
- photo={isPhoto}
259
+ photo={true}
151
260
  video={true}
152
261
  onInitialized={onInitialized}
153
262
  onStopped={onStopped}
@@ -18,7 +18,7 @@
18
18
  * ✔ selection-start
19
19
  * ✔ selection-end
20
20
  * ✔ adjust-position
21
- * hold-keyboard
21
+ * hold-keyboard
22
22
  * ✘ safe-password-cert-path
23
23
  * ✘ safe-password-length
24
24
  * ✘ safe-password-time-stamp
@@ -102,6 +102,7 @@ export interface InputProps {
102
102
  'parent-width'?: number
103
103
  'parent-height'?: number
104
104
  'adjust-position': boolean,
105
+ 'hold-keyboard'?: boolean
105
106
  bindinput?: (evt: NativeSyntheticEvent<TextInputTextInputEventData> | unknown) => void
106
107
  bindfocus?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void
107
108
  bindblur?: (evt: NativeSyntheticEvent<TextInputFocusEventData> | unknown) => void
@@ -150,6 +151,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
150
151
  'parent-width': parentWidth,
151
152
  'parent-height': parentHeight,
152
153
  'adjust-position': adjustPosition = true,
154
+ 'hold-keyboard': holdKeyboard = false,
153
155
  bindinput,
154
156
  bindfocus,
155
157
  bindblur,
@@ -281,7 +283,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
281
283
 
282
284
  const setKeyboardAvoidContext = () => {
283
285
  if (keyboardAvoid) {
284
- keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition }
286
+ keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard }
285
287
  }
286
288
  }
287
289
 
@@ -53,6 +53,9 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
53
53
 
54
54
  const onTouchEnd = ({ nativeEvent }: NativeSyntheticEvent<NativeTouchEvent & { origin?: string }>) => {
55
55
  if (nativeEvent.origin !== 'input') {
56
+ if (keyboardAvoid?.current?.holdKeyboard) {
57
+ return
58
+ }
56
59
  Keyboard.isVisible() && Keyboard.dismiss()
57
60
  }
58
61
  }
@@ -764,9 +764,7 @@ function parse (template, options) {
764
764
 
765
765
  const children = currentParent.children
766
766
 
767
- const isTextLikeParent = currentParent.tag === 'text' || currentParent.tag === 'mpx-text' || currentParent.tag === 'Text' || currentParent.tag === 'mpx-simple-text'
768
-
769
- if (!isTextLikeParent) {
767
+ if (currentParent.tag !== 'text') {
770
768
  text = text.trim()
771
769
  } else {
772
770
  text = text.trim() ? text : ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.16-beta.6",
3
+ "version": "2.10.16-beta.8",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -29,7 +29,7 @@
29
29
  "@better-scroll/wheel": "^2.5.1",
30
30
  "@better-scroll/zoom": "^2.5.1",
31
31
  "@mpxjs/template-engine": "^2.8.7",
32
- "@mpxjs/utils": "^2.10.16",
32
+ "@mpxjs/utils": "^2.10.16-beta.7",
33
33
  "postcss-less": "^6.0.0",
34
34
  "postcss-scss": "^4.0.9",
35
35
  "postcss-styl": "^0.12.3",
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "devDependencies": {
93
93
  "@d11/react-native-fast-image": "^8.6.12",
94
- "@mpxjs/api-proxy": "^2.10.16",
94
+ "@mpxjs/api-proxy": "^2.10.16-beta.7",
95
95
  "@types/babel-traverse": "^6.25.4",
96
96
  "@types/babel-types": "^7.0.4",
97
97
  "@types/glob": "^8.1.0",