@ledgerhq/lumen-ui-rnative 0.1.34 → 0.1.36
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/Animations/Pulse/Pulse.js +16 -6
- package/dist/module/lib/Animations/Pulse/Pulse.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +12 -7
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +220 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +73 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js +15 -2
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js +184 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.mdx +139 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js +258 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js +94 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/index.js +5 -0
- package/dist/module/lib/Components/DescriptionItem/index.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/types.js +4 -0
- package/dist/module/lib/Components/DescriptionItem/types.js.map +1 -0
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +5 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/NavBar/CoinCapsule.js +1 -0
- package/dist/module/lib/Components/NavBar/CoinCapsule.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.js +45 -4
- package/dist/module/lib/Components/OptionList/OptionList.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.mdx +19 -0
- package/dist/module/lib/Components/OptionList/OptionList.stories.js +254 -1
- package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.test.js +136 -1
- package/dist/module/lib/Components/OptionList/OptionList.test.js.map +1 -1
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js +39 -13
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js.map +1 -1
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js +117 -2
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/Skeleton/Skeleton.js +10 -3
- package/dist/module/lib/Components/Skeleton/Skeleton.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +7 -6
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/index.js +1 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/styles/lx/resolveStyle.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/Animations/Pulse/Pulse.d.ts +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/types.d.ts +2 -1
- package/dist/typescript/src/lib/Animations/Pulse/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts +5 -2
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +16 -3
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts +42 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts +39 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +3 -3
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts +3 -2
- package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/types.d.ts +42 -5
- package/dist/typescript/src/lib/Components/OptionList/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts +9 -1
- package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/types/index.d.ts +3 -3
- package/dist/typescript/src/lib/types/index.d.ts.map +1 -1
- package/dist/typescript/src/styles/lx/resolveStyle.d.ts +3 -3
- package/dist/typescript/src/styles/lx/resolveStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/Animations/Pulse/Pulse.tsx +38 -30
- package/src/lib/Animations/Pulse/types.ts +2 -1
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +174 -1
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +59 -0
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +19 -7
- package/src/lib/Components/BottomSheet/BottomSheetHeader.tsx +1 -1
- package/src/lib/Components/BottomSheet/CustomHandle.tsx +26 -5
- package/src/lib/Components/BottomSheet/types.ts +24 -3
- package/src/lib/Components/Card/Card.tsx +3 -3
- package/src/lib/Components/DescriptionItem/DescriptionItem.mdx +139 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.stories.tsx +234 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.test.tsx +112 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.tsx +224 -0
- package/src/lib/Components/DescriptionItem/index.ts +2 -0
- package/src/lib/Components/DescriptionItem/types.ts +44 -0
- package/src/lib/Components/ListItem/ListItem.tsx +3 -3
- package/src/lib/Components/MediaImage/MediaImage.tsx +5 -1
- package/src/lib/Components/NavBar/CoinCapsule.tsx +1 -0
- package/src/lib/Components/OptionList/OptionList.mdx +19 -0
- package/src/lib/Components/OptionList/OptionList.stories.tsx +254 -0
- package/src/lib/Components/OptionList/OptionList.test.tsx +143 -0
- package/src/lib/Components/OptionList/OptionList.tsx +49 -3
- package/src/lib/Components/OptionList/types.ts +46 -5
- package/src/lib/Components/OptionList/useOptionList/useOptionListItems.test.ts +124 -2
- package/src/lib/Components/OptionList/useOptionList/useOptionListItems.ts +53 -10
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +2 -1
- package/src/lib/Components/Skeleton/Skeleton.tsx +9 -5
- package/src/lib/Components/TabBar/TabBar.tsx +3 -2
- package/src/lib/Components/index.ts +1 -0
- package/src/lib/types/index.ts +3 -3
- package/src/styles/lx/resolveStyle.ts +4 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe, it, expect } from '@jest/globals';
|
|
2
|
-
import { renderHook } from '@testing-library/react-native';
|
|
1
|
+
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
|
+
import { renderHook, act } from '@testing-library/react-native';
|
|
3
3
|
import type { OptionListItemData } from '../types';
|
|
4
4
|
import { useOptionListItems } from './useOptionListItems';
|
|
5
5
|
|
|
@@ -70,4 +70,126 @@ describe('useOptionListItems', () => {
|
|
|
70
70
|
expect(result.current.groups[1].label).toBe('Fruits');
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
+
|
|
74
|
+
describe('filtering', () => {
|
|
75
|
+
it('applies the default case-insensitive label filter', () => {
|
|
76
|
+
const { result } = renderHook(() =>
|
|
77
|
+
useOptionListItems({ items: [btc, eth] }),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
act(() => {
|
|
81
|
+
result.current.handleSearchValueChange('BITCOIN');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(result.current.flatItems).toEqual([btc]);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('filters within groups and removes empty groups', () => {
|
|
88
|
+
const { result } = renderHook(() =>
|
|
89
|
+
useOptionListItems({ items: [apple, banana, carrot, spinach] }),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
act(() => {
|
|
93
|
+
result.current.handleSearchValueChange('apple');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
expect(result.current.groups).toEqual([
|
|
97
|
+
{ label: 'Fruits', items: [apple] },
|
|
98
|
+
]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('uses a custom filter when provided', () => {
|
|
102
|
+
const customFilter = (item: OptionListItemData, query: string): boolean =>
|
|
103
|
+
item.value.startsWith(query);
|
|
104
|
+
|
|
105
|
+
const { result } = renderHook(() =>
|
|
106
|
+
useOptionListItems({ items: [btc, eth], filter: customFilter }),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
act(() => {
|
|
110
|
+
result.current.handleSearchValueChange('et');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
expect(result.current.flatItems).toEqual([eth]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('disables filtering when filter is null', () => {
|
|
117
|
+
const { result } = renderHook(() =>
|
|
118
|
+
useOptionListItems({ items: [btc, eth], filter: null }),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
act(() => {
|
|
122
|
+
result.current.handleSearchValueChange('bitcoin');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
expect(result.current.flatItems).toEqual([btc, eth]);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('returns all items when the query is whitespace-only', () => {
|
|
129
|
+
const { result } = renderHook(() =>
|
|
130
|
+
useOptionListItems({ items: [btc, eth] }),
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
act(() => {
|
|
134
|
+
result.current.handleSearchValueChange(' ');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
expect(result.current.flatItems).toEqual([btc, eth]);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('external filteredItems', () => {
|
|
142
|
+
it('uses filteredItems instead of internal filtering', () => {
|
|
143
|
+
const { result } = renderHook(() =>
|
|
144
|
+
useOptionListItems({
|
|
145
|
+
items: [btc, eth],
|
|
146
|
+
filteredItems: [eth],
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(result.current.flatItems).toEqual([eth]);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('groups filteredItems when items are grouped', () => {
|
|
154
|
+
const { result } = renderHook(() =>
|
|
155
|
+
useOptionListItems({
|
|
156
|
+
items: [apple, banana, carrot],
|
|
157
|
+
filteredItems: [apple, carrot],
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
expect(result.current.isGrouped).toBe(true);
|
|
162
|
+
expect(result.current.groups).toEqual([
|
|
163
|
+
{ label: 'Fruits', items: [apple] },
|
|
164
|
+
{ label: 'Vegetables', items: [carrot] },
|
|
165
|
+
]);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe('searchValue', () => {
|
|
170
|
+
it('calls onSearchValueChange with the new value', () => {
|
|
171
|
+
const onSearchValueChange = jest.fn();
|
|
172
|
+
const { result } = renderHook(() =>
|
|
173
|
+
useOptionListItems({ items: [btc, eth], onSearchValueChange }),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
act(() => {
|
|
177
|
+
result.current.handleSearchValueChange('test');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
expect(onSearchValueChange).toHaveBeenCalledWith('test');
|
|
181
|
+
expect(result.current.resolvedSearchValue).toBe('test');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('uses defaultSearchValue as the initial uncontrolled value', () => {
|
|
185
|
+
const { result } = renderHook(() =>
|
|
186
|
+
useOptionListItems({
|
|
187
|
+
items: [btc, eth],
|
|
188
|
+
defaultSearchValue: 'default',
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
expect(result.current.resolvedSearchValue).toBe('default');
|
|
193
|
+
});
|
|
194
|
+
});
|
|
73
195
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { useControllableState } from '../../../utils/useControllableState';
|
|
2
3
|
import type {
|
|
3
4
|
MetaShape,
|
|
4
5
|
OptionListItemData,
|
|
@@ -24,26 +25,68 @@ const groupByField = <TMeta extends MetaShape = MetaShape>(
|
|
|
24
25
|
const hasGroups = (items: OptionListItemData[]): boolean =>
|
|
25
26
|
items.some((item) => item.group != null);
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return isGrouped
|
|
32
|
-
? { isGrouped: true, groups: groupByField(items), flatItems: [] }
|
|
33
|
-
: { isGrouped: false, groups: [], flatItems: items };
|
|
34
|
-
};
|
|
28
|
+
export const defaultLabelFilter = (
|
|
29
|
+
item: OptionListItemData,
|
|
30
|
+
query: string,
|
|
31
|
+
): boolean => item.label.toLowerCase().includes(query.toLowerCase());
|
|
35
32
|
|
|
36
33
|
type UseOptionListItemsParams<TMeta extends MetaShape = MetaShape> = {
|
|
37
34
|
items: OptionListItemData<TMeta>[];
|
|
35
|
+
filter?: null | ((item: OptionListItemData<TMeta>, query: string) => boolean);
|
|
36
|
+
filteredItems?: OptionListItemData<TMeta>[];
|
|
37
|
+
searchValue?: string;
|
|
38
|
+
defaultSearchValue?: string;
|
|
39
|
+
onSearchValueChange?: (value: string) => void;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
type UseOptionListItemsResult<TMeta extends MetaShape = MetaShape> = {
|
|
41
43
|
isGrouped: boolean;
|
|
42
44
|
groups: OptionListItemGroup<TMeta>[];
|
|
43
45
|
flatItems: OptionListItemData<TMeta>[];
|
|
46
|
+
resolvedSearchValue: string;
|
|
47
|
+
handleSearchValueChange: (val: string) => void;
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
export const useOptionListItems = <TMeta extends MetaShape = MetaShape>({
|
|
47
51
|
items,
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
filter,
|
|
53
|
+
filteredItems,
|
|
54
|
+
searchValue: searchValueProp,
|
|
55
|
+
defaultSearchValue,
|
|
56
|
+
onSearchValueChange,
|
|
57
|
+
}: UseOptionListItemsParams<TMeta>): UseOptionListItemsResult<TMeta> => {
|
|
58
|
+
const [searchValue, handleSearchValueChange] = useControllableState<string>({
|
|
59
|
+
prop: searchValueProp,
|
|
60
|
+
defaultProp: defaultSearchValue ?? '',
|
|
61
|
+
onChange: onSearchValueChange,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const isGrouped = useMemo(() => hasGroups(items), [items]);
|
|
65
|
+
|
|
66
|
+
const visibleItems = useMemo(() => {
|
|
67
|
+
if (filteredItems) {
|
|
68
|
+
return filteredItems;
|
|
69
|
+
}
|
|
70
|
+
const query = searchValue.trim();
|
|
71
|
+
const activeFilter = filter === undefined ? defaultLabelFilter : filter;
|
|
72
|
+
if (!activeFilter || !query) {
|
|
73
|
+
return items;
|
|
74
|
+
}
|
|
75
|
+
return items.filter((item) => activeFilter(item, query));
|
|
76
|
+
}, [items, filteredItems, filter, searchValue]);
|
|
77
|
+
|
|
78
|
+
const groups = useMemo(() => {
|
|
79
|
+
if (!isGrouped) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
return groupByField(visibleItems);
|
|
83
|
+
}, [isGrouped, visibleItems]);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
isGrouped,
|
|
87
|
+
groups,
|
|
88
|
+
flatItems: isGrouped ? [] : visibleItems,
|
|
89
|
+
resolvedSearchValue: searchValue,
|
|
90
|
+
handleSearchValueChange,
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -2,6 +2,7 @@ import { describe, expect, it } from '@jest/globals';
|
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import { render, screen } from '@testing-library/react-native';
|
|
4
4
|
|
|
5
|
+
import type { ComponentRef } from 'react';
|
|
5
6
|
import { createRef } from 'react';
|
|
6
7
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
7
8
|
import { PageIndicator } from './PageIndicator';
|
|
@@ -162,7 +163,7 @@ describe('PageIndicator Component', () => {
|
|
|
162
163
|
|
|
163
164
|
describe('Props', () => {
|
|
164
165
|
it('should accept ref prop', () => {
|
|
165
|
-
const ref = createRef<
|
|
166
|
+
const ref = createRef<ComponentRef<typeof PageIndicator>>();
|
|
166
167
|
renderWithProvider(
|
|
167
168
|
<PageIndicator
|
|
168
169
|
ref={ref}
|
|
@@ -110,22 +110,26 @@ const componentsMap = {
|
|
|
110
110
|
* // Tile variant
|
|
111
111
|
* <Skeleton component='tile' />
|
|
112
112
|
*/
|
|
113
|
-
const Skeleton = ({ lx, component, ...props }: SkeletonProps) => {
|
|
113
|
+
const Skeleton = ({ lx, component, style, ...props }: SkeletonProps) => {
|
|
114
114
|
/**
|
|
115
115
|
* Check if the component is a valid pre-built variant and return the corresponding component.
|
|
116
116
|
*/
|
|
117
117
|
if (component && componentsMap[component]) {
|
|
118
118
|
const Component = componentsMap[component];
|
|
119
119
|
return (
|
|
120
|
-
<Pulse animate>
|
|
121
|
-
<Component {...props}
|
|
120
|
+
<Pulse animate style={style} lx={lx}>
|
|
121
|
+
<Component {...props} />
|
|
122
122
|
</Pulse>
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
return (
|
|
127
|
-
<Pulse animate>
|
|
128
|
-
<BaseSkeleton
|
|
127
|
+
<Pulse animate style={style} lx={lx}>
|
|
128
|
+
<BaseSkeleton
|
|
129
|
+
testID='skeleton'
|
|
130
|
+
lx={{ width: 'full', height: 'full' }}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
129
133
|
</Pulse>
|
|
130
134
|
);
|
|
131
135
|
};
|
|
@@ -2,7 +2,7 @@ import { BlurView } from '@sbaiahmed1/react-native-blur';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { Children, isValidElement, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import type { LayoutChangeEvent } from 'react-native';
|
|
5
|
-
import {
|
|
5
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
6
6
|
import Animated, {
|
|
7
7
|
cancelAnimation,
|
|
8
8
|
useAnimatedStyle,
|
|
@@ -15,6 +15,7 @@ import { useStyleSheet, useTheme } from '../../../styles';
|
|
|
15
15
|
import { useTimingConfig } from '../../Animations/useTimingConfig';
|
|
16
16
|
import { triggerHapticFeedback } from '../../Haptics';
|
|
17
17
|
import { Placeholder } from '../../Symbols';
|
|
18
|
+
import { RuntimeConstants } from '../../utils';
|
|
18
19
|
import { Box, Pressable } from '../Utility';
|
|
19
20
|
import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
|
|
20
21
|
import type { TabBarItemProps, TabBarProps } from './types';
|
|
@@ -268,7 +269,7 @@ export function TabBar({
|
|
|
268
269
|
{...props}
|
|
269
270
|
>
|
|
270
271
|
{children}
|
|
271
|
-
{
|
|
272
|
+
{RuntimeConstants.isAndroid ? (
|
|
272
273
|
<View style={styles.fallbackBackground} />
|
|
273
274
|
) : (
|
|
274
275
|
<BlurView
|
package/src/lib/types/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ElementType, ComponentPropsWithRef,
|
|
1
|
+
import type { ElementType, ComponentPropsWithRef, ComponentRef } from 'react';
|
|
2
2
|
import type { Pressable, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
type ComponentPropsWithAsChild<T extends ElementType<any>> =
|
|
5
5
|
ComponentPropsWithRef<T> & { asChild?: boolean };
|
|
6
6
|
|
|
7
7
|
type SlottableViewProps = ComponentPropsWithAsChild<typeof View>;
|
|
8
|
-
type ViewRef =
|
|
9
|
-
type PressableRef =
|
|
8
|
+
type ViewRef = ComponentRef<typeof View>;
|
|
9
|
+
type PressableRef = ComponentRef<typeof Pressable>;
|
|
10
10
|
|
|
11
11
|
type SlottablePressableProps = ComponentPropsWithAsChild<typeof Pressable> & {
|
|
12
12
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getObjectPath } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
4
|
import { useTheme } from '../hooks/useTheme';
|
|
4
5
|
import type {
|
|
5
6
|
LumenStyleSheetTheme,
|
|
@@ -46,7 +47,7 @@ const resolveStyle = <T extends ViewStyle | TextStyle>(
|
|
|
46
47
|
*/
|
|
47
48
|
export const useResolveViewStyle = (
|
|
48
49
|
lx: LumenViewStyle,
|
|
49
|
-
bareStyle?: ViewStyle
|
|
50
|
+
bareStyle?: StyleProp<ViewStyle>,
|
|
50
51
|
): ViewStyle => {
|
|
51
52
|
const { theme } = useTheme();
|
|
52
53
|
const resolvedStyle = resolveStyle<ViewStyle>(theme, lx, VIEW_PROP_CONFIG);
|
|
@@ -58,7 +59,7 @@ export const useResolveViewStyle = (
|
|
|
58
59
|
*/
|
|
59
60
|
export const useResolveTextStyle = (
|
|
60
61
|
lx: LumenTextStyle,
|
|
61
|
-
bareStyle?: TextStyle
|
|
62
|
+
bareStyle?: StyleProp<TextStyle>,
|
|
62
63
|
): TextStyle => {
|
|
63
64
|
const { theme } = useTheme();
|
|
64
65
|
const resolvedStyle = resolveStyle<TextStyle>(theme, lx, TEXT_PROP_CONFIG);
|