@momo-kits/foundation 0.157.2-test.1 → 0.157.3-beta.21
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/Application/BottomSheet.tsx +32 -1
- package/Application/ModalScreen.tsx +28 -23
- package/Application/types.ts +30 -2
- package/Badge/Badge.tsx +0 -2
- package/Badge/BadgeDot.tsx +0 -2
- package/Badge/BadgeDotAnimation.tsx +0 -2
- package/Badge/BadgeRibbon.tsx +0 -2
- package/Button/index.tsx +0 -2
- package/CheckBox/index.tsx +0 -2
- package/Context/index.ts +0 -10
- package/Divider/DashDivider.tsx +0 -2
- package/Divider/index.tsx +1 -3
- package/Icon/index.tsx +0 -2
- package/IconButton/index.tsx +0 -1
- package/Image/index.tsx +0 -2
- package/Input/Input.tsx +0 -2
- package/Input/InputDropDown.tsx +0 -2
- package/Input/InputMoney.tsx +0 -2
- package/Input/InputOTP.tsx +0 -2
- package/Input/InputPhoneNumber.tsx +0 -2
- package/Input/InputSearch.tsx +1 -5
- package/Input/InputTextArea.tsx +0 -2
- package/Layout/Card.tsx +1 -2
- package/Layout/FloatingButton.tsx +0 -2
- package/Layout/Item.tsx +0 -2
- package/Layout/ItemList.tsx +0 -2
- package/Layout/ItemSectionList.tsx +0 -2
- package/Layout/Screen.tsx +70 -268
- package/Layout/Section.tsx +3 -3
- package/Layout/TrackingScope.tsx +0 -2
- package/Layout/index.ts +1 -2
- package/Layout/utils.ts +2 -15
- package/Loader/DotLoader.tsx +0 -2
- package/Loader/Loader.tsx +1 -3
- package/Loader/ProgressBar.tsx +0 -2
- package/Loader/Spinner.tsx +0 -2
- package/Pagination/Dot.tsx +0 -2
- package/Pagination/PaginationDot.tsx +0 -2
- package/Pagination/PaginationNumber.tsx +0 -2
- package/Pagination/PaginationScroll.tsx +0 -2
- package/Pagination/PaginationWhiteDot.tsx +0 -2
- package/Popup/PopupNotify.tsx +0 -2
- package/Popup/PopupPromotion.tsx +0 -2
- package/Radio/index.tsx +1 -2
- package/Skeleton/index.tsx +0 -2
- package/Switch/index.tsx +0 -2
- package/Tag/index.tsx +0 -2
- package/Text/index.tsx +0 -2
- package/package.json +34 -34
- package/internal.ts +0 -2
package/Layout/Screen.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import React, {
|
|
|
9
9
|
useContext,
|
|
10
10
|
useEffect,
|
|
11
11
|
useImperativeHandle,
|
|
12
|
-
useMemo,
|
|
13
12
|
useRef,
|
|
14
13
|
} from 'react';
|
|
15
14
|
import {
|
|
@@ -22,18 +21,12 @@ import {
|
|
|
22
21
|
ScrollViewProps,
|
|
23
22
|
StatusBar,
|
|
24
23
|
StatusBarStyle,
|
|
25
|
-
TouchableOpacity,
|
|
26
24
|
useWindowDimensions,
|
|
27
25
|
View,
|
|
28
26
|
ViewProps,
|
|
29
|
-
Text,
|
|
30
27
|
} from 'react-native';
|
|
31
28
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
32
|
-
import {
|
|
33
|
-
ApplicationContext,
|
|
34
|
-
ScreenContext,
|
|
35
|
-
ScreenRegistryContext,
|
|
36
|
-
} from '../Context';
|
|
29
|
+
import { ApplicationContext, ScreenContext } from '../Context';
|
|
37
30
|
import Navigation from '../Application/Navigation';
|
|
38
31
|
import {
|
|
39
32
|
AnimatedHeader,
|
|
@@ -523,135 +516,6 @@ const Screen = forwardRef(
|
|
|
523
516
|
}
|
|
524
517
|
};
|
|
525
518
|
|
|
526
|
-
const registryRef = useRef<Map<string, string>>(new Map());
|
|
527
|
-
const registeredNamesRef = useRef<Set<string>>(new Set());
|
|
528
|
-
|
|
529
|
-
const register = useCallback((id: string, name: string) => {
|
|
530
|
-
registryRef.current.set(id, name);
|
|
531
|
-
registeredNamesRef.current.add(name);
|
|
532
|
-
}, []);
|
|
533
|
-
|
|
534
|
-
const unregister = useCallback((id: string) => {
|
|
535
|
-
const name = registryRef.current.get(id);
|
|
536
|
-
registryRef.current.delete(id);
|
|
537
|
-
const stillHasName = Array.from(registryRef.current.values()).includes(
|
|
538
|
-
name!,
|
|
539
|
-
);
|
|
540
|
-
if (!stillHasName) {
|
|
541
|
-
registeredNamesRef.current.delete(name!);
|
|
542
|
-
}
|
|
543
|
-
}, []);
|
|
544
|
-
|
|
545
|
-
const registryValue = useMemo(
|
|
546
|
-
() => ({ register, unregister }),
|
|
547
|
-
[register, unregister],
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
const WHITELISTED_COMPONENTS = useMemo(
|
|
551
|
-
() =>
|
|
552
|
-
new Set([
|
|
553
|
-
'View',
|
|
554
|
-
'TouchableOpacity',
|
|
555
|
-
'TouchableHighlight',
|
|
556
|
-
'TouchableWithoutFeedback',
|
|
557
|
-
'Pressable',
|
|
558
|
-
'ScrollView',
|
|
559
|
-
'FlatList',
|
|
560
|
-
'SectionList',
|
|
561
|
-
'SafeAreaView',
|
|
562
|
-
'KeyboardAvoidingView',
|
|
563
|
-
'ActivityIndicator',
|
|
564
|
-
'ImageBackground',
|
|
565
|
-
'Fragment',
|
|
566
|
-
]),
|
|
567
|
-
[],
|
|
568
|
-
);
|
|
569
|
-
|
|
570
|
-
const [usageStats, setUsageStats] = React.useState<{
|
|
571
|
-
total: number;
|
|
572
|
-
internal: number;
|
|
573
|
-
external: number;
|
|
574
|
-
breakdown: Record<string, number>;
|
|
575
|
-
externalNames: string[];
|
|
576
|
-
}>({
|
|
577
|
-
total: 0,
|
|
578
|
-
internal: 0,
|
|
579
|
-
external: 0,
|
|
580
|
-
breakdown: {},
|
|
581
|
-
externalNames: [],
|
|
582
|
-
});
|
|
583
|
-
const [isUsageExpanded, setIsUsageExpanded] = React.useState(false);
|
|
584
|
-
|
|
585
|
-
const countExternalChildren = useCallback(
|
|
586
|
-
(node: React.ReactNode): { count: number; names: string[] } => {
|
|
587
|
-
let count = 0;
|
|
588
|
-
const names: string[] = [];
|
|
589
|
-
const traverse = (n: React.ReactNode) => {
|
|
590
|
-
React.Children.forEach(n, child => {
|
|
591
|
-
if (!React.isValidElement(child)) return;
|
|
592
|
-
const name =
|
|
593
|
-
(child.type as any)?.displayName ||
|
|
594
|
-
(child.type as any)?.name ||
|
|
595
|
-
'';
|
|
596
|
-
if (
|
|
597
|
-
!registeredNamesRef.current.has(name) &&
|
|
598
|
-
!WHITELISTED_COMPONENTS.has(name)
|
|
599
|
-
) {
|
|
600
|
-
count++;
|
|
601
|
-
if (name) {
|
|
602
|
-
names.push(name);
|
|
603
|
-
} else {
|
|
604
|
-
names.push('Anonymous');
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
if ((child as any).props?.children) {
|
|
608
|
-
traverse((child as any).props.children);
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
};
|
|
612
|
-
traverse(node);
|
|
613
|
-
return { count, names };
|
|
614
|
-
},
|
|
615
|
-
[WHITELISTED_COMPONENTS],
|
|
616
|
-
);
|
|
617
|
-
|
|
618
|
-
useEffect(() => {
|
|
619
|
-
if (__DEV__) {
|
|
620
|
-
const allRegistered = Array.from(registryRef.current.values());
|
|
621
|
-
const internal = allRegistered.length;
|
|
622
|
-
const { count: external, names: externalNames } =
|
|
623
|
-
countExternalChildren(children);
|
|
624
|
-
const total = internal + external;
|
|
625
|
-
const counts: Record<string, number> = {};
|
|
626
|
-
allRegistered.forEach(name => {
|
|
627
|
-
counts[name] = (counts[name] || 0) + 1;
|
|
628
|
-
});
|
|
629
|
-
console.log(
|
|
630
|
-
`[Screen] Total: ${total}, Internal: ${internal}, External: ${external}`,
|
|
631
|
-
);
|
|
632
|
-
console.log(`[Screen] Internal components:`, counts);
|
|
633
|
-
if (externalNames.length > 0) {
|
|
634
|
-
console.log(`[Screen] External components:`, externalNames);
|
|
635
|
-
}
|
|
636
|
-
setUsageStats(prev => {
|
|
637
|
-
if (
|
|
638
|
-
prev.total === total &&
|
|
639
|
-
prev.internal === internal &&
|
|
640
|
-
prev.external === external
|
|
641
|
-
) {
|
|
642
|
-
return prev;
|
|
643
|
-
}
|
|
644
|
-
return {
|
|
645
|
-
total,
|
|
646
|
-
internal,
|
|
647
|
-
external,
|
|
648
|
-
breakdown: counts,
|
|
649
|
-
externalNames,
|
|
650
|
-
};
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
|
|
655
519
|
/**
|
|
656
520
|
* build content for screen for grid rule
|
|
657
521
|
*/
|
|
@@ -699,144 +563,82 @@ const Screen = forwardRef(
|
|
|
699
563
|
}
|
|
700
564
|
};
|
|
701
565
|
|
|
702
|
-
const renderUsageRate = () => {
|
|
703
|
-
if (!__DEV__ || usageStats.total === 0) return null;
|
|
704
|
-
const rate = Math.round((usageStats.internal / usageStats.total) * 100);
|
|
705
|
-
let color = '#4caf50';
|
|
706
|
-
if (rate < 50) color = '#f44336';
|
|
707
|
-
else if (rate < 80) color = '#ff9800';
|
|
708
|
-
|
|
709
|
-
const hasExternals = usageStats.externalNames.length > 0;
|
|
710
|
-
|
|
711
|
-
return (
|
|
712
|
-
<TouchableOpacity
|
|
713
|
-
activeOpacity={0.8}
|
|
714
|
-
onPress={() => hasExternals && setIsUsageExpanded(prev => !prev)}
|
|
715
|
-
style={{
|
|
716
|
-
position: 'absolute',
|
|
717
|
-
bottom: insets.bottom + 100,
|
|
718
|
-
right: 16,
|
|
719
|
-
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
720
|
-
padding: isUsageExpanded ? 12 : 8,
|
|
721
|
-
borderRadius: 8,
|
|
722
|
-
zIndex: 9999,
|
|
723
|
-
alignItems: 'flex-end',
|
|
724
|
-
minWidth: isUsageExpanded ? 160 : undefined,
|
|
725
|
-
}}
|
|
726
|
-
>
|
|
727
|
-
<Text style={{ color: 'white', fontSize: 12, fontWeight: 'bold' }}>
|
|
728
|
-
Kit Usage: <Text style={{ color }}>{rate}%</Text>
|
|
729
|
-
{hasExternals && !isUsageExpanded && ' ▼'}
|
|
730
|
-
</Text>
|
|
731
|
-
<Text style={{ color: '#ccc', fontSize: 10, marginTop: 4 }}>
|
|
732
|
-
{usageStats.internal} / {usageStats.total} Components
|
|
733
|
-
</Text>
|
|
734
|
-
{isUsageExpanded && hasExternals && (
|
|
735
|
-
<View style={{ marginTop: 8, alignSelf: 'stretch' }}>
|
|
736
|
-
<Text style={{ color: '#aaa', fontSize: 9, marginBottom: 4 }}>
|
|
737
|
-
External ({usageStats.externalNames.length}):
|
|
738
|
-
</Text>
|
|
739
|
-
<Text
|
|
740
|
-
style={{ color: '#f88', fontSize: 10 }}
|
|
741
|
-
numberOfLines={8}
|
|
742
|
-
>
|
|
743
|
-
{usageStats.externalNames.slice(0, 15).join(', ')}
|
|
744
|
-
{usageStats.externalNames.length > 15 &&
|
|
745
|
-
` ... +${usageStats.externalNames.length - 15} more`}
|
|
746
|
-
</Text>
|
|
747
|
-
<Text style={{ color: '#666', fontSize: 9, marginTop: 4 }}>
|
|
748
|
-
Tap to collapse ▲
|
|
749
|
-
</Text>
|
|
750
|
-
</View>
|
|
751
|
-
)}
|
|
752
|
-
</TouchableOpacity>
|
|
753
|
-
);
|
|
754
|
-
};
|
|
755
|
-
|
|
756
566
|
return (
|
|
757
|
-
<
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
567
|
+
<View
|
|
568
|
+
style={[
|
|
569
|
+
Styles.flex,
|
|
570
|
+
{
|
|
571
|
+
backgroundColor: backgroundColor ?? theme.colors.background.default,
|
|
572
|
+
},
|
|
573
|
+
]}
|
|
574
|
+
>
|
|
575
|
+
<HeaderExtendHeader
|
|
576
|
+
headerType={headerType}
|
|
577
|
+
heightHeader={heightHeader}
|
|
578
|
+
headerRightWidth={headerRightWidth}
|
|
579
|
+
animatedValue={animatedValue.current}
|
|
580
|
+
inputSearchProps={inputSearchProps}
|
|
581
|
+
navigation={navigation}
|
|
582
|
+
inputSearchRef={inputSearchRef}
|
|
583
|
+
useShadowHeader={useShadowHeader}
|
|
584
|
+
gradientColor={gradientColor}
|
|
585
|
+
headerBackground={headerBackground}
|
|
586
|
+
/>
|
|
587
|
+
|
|
588
|
+
<KeyboardAvoidingView
|
|
589
|
+
style={Styles.flex}
|
|
590
|
+
enabled={enableKeyboardAvoidingView}
|
|
591
|
+
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
592
|
+
behavior={Platform.select({
|
|
593
|
+
ios: 'padding',
|
|
594
|
+
android: undefined,
|
|
595
|
+
})}
|
|
766
596
|
>
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
gradientColor={gradientColor}
|
|
777
|
-
headerBackground={headerBackground}
|
|
778
|
-
/>
|
|
779
|
-
|
|
780
|
-
<KeyboardAvoidingView
|
|
597
|
+
{Header}
|
|
598
|
+
|
|
599
|
+
<Component
|
|
600
|
+
{...scrollViewProps}
|
|
601
|
+
ref={screenRef}
|
|
602
|
+
showsVerticalScrollIndicator={false}
|
|
603
|
+
onScroll={handleScroll}
|
|
604
|
+
onScrollEndDrag={handleScrollEnd}
|
|
605
|
+
scrollEventThrottle={16}
|
|
781
606
|
style={Styles.flex}
|
|
782
|
-
enabled={enableKeyboardAvoidingView}
|
|
783
|
-
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
784
|
-
behavior={Platform.select({
|
|
785
|
-
ios: 'padding',
|
|
786
|
-
android: undefined,
|
|
787
|
-
})}
|
|
788
607
|
>
|
|
789
|
-
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
</
|
|
804
|
-
|
|
805
|
-
{floatingButtonProps && (
|
|
806
|
-
<View>
|
|
807
|
-
<FloatingButton
|
|
808
|
-
{...floatingButtonProps}
|
|
809
|
-
animatedValue={animatedValue.current}
|
|
810
|
-
bottom={
|
|
811
|
-
Footer || isTab
|
|
812
|
-
? 12
|
|
813
|
-
: Math.min(insets.bottom, 21) + Spacing.S
|
|
814
|
-
}
|
|
815
|
-
/>
|
|
816
|
-
</View>
|
|
817
|
-
)}
|
|
818
|
-
|
|
819
|
-
{Footer && (
|
|
820
|
-
<View
|
|
821
|
-
style={[
|
|
822
|
-
styles.shadow,
|
|
823
|
-
{
|
|
824
|
-
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
825
|
-
backgroundColor: theme.colors.background.surface,
|
|
826
|
-
},
|
|
827
|
-
]}
|
|
828
|
-
>
|
|
829
|
-
<Section>{Footer}</Section>
|
|
830
|
-
</View>
|
|
831
|
-
)}
|
|
832
|
-
</KeyboardAvoidingView>
|
|
608
|
+
{renderAnimatedHeader()}
|
|
609
|
+
|
|
610
|
+
{useGridLayout ? renderContent(children) : children}
|
|
611
|
+
</Component>
|
|
612
|
+
|
|
613
|
+
{floatingButtonProps && (
|
|
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>
|
|
623
|
+
)}
|
|
833
624
|
|
|
834
|
-
{
|
|
835
|
-
|
|
836
|
-
|
|
625
|
+
{Footer && (
|
|
626
|
+
<View
|
|
627
|
+
style={[
|
|
628
|
+
styles.shadow,
|
|
629
|
+
{
|
|
630
|
+
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
631
|
+
backgroundColor: theme.colors.background.surface,
|
|
632
|
+
},
|
|
633
|
+
]}
|
|
634
|
+
>
|
|
635
|
+
<Section>{Footer}</Section>
|
|
636
|
+
</View>
|
|
637
|
+
)}
|
|
638
|
+
</KeyboardAvoidingView>
|
|
639
|
+
</View>
|
|
837
640
|
);
|
|
838
641
|
},
|
|
839
642
|
);
|
|
840
643
|
|
|
841
|
-
Screen.displayName = 'Screen';
|
|
842
644
|
export default Screen;
|
package/Layout/Section.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { Dimensions, View, ViewProps } from 'react-native';
|
|
3
|
-
import { useGridSystem
|
|
3
|
+
import { useGridSystem } from './utils';
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext } from './index';
|
|
6
6
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
@@ -34,7 +34,6 @@ const Section: React.FC<SectionProps> = ({
|
|
|
34
34
|
style,
|
|
35
35
|
...props
|
|
36
36
|
}) => {
|
|
37
|
-
useScreenRegistry('Section');
|
|
38
37
|
const { showGrid } = useContext(ApplicationContext);
|
|
39
38
|
const { numberOfColumns } = useGridSystem();
|
|
40
39
|
|
|
@@ -49,7 +48,8 @@ const Section: React.FC<SectionProps> = ({
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
const sizePerSpan =
|
|
52
|
-
(widthSection - (numberOfColumns - 1)
|
|
51
|
+
(widthSection - gutterSize * (numberOfColumns - 1)) / numberOfColumns -
|
|
52
|
+
1 / numberOfColumns;
|
|
53
53
|
|
|
54
54
|
const gridContext: GridContextProps = {
|
|
55
55
|
numberOfColumns,
|
package/Layout/TrackingScope.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TrackingScopeContext } from '../Context';
|
|
3
|
-
import { useScreenRegistry } from './utils';
|
|
4
3
|
|
|
5
4
|
const TrackingScope = ({
|
|
6
5
|
scopeName,
|
|
@@ -9,7 +8,6 @@ const TrackingScope = ({
|
|
|
9
8
|
scopeName: string;
|
|
10
9
|
children: any;
|
|
11
10
|
}) => {
|
|
12
|
-
useScreenRegistry('TrackingScope');
|
|
13
11
|
return (
|
|
14
12
|
<TrackingScopeContext.Provider value={{ scopeName }}>
|
|
15
13
|
{children}
|
package/Layout/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Card from './Card';
|
|
2
2
|
import Section from './Section';
|
|
3
3
|
import GridSystem from './GridSystem';
|
|
4
|
-
import { validateChildren
|
|
4
|
+
import { validateChildren } from './utils';
|
|
5
5
|
import { createContext } from 'react';
|
|
6
6
|
import { GridContextProps } from './types';
|
|
7
7
|
import Item from './Item';
|
|
@@ -26,7 +26,6 @@ export {
|
|
|
26
26
|
Section,
|
|
27
27
|
GridSystem,
|
|
28
28
|
validateChildren,
|
|
29
|
-
useScreenRegistry,
|
|
30
29
|
Item,
|
|
31
30
|
ItemList,
|
|
32
31
|
ItemSectionList,
|
package/Layout/utils.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { Fragment, ReactElement
|
|
1
|
+
import React, { Fragment, ReactElement } from 'react';
|
|
2
2
|
import { useWindowDimensions } from 'react-native';
|
|
3
|
-
import { ScreenRegistryContext } from '../Context';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* validate children type
|
|
@@ -45,16 +44,4 @@ const useGridSystem = () => {
|
|
|
45
44
|
return { numberOfColumns };
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const useScreenRegistry = (name: string) => {
|
|
51
|
-
const { register, unregister } = useContext(ScreenRegistryContext);
|
|
52
|
-
const id = useRef(`__sr_${name}_${registryIdCounter++}`).current;
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
register(id, name);
|
|
56
|
-
return () => unregister(id);
|
|
57
|
-
}, [id, name, register, unregister]);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { useGridSystem, validateChildren, useScreenRegistry };
|
|
47
|
+
export { useGridSystem, validateChildren };
|
package/Loader/DotLoader.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import animation from '../Assets/DotAnimation.json';
|
|
|
4
4
|
import { ApplicationContext } from '../Context';
|
|
5
5
|
import { hexToRGBA } from './utils';
|
|
6
6
|
import { LoaderProps } from './types';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const DotLoader: FC<LoaderProps> = ({ color, style }) => {
|
|
10
|
-
useScreenRegistry('DotLoader');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
|
|
13
11
|
const arrayColor = [
|
package/Loader/Loader.tsx
CHANGED
|
@@ -2,10 +2,8 @@ import React, {FC} from 'react';
|
|
|
2
2
|
import {LoaderProps} from './types';
|
|
3
3
|
import DotLoader from './DotLoader';
|
|
4
4
|
import Spinner from './Spinner';
|
|
5
|
-
import { useScreenRegistry } from '../Layout';
|
|
6
5
|
|
|
7
|
-
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
8
|
-
useScreenRegistry('Loader');
|
|
6
|
+
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
9
7
|
if (type === 'spinner') {
|
|
10
8
|
return <Spinner {...props} key={props.color} />;
|
|
11
9
|
}
|
package/Loader/ProgressBar.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import styles from './styles';
|
|
|
4
4
|
import { ProgressBarProps } from './types';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
6
|
import { Radius } from '../Consts';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const ProgressBar: FC<ProgressBarProps> = ({ percent = 0, style }) => {
|
|
10
|
-
useScreenRegistry('ProgressBar');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
const animation = useRef(new Animated.Value(0)).current;
|
|
13
11
|
|
package/Loader/Spinner.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import animation from '../Assets/SpinnerAnimation.json';
|
|
|
4
4
|
import { hexToRGBA } from './utils';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
6
|
import { LoaderProps } from './types';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const Spinner: FC<LoaderProps> = ({ color, style }) => {
|
|
10
|
-
useScreenRegistry('Spinner');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
|
|
13
11
|
let source: any = animation;
|
package/Pagination/Dot.tsx
CHANGED
|
@@ -3,10 +3,8 @@ import { Animated } from 'react-native';
|
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import { DotProps } from './types';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
7
6
|
|
|
8
7
|
const Dot: FC<DotProps> = ({ active, style }) => {
|
|
9
|
-
useScreenRegistry('Dot');
|
|
10
8
|
const { theme } = useContext(ApplicationContext);
|
|
11
9
|
const dotStyle = active
|
|
12
10
|
? [styles.activeDot]
|
|
@@ -5,14 +5,12 @@ import Dot from './Dot';
|
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import { Spacing } from '../Consts';
|
|
7
7
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
11
10
|
dataLength = 2,
|
|
12
11
|
activeIndex = 0,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationDot');
|
|
16
14
|
const { theme } = useContext(ApplicationContext);
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
|
|
@@ -5,14 +5,12 @@ import styles from './styles';
|
|
|
5
5
|
import { Text } from '../Text';
|
|
6
6
|
import { Colors } from '../Consts';
|
|
7
7
|
import { MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
11
10
|
activeIndex = 0,
|
|
12
11
|
dataLength = 2,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationNumber');
|
|
16
14
|
const context = useContext<any>(MiniAppContext);
|
|
17
15
|
|
|
18
16
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
@@ -3,7 +3,6 @@ import { Animated, View } from 'react-native';
|
|
|
3
3
|
import { ScrollIndicatorProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
6
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
7
6
|
|
|
8
7
|
const INDICATOR_WIDTH = 24;
|
|
9
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -12,7 +11,6 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
12
11
|
children,
|
|
13
12
|
scrollViewRef,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationScroll');
|
|
16
14
|
const { theme } = useContext(ApplicationContext);
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
const left = useRef(new Animated.Value(0)).current;
|
|
@@ -5,14 +5,12 @@ import styles from './styles';
|
|
|
5
5
|
import Dot from './Dot';
|
|
6
6
|
import { Colors, Spacing } from '../Consts';
|
|
7
7
|
import { MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
11
10
|
dataLength = 2,
|
|
12
11
|
activeIndex = 0,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationWhiteDot');
|
|
16
14
|
const context = useContext<any>(MiniAppContext);
|
|
17
15
|
|
|
18
16
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -14,7 +14,6 @@ import { Image } from '../Image';
|
|
|
14
14
|
import { Text, useScaleSize } from '../Text';
|
|
15
15
|
import { PopupNotifyProps } from './types';
|
|
16
16
|
import { runOnJS } from 'react-native-reanimated';
|
|
17
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
18
17
|
|
|
19
18
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
20
19
|
image,
|
|
@@ -27,7 +26,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
27
26
|
onIconClose,
|
|
28
27
|
onRequestClose,
|
|
29
28
|
}) => {
|
|
30
|
-
useScreenRegistry('PopupNotify');
|
|
31
29
|
const context = useContext<any>(MiniAppContext);
|
|
32
30
|
const { theme, navigator, translate } = useContext(ApplicationContext);
|
|
33
31
|
const [scrollContent, setScrollContent] = useState(false);
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import { ApplicationContext, MiniAppContext } from '../Context';
|
|
|
5
5
|
import { Image } from '../Image';
|
|
6
6
|
import { Colors, Radius, Spacing } from '../Consts';
|
|
7
7
|
import { Icon } from '../Icon';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
11
10
|
image,
|
|
@@ -13,7 +12,6 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
13
12
|
onRequestClose,
|
|
14
13
|
onActionClick,
|
|
15
14
|
}) => {
|
|
16
|
-
useScreenRegistry('PopupPromotion');
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
19
17
|
const { width: widthDevice } = Dimensions.get('window');
|
package/Radio/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC, useContext } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { RadioProps } from './types';
|
|
5
5
|
import { Text } from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
@@ -24,7 +24,6 @@ const Radio: FC<RadioProps> = ({
|
|
|
24
24
|
accessibilityLabel,
|
|
25
25
|
...props
|
|
26
26
|
}) => {
|
|
27
|
-
useScreenRegistry('Radio');
|
|
28
27
|
const { theme } = useContext(ApplicationContext);
|
|
29
28
|
const context = useContext<any>(MiniAppContext);
|
|
30
29
|
const selected = value === groupValue;
|
package/Skeleton/index.tsx
CHANGED
|
@@ -13,10 +13,8 @@ import { SkeletonTypes } from './types';
|
|
|
13
13
|
import { Colors, Styles } from '../Consts';
|
|
14
14
|
import styles from './styles';
|
|
15
15
|
import { ScreenContext, SkeletonContext } from '../Context';
|
|
16
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
17
16
|
|
|
18
17
|
const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
19
|
-
useScreenRegistry('Skeleton');
|
|
20
18
|
const screen = useContext<any>(ScreenContext);
|
|
21
19
|
const [width, setWidth] = useState(0);
|
|
22
20
|
const PRIMARY_COLOR = Colors.black_05;
|
package/Switch/index.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import styles from './styles';
|
|
|
5
5
|
import { Colors } from '../Consts';
|
|
6
6
|
import { useComponentId } from '../Application';
|
|
7
7
|
import { ComponentContext, MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '@momo-kits/foundation';
|
|
9
8
|
|
|
10
9
|
const Switch: FC<SwitchProps> = ({
|
|
11
10
|
value = false,
|
|
@@ -16,7 +15,6 @@ const Switch: FC<SwitchProps> = ({
|
|
|
16
15
|
accessibilityLabel,
|
|
17
16
|
...props
|
|
18
17
|
}) => {
|
|
19
|
-
useScreenRegistry('Switch');
|
|
20
18
|
const context = useContext<any>(MiniAppContext);
|
|
21
19
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
22
20
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|