@applicaster/zapp-react-native-ui-components 15.1.4 → 16.0.0-alpha.1042942411
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/Components/BackgroundImage/index.ts +1 -8
- package/Components/BaseFocusable/index.ios.ts +12 -2
- package/Components/Cell/FocusableWrapper.tsx +3 -0
- package/Components/Cell/TvOSCellComponent.tsx +6 -3
- package/Components/CellRendererResolver/index.ts +1 -1
- package/Components/Focusable/Focusable.tsx +4 -2
- package/Components/Focusable/FocusableTvOS.tsx +18 -1
- package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
- package/Components/FocusableGroup/FocusableTvOS.tsx +30 -1
- package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +39 -0
- package/Components/GeneralContentScreen/__tests__/GeneralContentScreenHookAdapter.test.tsx +64 -0
- package/Components/GeneralContentScreen/__tests__/HookContentFocusGroup.web.test.tsx +91 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/networkService.test.ts +74 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/runInBackground.test.ts +139 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +124 -0
- package/Components/GeneralContentScreen/hookAdapter/logger.ts +6 -0
- package/Components/GeneralContentScreen/hookAdapter/networkService.ts +53 -0
- package/Components/GeneralContentScreen/hookAdapter/runInBackground.ts +48 -0
- package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +72 -0
- package/Components/GeneralContentScreen/hookFocus/index.tsx +13 -0
- package/Components/GeneralContentScreen/hookFocus/index.web.tsx +69 -0
- package/Components/GeneralContentScreen/index.ts +2 -0
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +13 -8
- package/Components/Layout/TV/NavBarContainer.tsx +1 -10
- package/Components/Layout/TV/ScreenContainer.tsx +2 -6
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +7 -12
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +7 -12
- package/Components/Layout/TV/index.tsx +3 -4
- package/Components/Layout/TV/index.web.tsx +3 -4
- package/Components/LinkHandler/LinkHandler.tsx +2 -2
- package/Components/MasterCell/CONFIG_BUILDER_TO_REACT_COMPONENT.md +144 -0
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +27 -48
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/model.test.ts +80 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +213 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/selectors.test.ts +45 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/style.test.ts +49 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +165 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +405 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/index.ts +1 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/model.ts +47 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +198 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/selectors.ts +26 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/style.ts +29 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/types.ts +37 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +217 -46
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +50 -119
- package/Components/MasterCell/DefaultComponents/Button.tsx +50 -58
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/components/HorizontalSeparator.tsx +8 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.android.tv.tsx +58 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tsx +15 -0
- package/Components/MasterCell/DefaultComponents/{tv/ButtonContainerView/index.tsx → ButtonContainerView/index.tv.tsx} +3 -11
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.web.ts +1 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/types.ts +40 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/__tests__/__snapshots__/index.test.tsx.snap +18 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/__tests__/index.test.tsx +90 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +13 -14
- package/Components/MasterCell/DefaultComponents/DataProvider/index.tsx +163 -0
- package/Components/MasterCell/DefaultComponents/FocusableView/index.android.tsx +2 -23
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -22
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +8 -2
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +1 -2
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +54 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +46 -50
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +47 -39
- package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +19 -6
- package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +15 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +45 -15
- package/Components/MasterCell/DefaultComponents/UIKitAdapters/Badge.tsx +49 -0
- package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +122 -0
- package/Components/MasterCell/DefaultComponents/__tests__/Button.test.tsx +186 -0
- package/Components/MasterCell/DefaultComponents/__tests__/DataProvider.test.tsx +141 -0
- package/Components/MasterCell/DefaultComponents/__tests__/DynamicBadge.test.tsx +156 -0
- package/Components/MasterCell/DefaultComponents/__tests__/__snapshots__/ActionButton.test.tsx.snap +60 -0
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +196 -67
- package/Components/MasterCell/DefaultComponents/index.ts +13 -3
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +189 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Asset.ts +33 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/AssetComponent.tsx +33 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +159 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +18 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabel.ts +67 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +39 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +402 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/builders.test.ts +141 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +354 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/helpers.ts +105 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +129 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +123 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +238 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Asset.ts +4 -18
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Button.ts +24 -73
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TextLabelsContainer.ts +37 -18
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TvActionButton.tsx +27 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/index.test.ts +89 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/renderedTree.test.tsx +231 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +47 -48
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +115 -29
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/insertButtonsBetweenLabels.test.ts +45 -13
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +101 -144
- package/Components/MasterCell/MappingFunctions/index.js +3 -2
- package/Components/MasterCell/README.md +4 -0
- package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +24 -0
- package/Components/MasterCell/__tests__/configInflater.test.js +1 -0
- package/Components/MasterCell/__tests__/elementMapper.test.js +46 -0
- package/Components/MasterCell/contexts/PressedStateContext.ts +3 -0
- package/Components/MasterCell/dataAdapter.ts +4 -1
- package/Components/MasterCell/elementMapper.tsx +54 -7
- package/Components/MasterCell/hooks/index.ts +2 -0
- package/Components/MasterCell/hooks/usePressedState.ts +4 -0
- package/Components/MasterCell/index.tsx +20 -4
- package/Components/MasterCell/utils/__tests__/cloneChildrenWithIds.test.tsx +43 -0
- package/Components/MasterCell/utils/__tests__/useFilterChildren.test.tsx +80 -0
- package/Components/MasterCell/utils/index.ts +82 -16
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +33 -69
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +25 -47
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +122 -39
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +671 -0
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +257 -88
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +6 -4
- package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +17 -10
- package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +4 -85
- package/Components/OfflineHandler/__tests__/index.test.tsx +101 -32
- package/Components/OfflineHandler/hooks.ts +123 -0
- package/Components/OfflineHandler/index.tsx +51 -73
- package/Components/OfflineHandler/utils/index.ts +1 -13
- package/Components/PlayerContainer/PlayerContainer.tsx +6 -5
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +2 -4
- package/Components/PreloaderWrapper/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +8 -21
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
- package/Components/River/RefreshControl.tsx +19 -105
- package/Components/River/River.tsx +9 -82
- package/Components/River/TV/River.tsx +31 -14
- package/Components/River/TV/index.tsx +8 -4
- package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
- package/Components/River/TV/utils/index.ts +4 -0
- package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +4 -0
- package/Components/River/__tests__/componentsMap.test.js +38 -0
- package/Components/River/hooks/__tests__/usePullToRefresh.test.ts +132 -0
- package/Components/River/hooks/index.ts +1 -0
- package/Components/River/hooks/usePullToRefresh.ts +51 -0
- package/Components/Screen/TV/index.web.tsx +4 -2
- package/Components/Screen/__tests__/Screen.test.tsx +65 -42
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
- package/Components/Screen/hooks.ts +2 -3
- package/Components/Screen/index.tsx +2 -3
- package/Components/Screen/orientationHandler.ts +3 -3
- package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +5 -3
- package/Components/ScreenResolver/index.tsx +9 -5
- package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +1 -1
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +1 -1
- package/Components/Tabs/TabContent.tsx +7 -4
- package/Components/TopCutoffOverlay/__tests__/TopCutoffOverlay.test.tsx +201 -0
- package/Components/TopCutoffOverlay/hooks/__tests__/useMarginTop.test.ts +130 -0
- package/Components/TopCutoffOverlay/hooks/index.ts +1 -0
- package/Components/TopCutoffOverlay/hooks/useMarginTop.ts +59 -0
- package/Components/TopCutoffOverlay/index.tsx +55 -0
- package/Components/Transitioner/index.js +3 -3
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +5 -5
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
- package/Components/VideoModal/utils.ts +12 -10
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
- package/Components/Viewport/ViewportAware/index.tsx +16 -7
- package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
- package/Components/default-cell-renderer/viewTrees/mobile/index.ts +0 -3
- package/Contexts/CachedDimensionsContext/__tests__/index.test.ts +154 -0
- package/Contexts/ScreenContext/index.tsx +25 -18
- package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
- package/Decorators/Analytics/index.tsx +6 -5
- package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
- package/Decorators/ConfigurationWrapper/const.ts +1 -0
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
- package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
- package/Helpers/DataSourceHelper/index.ts +19 -0
- package/package.json +5 -5
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +0 -135
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/types.ts +0 -25
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +0 -112
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +0 -107
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +0 -153
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -67
- package/Components/OfflineHandler/NotificationView/utils.ts +0 -34
- package/Components/River/TV/withTVEventHandler.tsx +0 -36
- package/Helpers/DataSourceHelper/index.js +0 -19
- /package/Components/BackgroundImage/{BackgroundImage.tv.android.tsx → BackgroundImage.android.tv.tsx} +0 -0
- /package/Components/BackgroundImage/{BackgroundImage.tv.ios.tsx → BackgroundImage.ios.tv.tsx} +0 -0
- /package/Components/BackgroundImage/{BackgroundImage.tv.web.tsx → BackgroundImage.tsx} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import React, { useCallback, useState } from "react";
|
|
12
|
-
import {
|
|
12
|
+
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
|
13
13
|
|
|
14
14
|
const styles = StyleSheet.create({
|
|
15
15
|
row: {
|
|
@@ -123,6 +123,7 @@ export type ActionButtonsStyleConfiguration = {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
export type HeaderConfiguration = {
|
|
126
|
+
paddingTop: undefined;
|
|
126
127
|
variant: HeaderVariant;
|
|
127
128
|
title: TitleConfiguration;
|
|
128
129
|
closeButton: CloseButtonConfiguration;
|
|
@@ -168,12 +169,17 @@ export type HeaderData = {
|
|
|
168
169
|
title: string;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
export type
|
|
172
|
+
export type AudioPlayerHeaderProps = {
|
|
172
173
|
configuration: HeaderConfiguration;
|
|
173
174
|
data: HeaderData;
|
|
174
175
|
focusedCloseButton?: boolean;
|
|
175
176
|
focusedLeadingAction?: boolean;
|
|
176
177
|
focusedTrailingAction?: boolean;
|
|
178
|
+
onClose?: () => void;
|
|
179
|
+
onBack?: () => void;
|
|
180
|
+
onCancel?: () => void;
|
|
181
|
+
onDone?: () => void;
|
|
182
|
+
onClear?: () => void;
|
|
177
183
|
};
|
|
178
184
|
|
|
179
185
|
// ---------------------------------------------------------------------------
|
|
@@ -202,9 +208,9 @@ type ActionButtonsBehaviorSpec = {
|
|
|
202
208
|
const CONTAINER_SPEC: Record<HeaderVariant, ContainerSpec> = {
|
|
203
209
|
singleLine: {
|
|
204
210
|
horizontalGutter: 16,
|
|
205
|
-
paddingTop:
|
|
206
|
-
paddingRight:
|
|
207
|
-
paddingBottom:
|
|
211
|
+
paddingTop: 24,
|
|
212
|
+
paddingRight: 20,
|
|
213
|
+
paddingBottom: 12,
|
|
208
214
|
paddingLeft: 20,
|
|
209
215
|
},
|
|
210
216
|
headerWithActions: {
|
|
@@ -256,9 +262,6 @@ const ACTION_BUTTONS_BEHAVIOR: Record<
|
|
|
256
262
|
},
|
|
257
263
|
};
|
|
258
264
|
|
|
259
|
-
const DEFAULT_CLOSE_BUTTON_ASSET =
|
|
260
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAl0lEQVR42u2YQQ7AIAgE/f+naQ899dDYyiLT7DyAnRijwBjGGLNEnKCy4qJCNlVYKZ2aETeUshLhTGlZbUVh5UGkB8hlM4PKZDMCy2VXgrfJfhHYLvtGpI3sjFA72SextrKz0m1bUYwsTvhX97f9C4F8g5G/HLKPQHZqyF4YOW0g5znkxCytjV6koFZVqGVg5Yc0jDFmiQNENiwNUMoCZAAAAABJRU5ErkJggg==";
|
|
261
|
-
|
|
262
265
|
const CLOSE_BUTTON_SPEC = {
|
|
263
266
|
width: 44,
|
|
264
267
|
height: 44,
|
|
@@ -298,16 +301,26 @@ function shouldShowActionSlot(slot: ActionSlotSpec, sectionEnabled: boolean) {
|
|
|
298
301
|
|
|
299
302
|
type HeaderContainerProps = {
|
|
300
303
|
variant: HeaderVariant;
|
|
304
|
+
configuration: HeaderConfiguration;
|
|
301
305
|
children: React.ReactNode;
|
|
302
306
|
};
|
|
303
307
|
|
|
304
|
-
function HeaderContainer({
|
|
308
|
+
function HeaderContainer({
|
|
309
|
+
variant,
|
|
310
|
+
configuration,
|
|
311
|
+
children,
|
|
312
|
+
}: HeaderContainerProps) {
|
|
305
313
|
const container = CONTAINER_SPEC[variant];
|
|
306
314
|
|
|
315
|
+
const paddingTop =
|
|
316
|
+
configuration.paddingTop !== undefined
|
|
317
|
+
? configuration.paddingTop
|
|
318
|
+
: container.paddingTop;
|
|
319
|
+
|
|
307
320
|
return (
|
|
308
321
|
<View
|
|
309
322
|
style={{
|
|
310
|
-
paddingTop:
|
|
323
|
+
paddingTop: paddingTop,
|
|
311
324
|
paddingRight: container.paddingRight,
|
|
312
325
|
paddingBottom: container.paddingBottom,
|
|
313
326
|
paddingLeft: container.paddingLeft,
|
|
@@ -356,21 +369,80 @@ function HeaderTitle({ title, configuration, centered }: HeaderTitleProps) {
|
|
|
356
369
|
type HeaderCloseButtonProps = {
|
|
357
370
|
configuration: CloseButtonConfiguration;
|
|
358
371
|
focused?: boolean;
|
|
372
|
+
onPress?: () => void;
|
|
359
373
|
};
|
|
360
374
|
|
|
361
375
|
function HeaderCloseButton({
|
|
362
376
|
configuration,
|
|
363
377
|
focused = false,
|
|
378
|
+
onPress,
|
|
364
379
|
}: HeaderCloseButtonProps) {
|
|
365
380
|
if (!configuration.enabled) {
|
|
366
381
|
return null;
|
|
367
382
|
}
|
|
368
383
|
|
|
369
|
-
const
|
|
384
|
+
const buttonSize = 32;
|
|
370
385
|
|
|
371
386
|
return (
|
|
372
|
-
<
|
|
373
|
-
|
|
387
|
+
<Pressable
|
|
388
|
+
onPress={onPress}
|
|
389
|
+
style={({ pressed }) => [
|
|
390
|
+
styles.closeButton,
|
|
391
|
+
{
|
|
392
|
+
width: buttonSize,
|
|
393
|
+
height: buttonSize,
|
|
394
|
+
borderRadius: buttonSize / 2,
|
|
395
|
+
borderWidth: 1.5,
|
|
396
|
+
borderColor: "rgba(255, 255, 255, 0.4)",
|
|
397
|
+
opacity: pressed || focused ? 0.7 : 1,
|
|
398
|
+
justifyContent: "center",
|
|
399
|
+
alignItems: "center",
|
|
400
|
+
},
|
|
401
|
+
]}
|
|
402
|
+
>
|
|
403
|
+
<View
|
|
404
|
+
style={{
|
|
405
|
+
width: 14,
|
|
406
|
+
height: 14,
|
|
407
|
+
justifyContent: "center",
|
|
408
|
+
alignItems: "center",
|
|
409
|
+
}}
|
|
410
|
+
>
|
|
411
|
+
<View
|
|
412
|
+
style={{
|
|
413
|
+
position: "absolute",
|
|
414
|
+
width: 14,
|
|
415
|
+
height: 1.5,
|
|
416
|
+
backgroundColor: "#FFFFFF",
|
|
417
|
+
transform: [{ rotate: "45deg" }],
|
|
418
|
+
borderRadius: 1,
|
|
419
|
+
}}
|
|
420
|
+
/>
|
|
421
|
+
<View
|
|
422
|
+
style={{
|
|
423
|
+
position: "absolute",
|
|
424
|
+
width: 14,
|
|
425
|
+
height: 1.5,
|
|
426
|
+
backgroundColor: "#FFFFFF",
|
|
427
|
+
transform: [{ rotate: "-45deg" }],
|
|
428
|
+
borderRadius: 1,
|
|
429
|
+
}}
|
|
430
|
+
/>
|
|
431
|
+
</View>
|
|
432
|
+
</Pressable>
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
type HeaderBackButtonProps = {
|
|
437
|
+
focused?: boolean;
|
|
438
|
+
onPress?: () => void;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
function HeaderBackButton({ focused = false, onPress }: HeaderBackButtonProps) {
|
|
442
|
+
return (
|
|
443
|
+
<Pressable
|
|
444
|
+
onPress={onPress}
|
|
445
|
+
style={({ pressed }) => [
|
|
374
446
|
styles.closeButton,
|
|
375
447
|
{
|
|
376
448
|
width: CLOSE_BUTTON_SPEC.width,
|
|
@@ -382,19 +454,14 @@ function HeaderCloseButton({
|
|
|
382
454
|
borderRadius: CLOSE_BUTTON_SPEC.width / 2,
|
|
383
455
|
borderWidth: 1,
|
|
384
456
|
borderColor: "#FFFFFF",
|
|
385
|
-
opacity: focused ? 0.7 : 1,
|
|
457
|
+
opacity: pressed || focused ? 0.7 : 1,
|
|
386
458
|
},
|
|
387
459
|
]}
|
|
388
460
|
>
|
|
389
|
-
<
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
height: CLOSE_BUTTON_SPEC.height * 0.55,
|
|
394
|
-
}}
|
|
395
|
-
resizeMode="contain"
|
|
396
|
-
/>
|
|
397
|
-
</View>
|
|
461
|
+
<Text style={{ color: "#FFFFFF", fontSize: 20, fontWeight: "bold" }}>
|
|
462
|
+
‹
|
|
463
|
+
</Text>
|
|
464
|
+
</Pressable>
|
|
398
465
|
);
|
|
399
466
|
}
|
|
400
467
|
|
|
@@ -402,25 +469,29 @@ type HeaderActionButtonProps = {
|
|
|
402
469
|
actionType: HeaderActionType;
|
|
403
470
|
configuration: ActionButtonsStyleConfiguration;
|
|
404
471
|
focused?: boolean;
|
|
472
|
+
onPress?: () => void;
|
|
405
473
|
};
|
|
406
474
|
|
|
407
475
|
function HeaderActionButton({
|
|
408
476
|
actionType,
|
|
409
477
|
configuration,
|
|
410
478
|
focused = false,
|
|
479
|
+
onPress,
|
|
411
480
|
}: HeaderActionButtonProps) {
|
|
412
481
|
return (
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
482
|
+
<Pressable
|
|
483
|
+
onPress={onPress}
|
|
484
|
+
style={({ pressed }) => ({
|
|
485
|
+
backgroundColor:
|
|
486
|
+
pressed || focused
|
|
487
|
+
? configuration.focusedBackgroundColor
|
|
488
|
+
: configuration.defaultBackgroundColor,
|
|
418
489
|
borderRadius: ACTION_BUTTON_LAYOUT_SPEC.cornerRadius,
|
|
419
490
|
paddingTop: ACTION_BUTTON_LAYOUT_SPEC.paddingTop,
|
|
420
491
|
paddingRight: ACTION_BUTTON_LAYOUT_SPEC.paddingRight,
|
|
421
492
|
paddingBottom: ACTION_BUTTON_LAYOUT_SPEC.paddingBottom,
|
|
422
493
|
paddingLeft: ACTION_BUTTON_LAYOUT_SPEC.paddingLeft,
|
|
423
|
-
}}
|
|
494
|
+
})}
|
|
424
495
|
>
|
|
425
496
|
<Text
|
|
426
497
|
style={{
|
|
@@ -444,7 +515,7 @@ function HeaderActionButton({
|
|
|
444
515
|
>
|
|
445
516
|
{ACTION_LABELS[actionType]}
|
|
446
517
|
</Text>
|
|
447
|
-
</
|
|
518
|
+
</Pressable>
|
|
448
519
|
);
|
|
449
520
|
}
|
|
450
521
|
|
|
@@ -536,16 +607,21 @@ function CenterAlignedHeaderLayout({
|
|
|
536
607
|
}
|
|
537
608
|
|
|
538
609
|
// ---------------------------------------------------------------------------
|
|
539
|
-
//
|
|
610
|
+
// AudioPlayerHeader
|
|
540
611
|
// ---------------------------------------------------------------------------
|
|
541
612
|
|
|
542
|
-
export function
|
|
613
|
+
export function AudioPlayerHeader({
|
|
543
614
|
configuration,
|
|
544
615
|
data,
|
|
545
616
|
focusedCloseButton = false,
|
|
546
617
|
focusedLeadingAction = false,
|
|
547
618
|
focusedTrailingAction = false,
|
|
548
|
-
|
|
619
|
+
onClose,
|
|
620
|
+
onBack,
|
|
621
|
+
onCancel,
|
|
622
|
+
onDone,
|
|
623
|
+
onClear,
|
|
624
|
+
}: AudioPlayerHeaderProps) {
|
|
549
625
|
const { variant, title, closeButton, actionButtons } = configuration;
|
|
550
626
|
const { title: titleText } = data;
|
|
551
627
|
|
|
@@ -568,7 +644,10 @@ export function Item({
|
|
|
568
644
|
actionType={behavior.leading.actionType}
|
|
569
645
|
configuration={actionButtons}
|
|
570
646
|
focused={focusedLeadingAction}
|
|
647
|
+
onPress={onCancel}
|
|
571
648
|
/>
|
|
649
|
+
) : onBack ? (
|
|
650
|
+
<HeaderBackButton focused={focusedCloseButton} onPress={onBack} />
|
|
572
651
|
) : null;
|
|
573
652
|
|
|
574
653
|
const trailingContent = showTrailingAction ? (
|
|
@@ -576,17 +655,19 @@ export function Item({
|
|
|
576
655
|
actionType={behavior.trailing.actionType}
|
|
577
656
|
configuration={actionButtons}
|
|
578
657
|
focused={focusedTrailingAction}
|
|
658
|
+
onPress={behavior.trailing.actionType === "done" ? onDone : onClear}
|
|
579
659
|
/>
|
|
580
660
|
) : closeButton.enabled && !isCenterAligned ? (
|
|
581
661
|
<HeaderCloseButton
|
|
582
662
|
configuration={closeButton}
|
|
583
663
|
focused={focusedCloseButton}
|
|
664
|
+
onPress={onClose}
|
|
584
665
|
/>
|
|
585
666
|
) : null;
|
|
586
667
|
|
|
587
668
|
if (isCenterAligned) {
|
|
588
669
|
return (
|
|
589
|
-
<HeaderContainer variant={variant}>
|
|
670
|
+
<HeaderContainer variant={variant} configuration={configuration}>
|
|
590
671
|
<CenterAlignedHeaderLayout
|
|
591
672
|
horizontalGutter={container.horizontalGutter}
|
|
592
673
|
title={title}
|
|
@@ -599,7 +680,7 @@ export function Item({
|
|
|
599
680
|
}
|
|
600
681
|
|
|
601
682
|
return (
|
|
602
|
-
<HeaderContainer variant={variant}>
|
|
683
|
+
<HeaderContainer variant={variant} configuration={configuration}>
|
|
603
684
|
<View style={styles.row}>
|
|
604
685
|
{leadingContent ? (
|
|
605
686
|
<>
|
|
@@ -647,6 +728,7 @@ export const VARIANT_HEADER_WITH_ACTIONS: HeaderConfiguration = {
|
|
|
647
728
|
},
|
|
648
729
|
closeButton: { enabled: false },
|
|
649
730
|
actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
|
|
731
|
+
paddingTop: 16,
|
|
650
732
|
};
|
|
651
733
|
|
|
652
734
|
/** Variant 2 — single side action (layout rule demo) */
|
|
@@ -665,6 +747,7 @@ export const VARIANT_HEADER_WITH_CANCEL_ONLY: HeaderConfiguration = {
|
|
|
665
747
|
},
|
|
666
748
|
closeButton: { enabled: false },
|
|
667
749
|
actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
|
|
750
|
+
paddingTop: 16,
|
|
668
751
|
};
|
|
669
752
|
|
|
670
753
|
/** Variant 3 — Section Header */
|
|
@@ -692,7 +775,7 @@ export default function App() {
|
|
|
692
775
|
|
|
693
776
|
<View style={styles.demoBlock}>
|
|
694
777
|
<Text style={styles.demoLabel}>Single Line Header</Text>
|
|
695
|
-
<
|
|
778
|
+
<AudioPlayerHeader
|
|
696
779
|
configuration={VARIANT_SINGLE_LINE_HEADER}
|
|
697
780
|
data={{ title: "Playback Speed" }}
|
|
698
781
|
/>
|
|
@@ -700,7 +783,7 @@ export default function App() {
|
|
|
700
783
|
|
|
701
784
|
<View style={styles.demoBlock}>
|
|
702
785
|
<Text style={styles.demoLabel}>Header With Actions</Text>
|
|
703
|
-
<
|
|
786
|
+
<AudioPlayerHeader
|
|
704
787
|
configuration={VARIANT_HEADER_WITH_ACTIONS}
|
|
705
788
|
data={{ title: "Playback Speed" }}
|
|
706
789
|
/>
|
|
@@ -710,7 +793,7 @@ export default function App() {
|
|
|
710
793
|
<Text style={styles.demoLabel}>
|
|
711
794
|
Header With Actions — single side action
|
|
712
795
|
</Text>
|
|
713
|
-
<
|
|
796
|
+
<AudioPlayerHeader
|
|
714
797
|
configuration={VARIANT_HEADER_WITH_CANCEL_ONLY}
|
|
715
798
|
data={{ title: "Playback Speed" }}
|
|
716
799
|
/>
|
|
@@ -718,7 +801,7 @@ export default function App() {
|
|
|
718
801
|
|
|
719
802
|
<View style={styles.demoBlock}>
|
|
720
803
|
<Text style={styles.demoLabel}>Section Header</Text>
|
|
721
|
-
<
|
|
804
|
+
<AudioPlayerHeader
|
|
722
805
|
configuration={VARIANT_SECTION_HEADER}
|
|
723
806
|
data={{ title: "Next in Queue" }}
|
|
724
807
|
/>
|