@ledgerhq/lumen-ui-rnative 0.1.36 → 0.1.37

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.
Files changed (159) hide show
  1. package/dist/module/lib/Animations/Pulse/Pulse.mdx +1 -1
  2. package/dist/module/lib/Animations/Spin/Spin.mdx +1 -1
  3. package/dist/module/lib/Components/AddressInput/AddressInput.mdx +1 -1
  4. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js +68 -39
  5. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js.map +1 -1
  6. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
  7. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js +24 -0
  8. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js.map +1 -1
  9. package/dist/module/lib/Components/AmountDisplay/types.js.map +1 -1
  10. package/dist/module/lib/Components/AmountInput/AmountInput.mdx +1 -1
  11. package/dist/module/lib/Components/Avatar/Avatar.mdx +1 -1
  12. package/dist/module/lib/Components/Banner/Banner.mdx +1 -1
  13. package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
  14. package/dist/module/lib/Components/Button/Button.mdx +1 -1
  15. package/dist/module/lib/Components/Card/Card.stories.js +4 -9
  16. package/dist/module/lib/Components/Card/Card.stories.js.map +1 -1
  17. package/dist/module/lib/Components/CardButton/CardButton.mdx +1 -1
  18. package/dist/module/lib/Components/Checkbox/Checkbox.mdx +1 -1
  19. package/dist/module/lib/Components/Divider/Divider.mdx +1 -1
  20. package/dist/module/lib/Components/DotIcon/DotIcon.js +44 -23
  21. package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
  22. package/dist/module/lib/Components/DotIcon/DotIcon.mdx +92 -0
  23. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +47 -0
  24. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
  25. package/dist/module/lib/Components/DotSymbol/DotSymbol.js +52 -30
  26. package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
  27. package/dist/module/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
  28. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +41 -0
  29. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
  30. package/dist/module/lib/Components/IconButton/IconButton.mdx +1 -1
  31. package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
  32. package/dist/module/lib/Components/Link/Link.mdx +1 -1
  33. package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
  34. package/dist/module/lib/Components/MediaButton/MediaButton.js +17 -17
  35. package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -1
  36. package/dist/module/lib/Components/MediaButton/MediaButton.mdx +3 -3
  37. package/dist/module/lib/Components/MediaButton/MediaButton.stories.js +17 -17
  38. package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -1
  39. package/dist/module/lib/Components/MediaButton/MediaButton.test.js +4 -4
  40. package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -1
  41. package/dist/module/lib/Components/MediaImage/MediaImage.js +20 -4
  42. package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
  43. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +35 -0
  44. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
  45. package/dist/module/lib/Components/NavBar/CoinCapsule.js +2 -2
  46. package/dist/module/lib/Components/NavBar/CoinCapsule.js.map +1 -1
  47. package/dist/module/lib/Components/NavBar/NavBar.js +2 -2
  48. package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
  49. package/dist/module/lib/Components/NavBar/NavBar.mdx +2 -2
  50. package/dist/module/lib/Components/NavBar/NavBar.stories.js +1 -1
  51. package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
  52. package/dist/module/lib/Components/NavBar/NavBar.test.js +3 -3
  53. package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
  54. package/dist/module/lib/Components/OptionList/OptionList.stories.js +4 -4
  55. package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
  56. package/dist/module/lib/Components/PageIndicator/PageIndicator.js +13 -8
  57. package/dist/module/lib/Components/PageIndicator/PageIndicator.js.map +1 -1
  58. package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js +58 -0
  59. package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
  60. package/dist/module/lib/Components/SearchInput/SearchInput.mdx +1 -1
  61. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
  62. package/dist/module/lib/Components/Select/Select.mdx +1 -1
  63. package/dist/module/lib/Components/Spinner/Spinner.mdx +1 -1
  64. package/dist/module/lib/Components/Spot/Spot.mdx +1 -1
  65. package/dist/module/lib/Components/Stepper/Stepper.mdx +1 -1
  66. package/dist/module/lib/Components/Subheader/Subheader.mdx +1 -1
  67. package/dist/module/lib/Components/Switch/Switch.mdx +1 -1
  68. package/dist/module/lib/Components/TabBar/TabBar.mdx +1 -1
  69. package/dist/module/lib/Components/TextInput/TextInput.mdx +1 -1
  70. package/dist/module/lib/Components/Tile/Tile.mdx +1 -1
  71. package/dist/module/lib/Components/Tooltip/Tooltip.mdx +1 -1
  72. package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
  73. package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  74. package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts +1 -1
  75. package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts.map +1 -1
  76. package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts +10 -3
  77. package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  78. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +1 -1
  79. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
  80. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +6 -0
  81. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
  82. package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
  83. package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
  84. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +6 -0
  85. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
  86. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +3 -3
  87. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
  88. package/dist/typescript/src/lib/Components/MediaButton/types.d.ts +6 -6
  89. package/dist/typescript/src/lib/Components/MediaButton/types.d.ts.map +1 -1
  90. package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +1 -1
  91. package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
  92. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +6 -0
  93. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
  94. package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts +1 -1
  95. package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
  96. package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts +1 -1
  97. package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts.map +1 -1
  98. package/dist/typescript/src/lib/Components/NavBar/types.d.ts +3 -3
  99. package/dist/typescript/src/lib/Components/NavBar/types.d.ts.map +1 -1
  100. package/dist/typescript/src/lib/Components/PageIndicator/PageIndicator.d.ts.map +1 -1
  101. package/package.json +3 -3
  102. package/src/lib/Animations/Pulse/Pulse.mdx +1 -1
  103. package/src/lib/Animations/Spin/Spin.mdx +1 -1
  104. package/src/lib/Components/AddressInput/AddressInput.mdx +1 -1
  105. package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
  106. package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +18 -0
  107. package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +71 -40
  108. package/src/lib/Components/AmountDisplay/index.ts +5 -1
  109. package/src/lib/Components/AmountDisplay/types.ts +12 -3
  110. package/src/lib/Components/AmountInput/AmountInput.mdx +1 -1
  111. package/src/lib/Components/Avatar/Avatar.mdx +1 -1
  112. package/src/lib/Components/Banner/Banner.mdx +1 -1
  113. package/src/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
  114. package/src/lib/Components/Button/Button.mdx +1 -1
  115. package/src/lib/Components/Card/Card.stories.tsx +1 -3
  116. package/src/lib/Components/CardButton/CardButton.mdx +1 -1
  117. package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
  118. package/src/lib/Components/Divider/Divider.mdx +1 -1
  119. package/src/lib/Components/DotIcon/DotIcon.mdx +92 -0
  120. package/src/lib/Components/DotIcon/DotIcon.stories.tsx +35 -0
  121. package/src/lib/Components/DotIcon/DotIcon.tsx +31 -14
  122. package/src/lib/Components/DotIcon/types.ts +6 -0
  123. package/src/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
  124. package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +17 -0
  125. package/src/lib/Components/DotSymbol/DotSymbol.tsx +42 -24
  126. package/src/lib/Components/DotSymbol/types.ts +6 -0
  127. package/src/lib/Components/IconButton/IconButton.mdx +1 -1
  128. package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
  129. package/src/lib/Components/Link/Link.mdx +1 -1
  130. package/src/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
  131. package/src/lib/Components/MediaButton/MediaButton.mdx +3 -3
  132. package/src/lib/Components/MediaButton/MediaButton.stories.tsx +29 -15
  133. package/src/lib/Components/MediaButton/MediaButton.test.tsx +4 -4
  134. package/src/lib/Components/MediaButton/MediaButton.tsx +33 -20
  135. package/src/lib/Components/MediaButton/types.ts +6 -6
  136. package/src/lib/Components/MediaImage/MediaImage.stories.tsx +18 -0
  137. package/src/lib/Components/MediaImage/MediaImage.tsx +12 -2
  138. package/src/lib/Components/MediaImage/types.ts +6 -0
  139. package/src/lib/Components/NavBar/CoinCapsule.tsx +2 -2
  140. package/src/lib/Components/NavBar/NavBar.mdx +2 -2
  141. package/src/lib/Components/NavBar/NavBar.stories.tsx +3 -1
  142. package/src/lib/Components/NavBar/NavBar.test.tsx +3 -3
  143. package/src/lib/Components/NavBar/NavBar.tsx +2 -2
  144. package/src/lib/Components/NavBar/types.ts +3 -3
  145. package/src/lib/Components/OptionList/OptionList.stories.tsx +4 -4
  146. package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +78 -0
  147. package/src/lib/Components/PageIndicator/PageIndicator.tsx +15 -7
  148. package/src/lib/Components/SearchInput/SearchInput.mdx +1 -1
  149. package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
  150. package/src/lib/Components/Select/Select.mdx +1 -1
  151. package/src/lib/Components/Spinner/Spinner.mdx +1 -1
  152. package/src/lib/Components/Spot/Spot.mdx +1 -1
  153. package/src/lib/Components/Stepper/Stepper.mdx +1 -1
  154. package/src/lib/Components/Subheader/Subheader.mdx +1 -1
  155. package/src/lib/Components/Switch/Switch.mdx +1 -1
  156. package/src/lib/Components/TabBar/TabBar.mdx +1 -1
  157. package/src/lib/Components/TextInput/TextInput.mdx +1 -1
  158. package/src/lib/Components/Tile/Tile.mdx +1 -1
  159. package/src/lib/Components/Tooltip/Tooltip.mdx +1 -1
@@ -1,3 +1,4 @@
1
+ import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
1
2
  import { useEffect, useState } from 'react';
2
3
  import { Image, StyleSheet } from 'react-native';
3
4
  import { useStyleSheet } from '../../../styles';
@@ -36,9 +37,11 @@ export const fontSizeMap: Record<MediaImageSize, number> = {
36
37
  const useStyles = ({
37
38
  size,
38
39
  shape,
40
+ disabled,
39
41
  }: {
40
42
  size: MediaImageSize;
41
43
  shape: MediaImageShape;
44
+ disabled: boolean;
42
45
  }) => {
43
46
  return useStyleSheet(
44
47
  (t) => {
@@ -61,6 +64,7 @@ const useStyles = ({
61
64
  outlineWidth: 1,
62
65
  outlineOffset: -1,
63
66
  outlineStyle: 'solid',
67
+ ...(disabled && { opacity: 0.3 }),
64
68
  },
65
69
  image: {
66
70
  width: '100%',
@@ -72,7 +76,7 @@ const useStyles = ({
72
76
  },
73
77
  };
74
78
  },
75
- [size, shape],
79
+ [size, shape, disabled],
76
80
  );
77
81
  };
78
82
 
@@ -99,6 +103,7 @@ export const MediaImage = ({
99
103
  shape = 'square',
100
104
  fallback,
101
105
  loading = false,
106
+ disabled: disabledProp = false,
102
107
  lx = {},
103
108
  style,
104
109
  ref,
@@ -106,7 +111,11 @@ export const MediaImage = ({
106
111
  }: MediaImageProps) => {
107
112
  const [error, setError] = useState(false);
108
113
  const shouldFallback = !src || error;
109
- const styles = useStyles({ size, shape });
114
+ const disabled = useDisabledContext({
115
+ consumerName: 'MediaImage',
116
+ mergeWith: { disabled: disabledProp },
117
+ });
118
+ const styles = useStyles({ size, shape, disabled });
110
119
 
111
120
  useEffect(() => {
112
121
  setError(false);
@@ -119,6 +128,7 @@ export const MediaImage = ({
119
128
  style={StyleSheet.flatten([styles.root, style])}
120
129
  accessibilityRole='image'
121
130
  accessibilityLabel={alt}
131
+ accessibilityState={{ disabled }}
122
132
  {...props}
123
133
  >
124
134
  {loading && <Skeleton style={styles.skeleton} />}
@@ -36,4 +36,10 @@ export type MediaImageProps = {
36
36
  * @default false
37
37
  */
38
38
  loading?: boolean;
39
+ /**
40
+ * Shows a disabled appearance.
41
+ * @optional
42
+ * @default false
43
+ */
44
+ disabled?: boolean;
39
45
  } & Omit<StyledViewProps, 'children'>;
@@ -2,12 +2,12 @@ import { useStyleSheet } from '../../../styles';
2
2
  import { Box, Text } from '../Utility';
3
3
  import type { CoinCapsuleProps } from './types';
4
4
 
5
- export function CoinCapsule({ ticker, icon }: CoinCapsuleProps) {
5
+ export function CoinCapsule({ ticker, leadingContent }: CoinCapsuleProps) {
6
6
  const styles = useStyles();
7
7
 
8
8
  return (
9
9
  <Box style={styles.container}>
10
- {icon}
10
+ {leadingContent}
11
11
  <Text style={styles.text}>{ticker}</Text>
12
12
  </Box>
13
13
  );
@@ -7,7 +7,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
7
7
 
8
8
  <Meta title='Navigation/NavBar' of={NavBarStories} />
9
9
 
10
- # 🧭 NavBar
10
+ # NavBar
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">
@@ -135,7 +135,7 @@ import { NavBarCoinCapsule } from '@ledgerhq/lumen-ui-rnative';
135
135
  <NavBarContent>
136
136
  <NavBarCoinCapsule
137
137
  ticker='BTC'
138
- icon={<Icon ledgerId='bitcoin' ticker='BTC' size={24} />}
138
+ leadingContent={<Icon ledgerId='bitcoin' ticker='BTC' size={24} />}
139
139
  />
140
140
  <NavBarTitle>Bitcoin</NavBarTitle>
141
141
  </NavBarContent>
@@ -111,7 +111,9 @@ export const WithCoinCapsule: Story = {
111
111
  <NavBarContent>
112
112
  <NavBarCoinCapsule
113
113
  ticker='BTC'
114
- icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={24} />}
114
+ leadingContent={
115
+ <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={24} />
116
+ }
115
117
  />
116
118
  </NavBarContent>
117
119
  <NavBarTrailing>
@@ -69,7 +69,7 @@ describe('NavBar', () => {
69
69
  renderWithProvider(
70
70
  <NavBar testID='navbar' density='compact'>
71
71
  <NavBarContent>
72
- <NavBarCoinCapsule ticker='BTC' icon={<MockIcon />} />
72
+ <NavBarCoinCapsule ticker='BTC' leadingContent={<MockIcon />} />
73
73
  </NavBarContent>
74
74
  </NavBar>,
75
75
  );
@@ -252,11 +252,11 @@ describe('NavBar', () => {
252
252
  });
253
253
 
254
254
  describe('NavBarCoinCapsule', () => {
255
- it('should render ticker and icon', () => {
255
+ it('should render ticker and leading content', () => {
256
256
  renderWithProvider(
257
257
  <NavBar density='compact'>
258
258
  <NavBarContent>
259
- <NavBarCoinCapsule ticker='ETH' icon={<MockIcon />} />
259
+ <NavBarCoinCapsule ticker='ETH' leadingContent={<MockIcon />} />
260
260
  </NavBarContent>
261
261
  </NavBar>,
262
262
  );
@@ -122,12 +122,12 @@ export function NavBarDescription({
122
122
 
123
123
  export function NavBarCoinCapsule({
124
124
  ticker,
125
- icon,
125
+ leadingContent,
126
126
  ...props
127
127
  }: NavBarCoinCapsuleProps) {
128
128
  return (
129
129
  <Box {...props}>
130
- <CoinCapsule ticker={ticker} icon={icon} />
130
+ <CoinCapsule ticker={ticker} leadingContent={leadingContent} />
131
131
  </Box>
132
132
  );
133
133
  }
@@ -1,5 +1,5 @@
1
1
  import type { Density } from '@ledgerhq/lumen-utils-shared';
2
- import type { ReactElement, ReactNode } from 'react';
2
+ import type { ReactNode } from 'react';
3
3
  import type { StyledViewProps } from '../../../styles';
4
4
  import type { IconButtonProps } from '../IconButton';
5
5
 
@@ -57,9 +57,9 @@ export type CoinCapsuleProps = {
57
57
  */
58
58
  ticker: string;
59
59
  /**
60
- * The icon element to display (typically a crypto coin icon).
60
+ * The leading content, typically a crypto coin icon.
61
61
  */
62
- icon: ReactElement;
62
+ leadingContent: ReactNode;
63
63
  } & Omit<StyledViewProps, 'children'>;
64
64
 
65
65
  /**
@@ -865,8 +865,8 @@ export const TriggerShowcase: Story = {
865
865
  <MediaButton
866
866
  appearance='gray'
867
867
  onPress={() => iconRef.current?.present()}
868
- icon={<Settings size={20} />}
869
- iconType='flat'
868
+ leadingContent={<Settings size={20} />}
869
+ leadingContentShape='flat'
870
870
  >
871
871
  {selectedIcon?.label ?? 'Settings'}
872
872
  </MediaButton>
@@ -874,7 +874,7 @@ export const TriggerShowcase: Story = {
874
874
  <MediaButton
875
875
  appearance='gray'
876
876
  onPress={() => cryptoRef.current?.present()}
877
- icon={
877
+ leadingContent={
878
878
  selectedCrypto?.meta ? (
879
879
  <CryptoIcon
880
880
  ledgerId={selectedCrypto.meta.ledgerId as string}
@@ -883,7 +883,7 @@ export const TriggerShowcase: Story = {
883
883
  />
884
884
  ) : undefined
885
885
  }
886
- iconType='rounded'
886
+ leadingContentShape='rounded'
887
887
  >
888
888
  {selectedCrypto?.label ?? 'Network'}
889
889
  </MediaButton>
@@ -15,6 +15,12 @@ const renderWithProvider = (component: React.ReactElement) => {
15
15
  );
16
16
  };
17
17
 
18
+ const wrapWithProvider = (component: React.ReactElement) => (
19
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
20
+ {component}
21
+ </ThemeProvider>
22
+ );
23
+
18
24
  describe('PageIndicator Component', () => {
19
25
  describe('Rendering', () => {
20
26
  it('should render with required props', () => {
@@ -161,6 +167,78 @@ describe('PageIndicator Component', () => {
161
167
  });
162
168
  });
163
169
 
170
+ describe('Re-rendering', () => {
171
+ // Regression: dot/strip styles must update when currentPage changes.
172
+ // One bug has produced the same broken-on-update symptom:
173
+ // 1. Wrapping in Animated.createAnimatedComponent(Box) — Box flattens
174
+ // style arrays via StyleSheet.flatten, which snapshots reanimated
175
+ // animated styles and stops updates.
176
+ // Initial render looked correct in both cases — only re-render exposed
177
+ // the issue, which is what the tests below exercise.
178
+ it('updates the rendered tree when currentPage changes', () => {
179
+ const { rerender } = renderWithProvider(
180
+ <PageIndicator
181
+ testID='page-indicator'
182
+ currentPage={1}
183
+ totalPages={5}
184
+ />,
185
+ );
186
+ const treeBefore = JSON.stringify(screen.toJSON());
187
+
188
+ rerender(
189
+ wrapWithProvider(
190
+ <PageIndicator
191
+ testID='page-indicator'
192
+ currentPage={3}
193
+ totalPages={5}
194
+ />,
195
+ ),
196
+ );
197
+ const treeAfter = JSON.stringify(screen.toJSON());
198
+
199
+ expect(treeAfter).not.toEqual(treeBefore);
200
+ });
201
+
202
+ it('updates the active dot style when currentPage changes', () => {
203
+ type Node = {
204
+ type: string;
205
+ props: { style?: unknown };
206
+ children: Node[] | null;
207
+ };
208
+ const getDotStyles = (): unknown[] => {
209
+ const root = screen.toJSON() as Node | null;
210
+ if (!root?.children) throw new Error('Expected container children');
211
+ const viewport = root.children[0];
212
+ if (!viewport?.children) throw new Error('Expected viewport children');
213
+ const strip = viewport.children[0];
214
+ if (!strip?.children) throw new Error('Expected strip children');
215
+ return strip.children.map((dot) => dot.props.style);
216
+ };
217
+
218
+ const { rerender } = renderWithProvider(
219
+ <PageIndicator
220
+ testID='page-indicator'
221
+ currentPage={1}
222
+ totalPages={5}
223
+ />,
224
+ );
225
+ const stylesBefore = JSON.stringify(getDotStyles());
226
+
227
+ rerender(
228
+ wrapWithProvider(
229
+ <PageIndicator
230
+ testID='page-indicator'
231
+ currentPage={3}
232
+ totalPages={5}
233
+ />,
234
+ ),
235
+ );
236
+ const stylesAfter = JSON.stringify(getDotStyles());
237
+
238
+ expect(stylesAfter).not.toEqual(stylesBefore);
239
+ });
240
+ });
241
+
164
242
  describe('Props', () => {
165
243
  it('should accept ref prop', () => {
166
244
  const ref = createRef<ComponentRef<typeof PageIndicator>>();
@@ -12,7 +12,6 @@ import { useTimingConfig } from '../../Animations/useTimingConfig';
12
12
  import { Box } from '../Utility';
13
13
  import type { PageIndicatorProps } from './types';
14
14
 
15
- const AnimatedBox = Animated.createAnimatedComponent(Box);
16
15
  const MAX_VISIBLE_DOTS = 4;
17
16
 
18
17
  const useDotAnimation = ({
@@ -33,14 +32,20 @@ const useDotAnimation = ({
33
32
 
34
33
  useEffect(() => {
35
34
  colorProgress.value = withTiming(isActive ? 1 : 0, timingConfig);
36
- return () => cancelAnimation(colorProgress);
37
35
  }, [isActive, colorProgress, timingConfig]);
38
36
 
37
+ useEffect(() => {
38
+ return () => cancelAnimation(colorProgress);
39
+ }, [colorProgress]);
40
+
39
41
  useEffect(() => {
40
42
  shrinkProgress.value = withTiming(isShrunk ? 1 : 0, timingConfig);
41
- return () => cancelAnimation(shrinkProgress);
42
43
  }, [isShrunk, shrinkProgress, timingConfig]);
43
44
 
45
+ useEffect(() => {
46
+ return () => cancelAnimation(shrinkProgress);
47
+ }, [shrinkProgress]);
48
+
44
49
  const animatedStyle = useAnimatedStyle(() => {
45
50
  const backgroundColor = interpolateColor(
46
51
  colorProgress.value,
@@ -102,8 +107,11 @@ const useStripAnimation = ({
102
107
 
103
108
  useEffect(() => {
104
109
  translateX.value = withTiming(-offset * dotWidth, timingConfig);
110
+ }, [offset, dotWidth, translateX, timingConfig]);
111
+
112
+ useEffect(() => {
105
113
  return () => cancelAnimation(translateX);
106
- }, [currentPage, totalPages, offset, dotWidth, translateX, timingConfig]);
114
+ }, [translateX]);
107
115
 
108
116
  const stripAnimatedStyle = useAnimatedStyle(
109
117
  () => ({
@@ -157,7 +165,7 @@ const PageIndicatorDot = ({
157
165
  const styles = useDotStyles();
158
166
  const { animatedStyle } = useDotAnimation({ isActive, isShrunk });
159
167
 
160
- return <AnimatedBox style={[styles.dot, animatedStyle]} />;
168
+ return <Animated.View style={[styles.dot, animatedStyle]} />;
161
169
  };
162
170
 
163
171
  /**
@@ -202,7 +210,7 @@ export const PageIndicator = ({
202
210
  {...props}
203
211
  >
204
212
  <Box style={[styles.viewport, { width: viewportWidth }]}>
205
- <AnimatedBox style={[styles.strip, stripAnimatedStyle]}>
213
+ <Animated.View style={[styles.strip, stripAnimatedStyle]}>
206
214
  {dotIndexes.map((index) => (
207
215
  <PageIndicatorDot
208
216
  key={index}
@@ -210,7 +218,7 @@ export const PageIndicator = ({
210
218
  isShrunk={isShrunk(index)}
211
219
  />
212
220
  ))}
213
- </AnimatedBox>
221
+ </Animated.View>
214
222
  </Box>
215
223
  </Box>
216
224
  );
@@ -7,7 +7,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
7
7
 
8
8
  <Meta title='Input/SearchInput' of={SearchInputStories} />
9
9
 
10
- # 🔍 SearchInput
10
+ # SearchInput
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">
@@ -7,7 +7,7 @@ import { Box } from '../Utility';
7
7
 
8
8
  <Meta title='Navigation/SegmentedControl' of={SegmentedControlStories} />
9
9
 
10
- # 📑 SegmentedControl
10
+ # SegmentedControl
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">
@@ -5,7 +5,7 @@ import { CustomTabs, Tab } from '../../../../.storybook/components';
5
5
 
6
6
  <Meta title='Selection/Select' of={SelectStories} />
7
7
 
8
- # 📋 Select
8
+ # Select
9
9
 
10
10
  <CustomTabs>
11
11
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Text } from '../Utility/Text';
8
8
 
9
9
  <Meta title='Communication/Spinner/Docs' of={SpinnerStories} />
10
10
 
11
- # 🌀 Spinner
11
+ # Spinner
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
8
8
 
9
9
  <Meta title='Components/Spot' of={SpotStories} />
10
10
 
11
- # 🔵 Spot
11
+ # Spot
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Text } from '../Utility/Text';
8
8
 
9
9
  <Meta title='Communication/Stepper/Docs' of={StepperStories} />
10
10
 
11
- # 🔄 Stepper
11
+ # Stepper
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -21,7 +21,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
21
21
 
22
22
  <Meta title='Components/Subheader' of={SubheaderStories} />
23
23
 
24
- # 🃏 Subheader
24
+ # Subheader
25
25
 
26
26
  <CustomTabs>
27
27
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
8
8
 
9
9
  <Meta title="Components/Switch" of={SwitchStories} />
10
10
 
11
- # ☑️ Switch
11
+ # Switch
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title='Navigation/TabBar' of={TabBarStories} />
10
10
 
11
- # 🔘 TabBar
11
+ # TabBar
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -7,7 +7,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
7
7
 
8
8
  <Meta title='Input/TextInput' of={TextInputStories} />
9
9
 
10
- # ⌨️ TextInput
10
+ # TextInput
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">
@@ -13,7 +13,7 @@ import { Box } from '../Utility';
13
13
 
14
14
  <Meta title='Containment/Tile' of={TileStories} />
15
15
 
16
- # 📋 Tile
16
+ # Tile
17
17
 
18
18
  <CustomTabs>
19
19
  <Tab label="Overview">
@@ -7,7 +7,7 @@ import { Box } from '../Utility/Box';
7
7
 
8
8
  <Meta title='Communication/Tooltip' of={TooltipStories} />
9
9
 
10
- # 💬 Tooltip
10
+ # Tooltip
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">