@ledgerhq/lumen-ui-rnative 0.1.25 → 0.1.27
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/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +22 -23
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +17 -23
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Button/Button.stories.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.stories.js.map +1 -1
- package/dist/module/lib/Components/DotCount/DotCount.js +128 -0
- package/dist/module/lib/Components/DotCount/DotCount.js.map +1 -0
- package/dist/module/lib/Components/DotCount/DotCount.mdx +86 -0
- package/dist/module/lib/Components/DotCount/DotCount.stories.js +172 -0
- package/dist/module/lib/Components/DotCount/DotCount.stories.js.map +1 -0
- package/dist/module/lib/Components/DotCount/DotCount.test.js +174 -0
- package/dist/module/lib/Components/DotCount/DotCount.test.js.map +1 -0
- package/dist/module/lib/Components/DotCount/index.js +5 -0
- package/dist/module/lib/Components/DotCount/index.js.map +1 -0
- package/dist/module/lib/Components/DotCount/types.js +4 -0
- package/dist/module/lib/Components/DotCount/types.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js +89 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +82 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +84 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +136 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/index.js +5 -0
- package/dist/module/lib/Components/DotIndicator/index.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/types.js +4 -0
- package/dist/module/lib/Components/DotIndicator/types.js.map +1 -0
- package/dist/module/lib/Components/Link/Link.stories.js.map +1 -1
- package/dist/module/lib/Components/Spot/Spot.stories.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.js +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +16 -13
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/Utility/Gradient/utils/resolveGradientColor.js.map +1 -1
- package/dist/module/lib/Components/index.js +2 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -0
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotCount/DotCount.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DotCount/DotCount.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotCount/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DotCount/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotCount/types.d.ts +40 -0
- package/dist/typescript/src/lib/Components/DotCount/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIndicator/DotIndicator.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DotIndicator/DotIndicator.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +25 -0
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.d.ts +2 -2
- package/dist/typescript/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/Components/Avatar/Avatar.test.tsx +17 -27
- package/src/lib/Components/Avatar/Avatar.tsx +24 -21
- package/src/lib/Components/Button/Button.stories.tsx +1 -1
- package/src/lib/Components/CardButton/CardButton.stories.tsx +2 -2
- package/src/lib/Components/DotCount/DotCount.mdx +86 -0
- package/src/lib/Components/DotCount/DotCount.stories.tsx +124 -0
- package/src/lib/Components/DotCount/DotCount.test.tsx +150 -0
- package/src/lib/Components/DotCount/DotCount.tsx +130 -0
- package/src/lib/Components/DotCount/index.ts +2 -0
- package/src/lib/Components/DotCount/types.ts +40 -0
- package/src/lib/Components/DotIndicator/DotIndicator.mdx +82 -0
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +67 -0
- package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +132 -0
- package/src/lib/Components/DotIndicator/DotIndicator.tsx +97 -0
- package/src/lib/Components/DotIndicator/index.ts +2 -0
- package/src/lib/Components/DotIndicator/types.ts +25 -0
- package/src/lib/Components/Link/Link.stories.tsx +1 -1
- package/src/lib/Components/Spot/Spot.stories.tsx +2 -2
- package/src/lib/Components/Subheader/Subheader.tsx +1 -1
- package/src/lib/Components/TabBar/TabBar.tsx +17 -16
- package/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.ts +2 -2
- package/src/lib/Components/index.ts +2 -0
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { BlurView } from '@sbaiahmed1/react-native-blur';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Children,
|
|
5
|
-
isValidElement,
|
|
6
|
-
useCallback,
|
|
7
|
-
useEffect,
|
|
8
|
-
useRef,
|
|
9
|
-
} from 'react';
|
|
3
|
+
import { Children, isValidElement, useEffect, useMemo, useRef } from 'react';
|
|
10
4
|
import type { LayoutChangeEvent } from 'react-native';
|
|
11
5
|
import { Platform, StyleSheet, Text, View } from 'react-native';
|
|
12
6
|
import Animated, {
|
|
@@ -19,6 +13,7 @@ import Animated, {
|
|
|
19
13
|
} from 'react-native-reanimated';
|
|
20
14
|
import { useStyleSheet, useTheme } from '../../../styles';
|
|
21
15
|
import { useTimingConfig } from '../../Animations/useTimingConfig';
|
|
16
|
+
import { triggerHapticFeedback } from '../../Haptics';
|
|
22
17
|
import { Placeholder } from '../../Symbols';
|
|
23
18
|
import { Box, Pressable } from '../Utility';
|
|
24
19
|
import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
|
|
@@ -51,14 +46,16 @@ const useTabBarItemAnimations = ({ isActive }: { isActive: boolean }) => {
|
|
|
51
46
|
50,
|
|
52
47
|
withTiming(isActive ? 1 : 0, activeTimingConfig),
|
|
53
48
|
);
|
|
54
|
-
return () => cancelAnimation(activeProgress);
|
|
55
49
|
}, [isActive, activeProgress, activeTimingConfig]);
|
|
56
50
|
|
|
51
|
+
useEffect(() => () => cancelAnimation(activeProgress), [activeProgress]);
|
|
52
|
+
|
|
57
53
|
const onPressIn = () => {
|
|
58
54
|
pressProgress.value = withTiming(0.9, pressInTimingConfig);
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
const onPressOut = () => {
|
|
58
|
+
triggerHapticFeedback('light');
|
|
62
59
|
pressProgress.value = withSequence(
|
|
63
60
|
withTiming(0.95, { duration: 0 }),
|
|
64
61
|
withTiming(1, pressOutTimingConfig),
|
|
@@ -112,7 +109,7 @@ const useTabBarPillLayout = ({
|
|
|
112
109
|
easing: 'easeInOut',
|
|
113
110
|
});
|
|
114
111
|
|
|
115
|
-
const
|
|
112
|
+
const activeIndex = useMemo(() => {
|
|
116
113
|
return Children.toArray(children).findIndex((child) => {
|
|
117
114
|
if (isValidElement<TabBarItemProps>(child)) {
|
|
118
115
|
return child.props.value === active;
|
|
@@ -121,6 +118,9 @@ const useTabBarPillLayout = ({
|
|
|
121
118
|
});
|
|
122
119
|
}, [active, children]);
|
|
123
120
|
|
|
121
|
+
const activeIndexRef = useRef(activeIndex);
|
|
122
|
+
activeIndexRef.current = activeIndex;
|
|
123
|
+
|
|
124
124
|
const onLayout = (e: LayoutChangeEvent): void => {
|
|
125
125
|
const { width, height } = e.nativeEvent.layout;
|
|
126
126
|
const count = Children.count(children);
|
|
@@ -131,7 +131,7 @@ const useTabBarPillLayout = ({
|
|
|
131
131
|
|
|
132
132
|
if (!hasLayoutRef.current) {
|
|
133
133
|
hasLayoutRef.current = true;
|
|
134
|
-
const index =
|
|
134
|
+
const index = activeIndexRef.current;
|
|
135
135
|
if (index >= 0) {
|
|
136
136
|
pillProgress.value = index * slotWidth;
|
|
137
137
|
}
|
|
@@ -140,14 +140,15 @@ const useTabBarPillLayout = ({
|
|
|
140
140
|
|
|
141
141
|
useEffect(() => {
|
|
142
142
|
if (!hasLayoutRef.current) return;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
if (activeIndex >= 0 && itemWidth.value > 0) {
|
|
144
|
+
pillProgress.value = withTiming(
|
|
145
|
+
activeIndex * itemWidth.value,
|
|
146
|
+
timingConfig,
|
|
147
|
+
);
|
|
147
148
|
}
|
|
149
|
+
}, [activeIndex, itemWidth, pillProgress, timingConfig]);
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
}, [itemWidth, pillProgress, getActiveIndex, timingConfig]);
|
|
151
|
+
useEffect(() => () => cancelAnimation(pillProgress), [pillProgress]);
|
|
151
152
|
|
|
152
153
|
const animatedPillStyle = useAnimatedStyle(
|
|
153
154
|
() => ({
|
|
@@ -29,11 +29,11 @@ export const resolveGradientColor = (
|
|
|
29
29
|
export const processGradientStops = (
|
|
30
30
|
stops: GradientStop[],
|
|
31
31
|
bgColors: BackgroundColors,
|
|
32
|
-
):
|
|
32
|
+
): {
|
|
33
33
|
color: string;
|
|
34
34
|
offset: number;
|
|
35
35
|
opacity: number;
|
|
36
|
-
}
|
|
36
|
+
}[] => {
|
|
37
37
|
const stopCount = stops.length;
|
|
38
38
|
|
|
39
39
|
return stops.map((stop, index) => {
|
|
@@ -4,6 +4,8 @@ export * from './AmountInput';
|
|
|
4
4
|
export * from './Avatar';
|
|
5
5
|
export * from './Banner';
|
|
6
6
|
export * from './BottomSheet';
|
|
7
|
+
export * from './DotCount';
|
|
8
|
+
export * from './DotIndicator';
|
|
7
9
|
export * from './Button';
|
|
8
10
|
export * from './Card';
|
|
9
11
|
export * from './CardButton';
|