@mpxjs/webpack-plugin 2.10.4-beta.6 → 2.10.4-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.
@@ -151,6 +151,9 @@ const Input = forwardRef((props, ref) => {
151
151
  // sometimes the focus event occurs later than the keyboardWillShow event
152
152
  setKeyboardAvoidContext();
153
153
  };
154
+ const onTouchEnd = (evt) => {
155
+ evt.nativeEvent.origin = 'input';
156
+ };
154
157
  const onFocus = (evt) => {
155
158
  setKeyboardAvoidContext();
156
159
  bindfocus && bindfocus(getCustomEvent('focus', evt, {
@@ -263,6 +266,7 @@ const Input = forwardRef((props, ref) => {
263
266
  placeholderTextColor: placeholderStyle?.color,
264
267
  multiline: !!multiline,
265
268
  onTouchStart,
269
+ onTouchEnd,
266
270
  onFocus,
267
271
  onBlur,
268
272
  onChange,
@@ -20,8 +20,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
20
20
  offset.value = withTiming(0, { duration, easing });
21
21
  basic.value = 'auto';
22
22
  };
23
- const onTouchEnd = () => {
24
- Keyboard.isVisible() && Keyboard.dismiss();
23
+ const onTouchEnd = ({ nativeEvent }) => {
24
+ if (nativeEvent.origin !== 'input') {
25
+ Keyboard.isVisible() && Keyboard.dismiss();
26
+ }
25
27
  };
26
28
  useEffect(() => {
27
29
  let subscriptions = [];
@@ -50,7 +50,8 @@ import {
50
50
  TextInputSelectionChangeEventData,
51
51
  TextInputFocusEventData,
52
52
  TextInputChangeEventData,
53
- TextInputSubmitEditingEventData
53
+ TextInputSubmitEditingEventData,
54
+ NativeTouchEvent
54
55
  } from 'react-native'
55
56
  import { warn } from '@mpxjs/utils'
56
57
  import { useUpdateEffect, useTransformStyle, useLayout, extendObject, isIOS } from './utils'
@@ -287,6 +288,10 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
287
288
  setKeyboardAvoidContext()
288
289
  }
289
290
 
291
+ const onTouchEnd = (evt: NativeSyntheticEvent<NativeTouchEvent & { origin?: string }>) => {
292
+ evt.nativeEvent.origin = 'input'
293
+ }
294
+
290
295
  const onFocus = (evt: NativeSyntheticEvent<TextInputFocusEventData>) => {
291
296
  setKeyboardAvoidContext()
292
297
  bindfocus && bindfocus(
@@ -448,6 +453,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
448
453
  placeholderTextColor: placeholderStyle?.color,
449
454
  multiline: !!multiline,
450
455
  onTouchStart,
456
+ onTouchEnd,
451
457
  onFocus,
452
458
  onBlur,
453
459
  onChange,
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, useContext, useEffect } from 'react'
2
- import { DimensionValue, EmitterSubscription, Keyboard, View, ViewStyle } from 'react-native'
2
+ import { DimensionValue, EmitterSubscription, Keyboard, View, ViewStyle, NativeSyntheticEvent, NativeTouchEvent } from 'react-native'
3
3
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated'
4
4
  import { KeyboardAvoidContext } from './context'
5
5
  import { isIOS } from './utils'
@@ -31,8 +31,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
31
31
  basic.value = 'auto'
32
32
  }
33
33
 
34
- const onTouchEnd = () => {
35
- Keyboard.isVisible() && Keyboard.dismiss()
34
+ const onTouchEnd = ({ nativeEvent }: NativeSyntheticEvent<NativeTouchEvent & { origin?: string }>) => {
35
+ if (nativeEvent.origin !== 'input') {
36
+ Keyboard.isVisible() && Keyboard.dismiss()
37
+ }
36
38
  }
37
39
 
38
40
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.4-beta.6",
3
+ "version": "2.10.4-beta.7",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"