@momo-kits/foundation 0.153.1-test.11 → 0.153.2-beta.2
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/Input/InputSearch.tsx +6 -2
- package/Layout/Screen.tsx +16 -38
- package/package.json +1 -2
package/Input/InputSearch.tsx
CHANGED
|
@@ -138,9 +138,10 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
138
138
|
ref,
|
|
139
139
|
) => {
|
|
140
140
|
const { theme } = useContext(ApplicationContext);
|
|
141
|
-
|
|
142
141
|
const [focused, setFocused] = useState(false);
|
|
143
|
-
const
|
|
142
|
+
const [internalText, setInternalText] = useState(defaultValue || '');
|
|
143
|
+
const currentValue = value !== undefined ? value : internalText;
|
|
144
|
+
const haveValue = !!currentValue;
|
|
144
145
|
const inputRef = useRef<TextInput | null>(null);
|
|
145
146
|
|
|
146
147
|
const componentName = 'InputSearch';
|
|
@@ -167,6 +168,9 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
167
168
|
};
|
|
168
169
|
|
|
169
170
|
const _onChangeText = (text: string) => {
|
|
171
|
+
if (value === undefined) {
|
|
172
|
+
setInternalText(text);
|
|
173
|
+
}
|
|
170
174
|
onChangeText?.(text);
|
|
171
175
|
};
|
|
172
176
|
|
package/Layout/Screen.tsx
CHANGED
|
@@ -9,9 +9,7 @@ import React, {
|
|
|
9
9
|
useContext,
|
|
10
10
|
useEffect,
|
|
11
11
|
useImperativeHandle,
|
|
12
|
-
useMemo,
|
|
13
12
|
useRef,
|
|
14
|
-
useState,
|
|
15
13
|
} from 'react';
|
|
16
14
|
import {
|
|
17
15
|
Animated,
|
|
@@ -202,7 +200,6 @@ const Screen = forwardRef(
|
|
|
202
200
|
);
|
|
203
201
|
const currentTint = useRef<string | undefined>(undefined);
|
|
204
202
|
const isTab = navigation?.instance?.getState?.()?.type === 'tab';
|
|
205
|
-
const [footerHeight, setFooterHeight] = useState(0)
|
|
206
203
|
|
|
207
204
|
let handleScroll;
|
|
208
205
|
let Component: any = View;
|
|
@@ -212,14 +209,6 @@ const Screen = forwardRef(
|
|
|
212
209
|
keyboardOffset = -Math.min(insets.bottom, 21);
|
|
213
210
|
}
|
|
214
211
|
|
|
215
|
-
// It is used to normalize the header transparent for Android
|
|
216
|
-
const normalizeHeaderTransparent = useCallback((expectedValue: boolean) => {
|
|
217
|
-
if(Platform.OS === 'android') {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return expectedValue
|
|
221
|
-
}, [])
|
|
222
|
-
|
|
223
212
|
/**
|
|
224
213
|
* inject params for screen tracking
|
|
225
214
|
*/
|
|
@@ -244,14 +233,14 @@ const Screen = forwardRef(
|
|
|
244
233
|
case 'extended':
|
|
245
234
|
options = {
|
|
246
235
|
headerShown: true,
|
|
247
|
-
headerTransparent:
|
|
236
|
+
headerTransparent: true,
|
|
248
237
|
headerBackground: () => null,
|
|
249
238
|
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
250
239
|
};
|
|
251
240
|
if (inputSearchProps) {
|
|
252
241
|
options = {
|
|
253
242
|
headerShown: true,
|
|
254
|
-
headerTransparent:
|
|
243
|
+
headerTransparent: true,
|
|
255
244
|
headerBackground: () => null,
|
|
256
245
|
headerTitle: (props: any) => (
|
|
257
246
|
<HeaderTitle
|
|
@@ -287,7 +276,7 @@ const Screen = forwardRef(
|
|
|
287
276
|
if (inputSearchProps) {
|
|
288
277
|
options = {
|
|
289
278
|
headerShown: true,
|
|
290
|
-
headerTransparent:
|
|
279
|
+
headerTransparent: true,
|
|
291
280
|
headerBackground: () => null,
|
|
292
281
|
headerTitle: (props: any) => (
|
|
293
282
|
<HeaderTitle
|
|
@@ -312,7 +301,6 @@ const Screen = forwardRef(
|
|
|
312
301
|
inputSearchProps,
|
|
313
302
|
navigation?.instance,
|
|
314
303
|
useShadowHeader,
|
|
315
|
-
normalizeHeaderTransparent
|
|
316
304
|
],
|
|
317
305
|
);
|
|
318
306
|
|
|
@@ -329,7 +317,7 @@ const Screen = forwardRef(
|
|
|
329
317
|
|
|
330
318
|
options = {
|
|
331
319
|
headerTintColor: currentTint.current ?? Colors.black_17,
|
|
332
|
-
headerTransparent:
|
|
320
|
+
headerTransparent: true,
|
|
333
321
|
headerBackground: (props: any) => (
|
|
334
322
|
<HeaderBackground
|
|
335
323
|
{...props}
|
|
@@ -354,7 +342,7 @@ const Screen = forwardRef(
|
|
|
354
342
|
|
|
355
343
|
navigation?.instance?.setOptions(options);
|
|
356
344
|
},
|
|
357
|
-
[
|
|
345
|
+
[gradientColor, headerBackground, navigation?.instance, useShadowHeader],
|
|
358
346
|
);
|
|
359
347
|
|
|
360
348
|
/**
|
|
@@ -363,7 +351,7 @@ const Screen = forwardRef(
|
|
|
363
351
|
const setAnimatedSearch = useCallback(() => {
|
|
364
352
|
const options: StackNavigationOptions = {
|
|
365
353
|
headerShown: true,
|
|
366
|
-
headerTransparent:
|
|
354
|
+
headerTransparent: true,
|
|
367
355
|
headerBackground: () => null,
|
|
368
356
|
headerTitle: (props: any) => (
|
|
369
357
|
<HeaderTitle
|
|
@@ -379,7 +367,7 @@ const Screen = forwardRef(
|
|
|
379
367
|
};
|
|
380
368
|
|
|
381
369
|
navigation?.instance?.setOptions(options);
|
|
382
|
-
}, [
|
|
370
|
+
}, [navigation?.instance]);
|
|
383
371
|
|
|
384
372
|
/**
|
|
385
373
|
* export search header
|
|
@@ -575,21 +563,12 @@ const Screen = forwardRef(
|
|
|
575
563
|
}
|
|
576
564
|
};
|
|
577
565
|
|
|
578
|
-
// marginTop is used to support the header transparent on Android
|
|
579
|
-
const marginTop = useMemo(() => {
|
|
580
|
-
if (Platform.OS === 'android' && (animatedHeader || inputSearchProps || headerType === "extended")) {
|
|
581
|
-
return -heightHeader;
|
|
582
|
-
}
|
|
583
|
-
return undefined;
|
|
584
|
-
}, [animatedHeader, headerType, heightHeader, inputSearchProps])
|
|
585
|
-
|
|
586
566
|
return (
|
|
587
567
|
<View
|
|
588
568
|
style={[
|
|
589
569
|
Styles.flex,
|
|
590
570
|
{
|
|
591
571
|
backgroundColor: backgroundColor ?? theme.colors.background.default,
|
|
592
|
-
marginTop,
|
|
593
572
|
},
|
|
594
573
|
]}
|
|
595
574
|
>
|
|
@@ -632,13 +611,15 @@ const Screen = forwardRef(
|
|
|
632
611
|
</Component>
|
|
633
612
|
|
|
634
613
|
{floatingButtonProps && (
|
|
635
|
-
<
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
614
|
+
<View>
|
|
615
|
+
<FloatingButton
|
|
616
|
+
{...floatingButtonProps}
|
|
617
|
+
animatedValue={animatedValue.current}
|
|
618
|
+
bottom={
|
|
619
|
+
Footer || isTab ? 12 : Math.min(insets.bottom, 21) + Spacing.S
|
|
620
|
+
}
|
|
621
|
+
/>
|
|
622
|
+
</View>
|
|
642
623
|
)}
|
|
643
624
|
|
|
644
625
|
{Footer && (
|
|
@@ -650,9 +631,6 @@ const Screen = forwardRef(
|
|
|
650
631
|
backgroundColor: theme.colors.background.surface,
|
|
651
632
|
},
|
|
652
633
|
]}
|
|
653
|
-
onLayout={(e) => {
|
|
654
|
-
setFooterHeight(e.nativeEvent.layout.height)
|
|
655
|
-
}}
|
|
656
634
|
>
|
|
657
635
|
<Section>{Footer}</Section>
|
|
658
636
|
</View>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.153.
|
|
3
|
+
"version": "0.153.2-beta.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"react-native": "*"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@momo-platform/versions": "4.1.11",
|
|
30
29
|
"@types/color": "3.0.6"
|
|
31
30
|
},
|
|
32
31
|
"publishConfig": {
|