@mpxjs/webpack-plugin 2.10.14-beta.8 → 2.10.14-beta.9

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.
@@ -195,7 +195,7 @@ module.exports = function ({ print }) {
195
195
  qa: qaPropLog
196
196
  },
197
197
  {
198
- test: /^(lang|from-type|hover-class|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|phone-number-no-quota-toast|bindgetuserinfo|bindcontact|createliveactivity|bindgetphonenumber|bindgetrealtimephonenumber|binderror|bindopensetting|bindlaunchapp|bindchooseavatar|bindagreeprivacyauthorization)$/,
198
+ test: /^(lang|from-type|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|phone-number-no-quota-toast|bindgetuserinfo|bindcontact|createliveactivity|bindgetphonenumber|bindgetrealtimephonenumber|binderror|bindopensetting|bindlaunchapp|bindchooseavatar|bindagreeprivacyauthorization)$/,
199
199
  ios: iosPropLog,
200
200
  android: androidPropLog,
201
201
  harmony: harmonyPropLog
@@ -1,3 +1,4 @@
1
+ /* eslint-disable space-before-function-paren */
1
2
  import React, { useContext, useEffect, useRef } from 'react';
2
3
  import { Keyboard, View } from 'react-native';
3
4
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing, cancelAnimation } from 'react-native-reanimated';
@@ -15,8 +16,8 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
15
16
  const isShow = useRef(false);
16
17
  const timerRef = useRef(null);
17
18
  const animatedStyle = useAnimatedStyle(() => ({
18
- // translate/position top可能会导致底部渲染区域缺失
19
- marginTop: -offset.value,
19
+ // translate/position top可能会导致底部渲染区域缺失(需要 android 配置聚焦时禁用高度缩小),margin-top 会导致 portal 的定位失效,无法顶起 portal
20
+ transform: [{ translateY: -offset.value }],
20
21
  flexBasis: basic.value
21
22
  }));
22
23
  const resetKeyboard = () => {
@@ -64,9 +65,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
64
65
  function calculateOffset() {
65
66
  // enableNativeKeyboardAvoding 默认开启
66
67
  if (enableNativeKeyboardAvoiding && isAndroid) {
67
- const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
68
+ const aboveOffset = pageY + height - endCoordinates.screenY;
69
+ const belowOffset = endCoordinates.height - aboveOffset;
68
70
  const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing;
69
- const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing);
71
+ const belowValue = Math.min(belowOffset, cursorSpacing);
70
72
  return aboveOffset > 0 ? belowValue : aboveValue;
71
73
  }
72
74
  const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
@@ -95,10 +97,7 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
95
97
  ];
96
98
  }
97
99
  else {
98
- subscriptions = [
99
- Keyboard.addListener('keyboardDidShow', keybaordAvoding),
100
- Keyboard.addListener('keyboardDidHide', resetKeyboard)
101
- ];
100
+ subscriptions = [Keyboard.addListener('keyboardDidShow', keybaordAvoding), Keyboard.addListener('keyboardDidHide', resetKeyboard)];
102
101
  }
103
102
  return () => {
104
103
  subscriptions.forEach(subscription => subscription.remove());
@@ -1,3 +1,4 @@
1
+ /* eslint-disable space-before-function-paren */
1
2
  import React, { ReactNode, useContext, useEffect, useRef } from 'react'
2
3
  import { DimensionValue, EmitterSubscription, Keyboard, View, ViewStyle, NativeSyntheticEvent, NativeTouchEvent } from 'react-native'
3
4
  import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing, cancelAnimation } from 'react-native-reanimated'
@@ -25,8 +26,8 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
25
26
  const timerRef = useRef<NodeJS.Timeout | null>(null)
26
27
 
27
28
  const animatedStyle = useAnimatedStyle(() => ({
28
- // translate/position top可能会导致底部渲染区域缺失
29
- marginTop: -offset.value,
29
+ // translate/position top可能会导致底部渲染区域缺失(需要 android 配置聚焦时禁用高度缩小),margin-top 会导致 portal 的定位失效,无法顶起 portal
30
+ transform: [{ translateY: -offset.value }],
30
31
  flexBasis: basic.value as DimensionValue
31
32
  }))
32
33
 
@@ -84,16 +85,17 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
84
85
  function calculateOffset() {
85
86
  // enableNativeKeyboardAvoding 默认开启
86
87
  if (enableNativeKeyboardAvoiding && isAndroid) {
87
- const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
88
- const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing;
89
- const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing);
90
- return aboveOffset > 0 ? belowValue : aboveValue;
88
+ const aboveOffset = pageY + height - endCoordinates.screenY
89
+ const belowOffset = endCoordinates.height - aboveOffset
90
+ const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing
91
+ const belowValue = Math.min(belowOffset, cursorSpacing)
92
+ return aboveOffset > 0 ? belowValue : aboveValue
91
93
  }
92
94
 
93
- const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
94
- const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing;
95
- const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing);
96
- return aboveOffset > 0 ? belowValue : aboveValue;
95
+ const aboveOffset = offset.value + pageY + height - endCoordinates.screenY
96
+ const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing
97
+ const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing)
98
+ return aboveOffset > 0 ? belowValue : aboveValue
97
99
  }
98
100
 
99
101
  cancelAnimation(offset)
@@ -104,8 +106,8 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
104
106
  }
105
107
  })
106
108
  })
107
- };
108
- (isIOS ? () => (timerRef.current = setTimeout(callback)) : callback)();
109
+ }
110
+ ;(isIOS ? () => (timerRef.current = setTimeout(callback)) : callback)()
109
111
  }
110
112
  }
111
113
 
@@ -117,10 +119,7 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }: Keyboa
117
119
  Keyboard.addListener('keyboardWillHide', resetKeyboard)
118
120
  ]
119
121
  } else {
120
- subscriptions = [
121
- Keyboard.addListener('keyboardDidShow', keybaordAvoding),
122
- Keyboard.addListener('keyboardDidHide', resetKeyboard)
123
- ]
122
+ subscriptions = [Keyboard.addListener('keyboardDidShow', keybaordAvoding), Keyboard.addListener('keyboardDidHide', resetKeyboard)]
124
123
  }
125
124
 
126
125
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.14-beta.8",
3
+ "version": "2.10.14-beta.9",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"