@momo-kits/foundation 0.92.21-beta.11 → 0.92.21-beta.12

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.
@@ -4,7 +4,7 @@ import {getOptions} from './utils';
4
4
 
5
5
  class Navigation {
6
6
  instance: NavigationProp<any>;
7
- rightHeaderWidth?: number;
7
+ onHeaderRightChange?: (width: number) => void;
8
8
 
9
9
  constructor(instance: any) {
10
10
  this.instance = instance;
@@ -78,7 +78,7 @@ class Navigator {
78
78
  StackActions.push('Modal', {
79
79
  ...params,
80
80
  isBottomSheet: true,
81
- }),
81
+ })
82
82
  );
83
83
  }
84
84
  };
@@ -103,7 +103,7 @@ class Navigator {
103
103
  CommonActions.navigate({
104
104
  name,
105
105
  params,
106
- }),
106
+ })
107
107
  );
108
108
  }
109
109
  };
@@ -124,7 +124,7 @@ class Navigator {
124
124
  params,
125
125
  },
126
126
  ],
127
- }),
127
+ })
128
128
  );
129
129
  }
130
130
  };
@@ -142,10 +142,14 @@ class Navigator {
142
142
  * @param callback
143
143
  */
144
144
  setToolkitCallback = (
145
- callback: (item: {key: string; action: string}) => void,
145
+ callback: (item: {key: string; action: string}) => void
146
146
  ) => {
147
147
  this.toolkitCallback = callback;
148
148
  };
149
+
150
+ setHeaderWidth = (width: number) => {
151
+ alert(width);
152
+ };
149
153
  }
150
154
 
151
155
  export default Navigator;
@@ -149,9 +149,7 @@ const getOptions = (params: NavigationOptions, navigation?: Navigation) => {
149
149
  {...props}
150
150
  {...params.headerRight}
151
151
  onLayout={(e: LayoutChangeEvent) => {
152
- if (navigation) {
153
- navigation.rightHeaderWidth = e.nativeEvent.layout.width;
154
- }
152
+ navigation?.onHeaderRightChange?.(e.nativeEvent.layout.width);
155
153
  }}
156
154
  />
157
155
  );
@@ -162,9 +160,7 @@ const getOptions = (params: NavigationOptions, navigation?: Navigation) => {
162
160
  <HeaderRight
163
161
  {...props}
164
162
  onLayout={(e: LayoutChangeEvent) => {
165
- if (navigation) {
166
- navigation.rightHeaderWidth = e.nativeEvent.layout.width;
167
- }
163
+ navigation?.onHeaderRightChange?.(e.nativeEvent.layout.width);
168
164
  }}>
169
165
  {params.headerRight(props)}
170
166
  </HeaderRight>
package/Assets/icon.json CHANGED
@@ -4027,17 +4027,5 @@
4027
4027
  },
4028
4028
  "travel_suitcase": {
4029
4029
  "uri": "https://static.momocdn.net/app/img/kits/travel_suitcase.png"
4030
- },
4031
- "security_abnormal_activity": {
4032
- "uri": "https://static.momocdn.net/app/img/kits/security_abnormal_activity.png"
4033
- },
4034
- "security_bug": {
4035
- "uri": "https://static.momocdn.net/app/img/kits/security_bug.png"
4036
- },
4037
- "security_hacker": {
4038
- "uri": "https://static.momocdn.net/app/img/kits/security_hacker.png"
4039
- },
4040
- "security_phishing": {
4041
- "uri": "https://static.momocdn.net/app/img/kits/security_phishing.png"
4042
4030
  }
4043
4031
  }
@@ -20,16 +20,9 @@ const AnimatedInputSearch: FC<AnimatedInputSearchProps> = ({
20
20
  }) => {
21
21
  const {width: screenWidth} = Dimensions.get('window');
22
22
  const widthAnimated = useRef(new Animated.Value(0));
23
- const [rightSpace, setRightSpace] = useState(
24
- navigation?.rightHeaderWidth ?? 0
25
- );
23
+ const [rightSpace, setRightSpace] = useState(0);
26
24
 
27
25
  useEffect(() => {
28
- setTimeout(() => {
29
- if (rightSpace != navigation?.rightHeaderWidth) {
30
- setRightSpace(navigation?.rightHeaderWidth ?? 0);
31
- }
32
- }, 500);
33
26
  const listener = animatedValue.addListener(({value}) => {
34
27
  widthAnimated.current.setValue(value);
35
28
  });
@@ -38,6 +31,10 @@ const AnimatedInputSearch: FC<AnimatedInputSearchProps> = ({
38
31
  };
39
32
  }, []);
40
33
 
34
+ navigation!.onHeaderRightChange = (width: number) => {
35
+ setRightSpace(width);
36
+ };
37
+
41
38
  const translateX = widthAnimated.current.interpolate({
42
39
  inputRange: [0, 100],
43
40
  outputRange: [SCREEN_PADDING, BACK_WIDTH + SCREEN_PADDING * 2],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.21-beta.11",
3
+ "version": "0.92.21-beta.12",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},