@applicaster/zapp-react-native-ui-components 16.0.0-alpha.1020865559 → 16.0.0-alpha.1035454037

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 (91) hide show
  1. package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +19 -0
  2. package/Components/AudioPlayer/tv/__tests__/index.test.tsx +120 -0
  3. package/Components/AudioPlayer/tv/index.tsx +5 -1
  4. package/Components/Cell/Cell.tsx +3 -6
  5. package/Components/Cell/TvOSCellComponent.tsx +0 -1
  6. package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
  7. package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
  8. package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +64 -0
  9. package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
  10. package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +18 -0
  11. package/Components/LinkHandler/LinkHandler.tsx +2 -7
  12. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
  13. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
  14. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
  15. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
  16. package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +2 -4
  17. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -3
  18. package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
  19. package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
  20. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
  21. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -2
  22. package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +56 -0
  23. package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
  24. package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +24 -0
  25. package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
  26. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +61 -0
  27. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +87 -97
  28. package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +87 -126
  29. package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +140 -83
  30. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +252 -123
  31. package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +205 -0
  32. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +113 -0
  33. package/Components/ModalComponent/AudioPlayer/Components/__tests__/NowPlayingHeaderSection.test.tsx +36 -0
  34. package/Components/ModalComponent/AudioPlayer/Components/index.ts +3 -3
  35. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +356 -0
  36. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +521 -0
  37. package/Components/ModalComponent/BottomSheetModalContent.tsx +498 -66
  38. package/Components/ModalComponent/Button/index.tsx +5 -3
  39. package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
  40. package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
  41. package/Components/ModalComponent/Header/index.tsx +20 -7
  42. package/Components/ModalComponent/Header/utils.ts +1 -1
  43. package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
  44. package/Components/ModalComponent/SortableList.tsx +156 -0
  45. package/Components/ModalComponent/SortableList.web.tsx +34 -0
  46. package/Components/ModalComponent/TextInputContent.tsx +135 -0
  47. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +343 -0
  48. package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
  49. package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +169 -0
  50. package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
  51. package/Components/ModalComponent/index.tsx +18 -9
  52. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +90 -0
  53. package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
  54. package/Components/ModalComponent/presets/index.ts +27 -0
  55. package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
  56. package/Components/ModalComponent/presets/standardCell.tsx +41 -0
  57. package/Components/ModalComponent/presets/types.ts +35 -0
  58. package/Components/ModalComponent/showTextInput.ts +52 -0
  59. package/Components/ModalComponent/utils.ts +82 -21
  60. package/Components/OfflineHandler/__tests__/index.test.tsx +109 -0
  61. package/Components/OfflineHandler/hooks.ts +0 -12
  62. package/Components/OfflineHandler/index.tsx +42 -4
  63. package/Components/PlayerContainer/PlayerContainer.tsx +10 -5
  64. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
  65. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +65 -13
  66. package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -82
  67. package/Components/River/River.tsx +4 -0
  68. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -75
  69. package/Components/River/__tests__/componentsMap.test.js +8 -3
  70. package/Components/River/__tests__/resultCallback.test.tsx +47 -0
  71. package/Components/Screen/__tests__/Screen.test.tsx +24 -0
  72. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
  73. package/Components/Screen/index.tsx +5 -0
  74. package/Components/Screen/navigationHandler.ts +8 -8
  75. package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
  76. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
  77. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
  78. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +21 -4
  79. package/Components/Transitioner/AnimationManager.js +1 -1
  80. package/Components/Transitioner/Scene.tsx +4 -3
  81. package/Components/Transitioner/Transitioner.tsx +71 -33
  82. package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
  83. package/Components/VideoLive/LiveImageManager.ts +8 -2
  84. package/Components/VideoLive/__tests__/LiveImageManager.test.ts +59 -0
  85. package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
  86. package/Contexts/ModalNavigationContext/index.tsx +2 -2
  87. package/Hooks/useEntryActionsExpander.ts +63 -0
  88. package/assets/empty-Info.png +0 -0
  89. package/package.json +6 -5
  90. package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -332
  91. /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { render } from "@testing-library/react-native";
3
+ import { withModalNavigationContextProvider } from "../";
4
+
5
+ describe("withModalNavigationContextProvider", () => {
6
+ it("does not re-render the wrapped component when props are unchanged", () => {
7
+ const Component = jest.fn(() => null);
8
+ const WrappedComponent = withModalNavigationContextProvider(Component);
9
+ const { rerender } = render(<WrappedComponent title="Modal" />);
10
+
11
+ rerender(<WrappedComponent title="Modal" />);
12
+
13
+ expect(Component).toHaveBeenCalledTimes(1);
14
+ });
15
+ });
@@ -6,11 +6,11 @@ export function useModalNavigationContext() {
6
6
  }
7
7
 
8
8
  export function withModalNavigationContextProvider(Component) {
9
- return function WrappedWithModalNavigationContextProvider(props) {
9
+ return React.memo(function WrappedWithModalNavigationContextProvider(props) {
10
10
  return (
11
11
  <ModalNavigationContext.Provider value={true}>
12
12
  <Component {...props} />
13
13
  </ModalNavigationContext.Provider>
14
14
  );
15
- };
15
+ });
16
16
  }
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+
3
+ import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
4
+ import {
5
+ buildEntryActions,
6
+ EntryActionDeps,
7
+ } from "@applicaster/zapp-react-native-utils/entryActions";
8
+ import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
9
+ import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
10
+ import {
11
+ useCurrentScreenData,
12
+ useScreenContext,
13
+ } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
14
+ import { RegisteredAction } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
15
+
16
+ /**
17
+ * Expands `entry.extensions.entry_action` into invokable actions, against the
18
+ * screen this hook is called from.
19
+ *
20
+ * Entry actions are data on the entry, not an installed capability, so there is
21
+ * nothing to look up by identifier: the surface showing the entry expands them.
22
+ * That also decides which screen they execute against — the one whose tree this
23
+ * hook runs in, rather than whichever screen happened to be current when a
24
+ * global provider was registered.
25
+ *
26
+ * Pass the result to `resolveActionIdentifiers` / `resolvePlayerActions` as
27
+ * `expandEntryActions`.
28
+ */
29
+ export function useEntryActionsExpander(): (
30
+ entry: ZappEntry | ZappFeed
31
+ ) => RegisteredAction[] {
32
+ const { pathname } = useRoute();
33
+
34
+ const screenContext = useScreenContext();
35
+ const screenData = useCurrentScreenData();
36
+ const screenState = screenContext?.options;
37
+ const screenStateStore = useScreenStateStore();
38
+ const actionExecutor = React.useContext(ActionExecutorContext);
39
+
40
+ // Read through a ref so the returned expander keeps a stable identity: it
41
+ // feeds `useMemo` dependency lists on surfaces that re-resolve their actions
42
+ // on every registry change.
43
+ const depsRef = React.useRef<EntryActionDeps>();
44
+
45
+ depsRef.current = {
46
+ actionExecutor,
47
+ actionContext: {
48
+ screenData,
49
+ screenState,
50
+ screenRoute: pathname,
51
+ screenStateStore,
52
+ // From the screen context, the way `useCellClick` builds the same bag.
53
+ // The ZappPipes entry context is a route-keyed map, so reading `.data`
54
+ // off it was always undefined.
55
+ screenEntry: screenContext?.entry,
56
+ },
57
+ };
58
+
59
+ return React.useCallback(
60
+ (entry: ZappEntry | ZappFeed) => buildEntryActions(entry, depsRef.current),
61
+ []
62
+ );
63
+ }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "16.0.0-alpha.1020865559",
3
+ "version": "16.0.0-alpha.1035454037",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,12 +28,13 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "16.0.0-alpha.1020865559",
32
- "@applicaster/zapp-react-native-bridge": "16.0.0-alpha.1020865559",
33
- "@applicaster/zapp-react-native-redux": "16.0.0-alpha.1020865559",
34
- "@applicaster/zapp-react-native-utils": "16.0.0-alpha.1020865559",
31
+ "@applicaster/applicaster-types": "16.0.0-alpha.1035454037",
32
+ "@applicaster/zapp-react-native-bridge": "16.0.0-alpha.1035454037",
33
+ "@applicaster/zapp-react-native-redux": "16.0.0-alpha.1035454037",
34
+ "@applicaster/zapp-react-native-utils": "16.0.0-alpha.1035454037",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
+ "react-native-sortables": "1.7.1",
37
38
  "url": "^0.11.0",
38
39
  "uuid": "^3.3.2"
39
40
  },
@@ -1,332 +0,0 @@
1
- /**
2
- * Modal Building Block — Action
3
- *
4
- * Single-file Expo Snack demo for the Action list item building block spec.
5
- * Three forms (text only / leading icon + text / leading + text + trailing)
6
- * are driven by data — no separate variants.
7
- *
8
- * Green (configurable): background, title, trailingIcon.chevronAsset
9
- * White (hardcoded): container padding/gutter, icon size, leading icon assets,
10
- * leading/trailing visibility logic from data
11
- */
12
-
13
- import React from "react";
14
- import {
15
- Image,
16
- Platform,
17
- Pressable,
18
- StyleSheet,
19
- Text,
20
- View,
21
- } from "react-native";
22
-
23
- const styles = StyleSheet.create({
24
- row: {
25
- flexDirection: "row",
26
- alignItems: "center",
27
- },
28
- demoScreen: {
29
- flex: 1,
30
- backgroundColor: "#1C1C1E",
31
- paddingTop: 64,
32
- paddingHorizontal: 16,
33
- gap: 12,
34
- },
35
- demoHeading: {
36
- color: "#FFFFFF",
37
- fontSize: 20,
38
- fontWeight: "600",
39
- marginBottom: 8,
40
- },
41
- demoLabel: {
42
- color: "#999999",
43
- fontSize: 13,
44
- marginTop: 8,
45
- },
46
- });
47
-
48
- // ---------------------------------------------------------------------------
49
- // Configuration (green / editable fields from spec)
50
- // ---------------------------------------------------------------------------
51
-
52
- export type TextTransform =
53
- | "default"
54
- | "lowercase"
55
- | "uppercase"
56
- | "capitalize";
57
-
58
- export type BackgroundConfiguration = {
59
- defaultColor: string;
60
- focusedColor: string;
61
- cornerRadius: number;
62
- };
63
-
64
- export type TitleConfiguration = {
65
- fontColor: string;
66
- focusedFontColor: string;
67
- iosFontFamily: string;
68
- androidFontFamily: string;
69
- fontSize: number;
70
- lineHeight: number;
71
- iosLetterSpacing: number;
72
- androidLetterSpacing: number;
73
- textTransform: TextTransform;
74
- };
75
-
76
- export type TrailingIconConfiguration = {
77
- chevronAsset?: string;
78
- };
79
-
80
- export type ActionConfiguration = {
81
- background: BackgroundConfiguration;
82
- title: TitleConfiguration;
83
- trailingIcon: TrailingIconConfiguration;
84
- };
85
-
86
- export const DEFAULT_BACKGROUND_CONFIGURATION: BackgroundConfiguration = {
87
- defaultColor: "transparent",
88
- focusedColor: "rgba(62, 62, 62, 1)",
89
- cornerRadius: 12,
90
- };
91
-
92
- export const DEFAULT_TITLE_CONFIGURATION: TitleConfiguration = {
93
- fontColor: "#FFFFFF",
94
- focusedFontColor: "#FFFFFF",
95
- iosFontFamily: "SFProText-Semibold",
96
- androidFontFamily: "Roboto-Medium",
97
- fontSize: 15,
98
- lineHeight: 24,
99
- iosLetterSpacing: -0.2,
100
- androidLetterSpacing: 0,
101
- textTransform: "default",
102
- };
103
-
104
- export const DEFAULT_TRAILING_ICON_CONFIGURATION: TrailingIconConfiguration =
105
- {};
106
-
107
- export const DEFAULT_ACTION_CONFIGURATION: ActionConfiguration = {
108
- background: DEFAULT_BACKGROUND_CONFIGURATION,
109
- title: DEFAULT_TITLE_CONFIGURATION,
110
- trailingIcon: DEFAULT_TRAILING_ICON_CONFIGURATION,
111
- };
112
-
113
- // ---------------------------------------------------------------------------
114
- // Data (runtime — controls which elements are shown)
115
- // ---------------------------------------------------------------------------
116
-
117
- export type LeadingActionType =
118
- | "addToQueue"
119
- | "addToPlaylist"
120
- | "favorite"
121
- | "share"
122
- | "sleepTimer"
123
- | "playbackSpeed";
124
-
125
- export type ActionData = {
126
- title: string;
127
- /** When set, leading icon is shown (Enable: On). */
128
- leadingActionType?: LeadingActionType;
129
- /** When true, trailing chevron is shown (Enable: On). */
130
- showTrailingChevron?: boolean;
131
- };
132
-
133
- export type AudioPlayerActionProps = {
134
- configuration: ActionConfiguration;
135
- data: ActionData;
136
- focused?: boolean;
137
- onPress?: () => void;
138
- };
139
-
140
- // ---------------------------------------------------------------------------
141
- // Hardcoded spec values (white fields)
142
- // ---------------------------------------------------------------------------
143
-
144
- const CONTAINER_SPEC = {
145
- paddingTop: 13,
146
- paddingRight: 10,
147
- paddingBottom: 13,
148
- paddingLeft: 10,
149
- horizontalGutter: 12,
150
- };
151
-
152
- const ICON_SPEC = {
153
- width: 24,
154
- height: 24,
155
- };
156
-
157
- const DEFAULT_CHEVRON_ASSET =
158
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAALElEQVR42mNgGAXUBlu2bPmPjIeWBeiGDy0Lhrbrh1/qGXqZaxSMglEw0gEA4c+IpUrpYX4AAAAASUVORK5CYII=";
159
-
160
- /** Hardcoded: action type → leading icon asset (base64 PNG). */
161
- const LEADING_ICON_ASSETS: Record<LeadingActionType, string> = {
162
- addToQueue:
163
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAALElEQVR42mNgGAUjE/xHAzS3gFgweC0Y+nEwGslkBRFFwTj8LBjNyaNgmAMAJTf+EEEZcS0AAAAASUVORK5CYII=",
164
- addToPlaylist:
165
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAKUlEQVR42mNgGAVDBvxHA6MWjFpAvEGkglELKLdgNJmOWkA7C0YBzQAAivu+UKRR1ZIAAAAASUVORK5CYII=",
166
- favorite:
167
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAKklEQVR42mNgGAWjYBTgBP+xAGLkRi0YQhbgM4wqBo9aMHgsGAWjgCAAALyAZqh4yyZZAAAAAElFTkSuQmCC",
168
- share:
169
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAK0lEQVR42mNgGAVDDvxHAqMWjFowUiz4TwQYgRYQYxBFlo1aMPAWjAK6AgD2g7pUUT7VeAAAAABJRU5ErkJggg==",
170
- sleepTimer:
171
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAYUlEQVR42tWUSQ4AIAgD+f+n8eJRliIQ6MmEZTSxJZokvipdXgZpAbzOO17AglIXI7XULxmCoEMwRGuWam6AdRsN4IJYTRH4PIDkhxTA92zUPNBcFDDHaOVR0RJ2LXG9QgemFVK8tpo4PwAAAABJRU5ErkJggg==",
172
- playbackSpeed:
173
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAK0lEQVR42mNgGAVDDvxHAqMWjFowUiz4TwQYgRYQYxBFlo1aMPAWjAK6AgD2g7pUUT7VeAAAAABJRU5ErkJggg==",
174
- };
175
-
176
- function getTextTransformStyle(
177
- textTransform: TextTransform
178
- ): "none" | "lowercase" | "uppercase" | "capitalize" {
179
- return textTransform === "default" ? "none" : textTransform;
180
- }
181
-
182
- function shouldShowLeadingIcon(leadingActionType?: LeadingActionType) {
183
- return !!leadingActionType;
184
- }
185
-
186
- function shouldShowTrailingIcon(showTrailingChevron?: boolean) {
187
- return !!showTrailingChevron;
188
- }
189
-
190
- // ---------------------------------------------------------------------------
191
- // Inner components
192
- // ---------------------------------------------------------------------------
193
-
194
- type ActionContainerProps = {
195
- configuration: BackgroundConfiguration;
196
- focused: boolean;
197
- children: React.ReactNode;
198
- onPress?: () => void;
199
- };
200
-
201
- function ActionContainer({
202
- configuration,
203
- focused,
204
- children,
205
- onPress,
206
- }: ActionContainerProps) {
207
- return (
208
- <Pressable
209
- onPress={onPress}
210
- style={({ pressed }) => ({
211
- backgroundColor:
212
- pressed || focused
213
- ? configuration.focusedColor
214
- : configuration.defaultColor,
215
- borderRadius: configuration.cornerRadius,
216
- paddingTop: CONTAINER_SPEC.paddingTop,
217
- paddingRight: CONTAINER_SPEC.paddingRight,
218
- paddingBottom: CONTAINER_SPEC.paddingBottom,
219
- paddingLeft: CONTAINER_SPEC.paddingLeft,
220
- })}
221
- >
222
- {children}
223
- </Pressable>
224
- );
225
- }
226
-
227
- type ActionTitleProps = {
228
- title: string;
229
- configuration: TitleConfiguration;
230
- focused: boolean;
231
- };
232
-
233
- function ActionTitle({ title, configuration, focused }: ActionTitleProps) {
234
- const letterSpacing =
235
- Platform.OS === "ios"
236
- ? configuration.iosLetterSpacing
237
- : configuration.androidLetterSpacing;
238
-
239
- return (
240
- <Text
241
- style={{
242
- flex: 1,
243
- color: focused
244
- ? configuration.focusedFontColor
245
- : configuration.fontColor,
246
- fontSize: configuration.fontSize,
247
- lineHeight: configuration.lineHeight,
248
- letterSpacing,
249
- fontFamily: Platform.select({
250
- ios: configuration.iosFontFamily,
251
- android: configuration.androidFontFamily,
252
- default: configuration.androidFontFamily,
253
- }),
254
- textTransform: getTextTransformStyle(configuration.textTransform),
255
- }}
256
- numberOfLines={1}
257
- >
258
- {title}
259
- </Text>
260
- );
261
- }
262
-
263
- type ActionLeadingIconProps = {
264
- actionType: LeadingActionType;
265
- };
266
-
267
- function ActionLeadingIcon({ actionType }: ActionLeadingIconProps) {
268
- return (
269
- <Image
270
- source={{ uri: LEADING_ICON_ASSETS[actionType] }}
271
- style={{ width: ICON_SPEC.width, height: ICON_SPEC.height }}
272
- resizeMode="contain"
273
- />
274
- );
275
- }
276
-
277
- type ActionTrailingIconProps = {
278
- configuration: TrailingIconConfiguration;
279
- };
280
-
281
- function ActionTrailingIcon({ configuration }: ActionTrailingIconProps) {
282
- const asset = configuration.chevronAsset ?? DEFAULT_CHEVRON_ASSET;
283
-
284
- return (
285
- <Image
286
- source={{ uri: asset }}
287
- style={{ width: ICON_SPEC.width, height: ICON_SPEC.height }}
288
- resizeMode="contain"
289
- />
290
- );
291
- }
292
-
293
- // ---------------------------------------------------------------------------
294
- // AudioPlayerAction
295
- // ---------------------------------------------------------------------------
296
-
297
- export function AudioPlayerAction({
298
- configuration,
299
- data,
300
- focused = false,
301
- onPress,
302
- }: AudioPlayerActionProps) {
303
- const { background, title, trailingIcon } = configuration;
304
- const { title: label, leadingActionType, showTrailingChevron } = data;
305
-
306
- const showLeading = shouldShowLeadingIcon(leadingActionType);
307
- const showTrailing = shouldShowTrailingIcon(showTrailingChevron);
308
-
309
- return (
310
- <ActionContainer
311
- configuration={background}
312
- focused={focused}
313
- onPress={onPress}
314
- >
315
- <View style={styles.row}>
316
- {showLeading ? (
317
- <>
318
- <ActionLeadingIcon actionType={leadingActionType} />
319
- <View style={{ width: CONTAINER_SPEC.horizontalGutter }} />
320
- </>
321
- ) : null}
322
- <ActionTitle title={label} configuration={title} focused={focused} />
323
- {showTrailing ? (
324
- <>
325
- <View style={{ width: CONTAINER_SPEC.horizontalGutter }} />
326
- <ActionTrailingIcon configuration={trailingIcon} />
327
- </>
328
- ) : null}
329
- </View>
330
- </ActionContainer>
331
- );
332
- }