@applicaster/zapp-react-native-ui-components 15.1.6-alpha.2015591222 → 15.1.6
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/ModalComponent/AudioPlayer/Components/Action.tsx +69 -33
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +47 -25
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +39 -122
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +131 -299
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +4 -8
- package/Components/ModalComponent/BottomSheetModalContent.tsx +55 -290
- package/Components/ModalComponent/Button/index.tsx +3 -5
- package/Components/ModalComponent/Header/utils.ts +1 -1
- package/Components/ModalComponent/index.tsx +0 -11
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +13 -82
- package/Components/OfflineHandler/__tests__/index.test.tsx +100 -35
- package/Components/OfflineHandler/hooks.ts +123 -0
- package/Components/OfflineHandler/index.tsx +51 -73
- package/Components/OfflineHandler/utils/index.ts +1 -13
- package/package.json +5 -6
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +0 -671
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +0 -86
- package/Components/ModalComponent/SortableList.tsx +0 -142
- package/Components/ModalComponent/TextInputContent.tsx +0 -100
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +0 -183
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +0 -128
- package/Components/ModalComponent/__tests__/showTextInput.test.ts +0 -95
- package/Components/ModalComponent/presets/__tests__/getCell.test.ts +0 -66
- package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +0 -74
- package/Components/ModalComponent/presets/index.ts +0 -27
- package/Components/ModalComponent/presets/selectableCell.tsx +0 -27
- package/Components/ModalComponent/presets/standardCell.tsx +0 -41
- package/Components/ModalComponent/presets/types.ts +0 -35
- package/Components/ModalComponent/showTextInput.ts +0 -43
- 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
|
@@ -11,14 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import React from "react";
|
|
14
|
-
import {
|
|
15
|
-
Image,
|
|
16
|
-
Platform,
|
|
17
|
-
Pressable,
|
|
18
|
-
StyleSheet,
|
|
19
|
-
Text,
|
|
20
|
-
View,
|
|
21
|
-
} from "react-native";
|
|
14
|
+
import { Image, Platform, StyleSheet, Text, View } from "react-native";
|
|
22
15
|
|
|
23
16
|
const styles = StyleSheet.create({
|
|
24
17
|
row: {
|
|
@@ -130,11 +123,10 @@ export type ActionData = {
|
|
|
130
123
|
showTrailingChevron?: boolean;
|
|
131
124
|
};
|
|
132
125
|
|
|
133
|
-
export type
|
|
126
|
+
export type ItemProps = {
|
|
134
127
|
configuration: ActionConfiguration;
|
|
135
128
|
data: ActionData;
|
|
136
129
|
focused?: boolean;
|
|
137
|
-
onPress?: () => void;
|
|
138
130
|
};
|
|
139
131
|
|
|
140
132
|
// ---------------------------------------------------------------------------
|
|
@@ -195,32 +187,28 @@ type ActionContainerProps = {
|
|
|
195
187
|
configuration: BackgroundConfiguration;
|
|
196
188
|
focused: boolean;
|
|
197
189
|
children: React.ReactNode;
|
|
198
|
-
onPress?: () => void;
|
|
199
190
|
};
|
|
200
191
|
|
|
201
192
|
function ActionContainer({
|
|
202
193
|
configuration,
|
|
203
194
|
focused,
|
|
204
195
|
children,
|
|
205
|
-
onPress,
|
|
206
196
|
}: ActionContainerProps) {
|
|
207
197
|
return (
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
? configuration.focusedColor
|
|
214
|
-
: configuration.defaultColor,
|
|
198
|
+
<View
|
|
199
|
+
style={{
|
|
200
|
+
backgroundColor: focused
|
|
201
|
+
? configuration.focusedColor
|
|
202
|
+
: configuration.defaultColor,
|
|
215
203
|
borderRadius: configuration.cornerRadius,
|
|
216
204
|
paddingTop: CONTAINER_SPEC.paddingTop,
|
|
217
205
|
paddingRight: CONTAINER_SPEC.paddingRight,
|
|
218
206
|
paddingBottom: CONTAINER_SPEC.paddingBottom,
|
|
219
207
|
paddingLeft: CONTAINER_SPEC.paddingLeft,
|
|
220
|
-
}
|
|
208
|
+
}}
|
|
221
209
|
>
|
|
222
210
|
{children}
|
|
223
|
-
</
|
|
211
|
+
</View>
|
|
224
212
|
);
|
|
225
213
|
}
|
|
226
214
|
|
|
@@ -291,15 +279,10 @@ function ActionTrailingIcon({ configuration }: ActionTrailingIconProps) {
|
|
|
291
279
|
}
|
|
292
280
|
|
|
293
281
|
// ---------------------------------------------------------------------------
|
|
294
|
-
//
|
|
282
|
+
// Item
|
|
295
283
|
// ---------------------------------------------------------------------------
|
|
296
284
|
|
|
297
|
-
export function
|
|
298
|
-
configuration,
|
|
299
|
-
data,
|
|
300
|
-
focused = false,
|
|
301
|
-
onPress,
|
|
302
|
-
}: AudioPlayerActionProps) {
|
|
285
|
+
export function Item({ configuration, data, focused = false }: ItemProps) {
|
|
303
286
|
const { background, title, trailingIcon } = configuration;
|
|
304
287
|
const { title: label, leadingActionType, showTrailingChevron } = data;
|
|
305
288
|
|
|
@@ -307,11 +290,7 @@ export function AudioPlayerAction({
|
|
|
307
290
|
const showTrailing = shouldShowTrailingIcon(showTrailingChevron);
|
|
308
291
|
|
|
309
292
|
return (
|
|
310
|
-
<ActionContainer
|
|
311
|
-
configuration={background}
|
|
312
|
-
focused={focused}
|
|
313
|
-
onPress={onPress}
|
|
314
|
-
>
|
|
293
|
+
<ActionContainer configuration={background} focused={focused}>
|
|
315
294
|
<View style={styles.row}>
|
|
316
295
|
{showLeading ? (
|
|
317
296
|
<>
|
|
@@ -330,3 +309,60 @@ export function AudioPlayerAction({
|
|
|
330
309
|
</ActionContainer>
|
|
331
310
|
);
|
|
332
311
|
}
|
|
312
|
+
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Demo
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
|
|
317
|
+
export default function App() {
|
|
318
|
+
return (
|
|
319
|
+
<View style={styles.demoScreen}>
|
|
320
|
+
<Text style={styles.demoHeading}>Modal Action Building Block</Text>
|
|
321
|
+
|
|
322
|
+
<Text style={styles.demoLabel}>
|
|
323
|
+
Leading icon + text — Add To Queue (focused)
|
|
324
|
+
</Text>
|
|
325
|
+
<Item
|
|
326
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
327
|
+
data={{ title: "Add To Queue", leadingActionType: "addToQueue" }}
|
|
328
|
+
focused
|
|
329
|
+
/>
|
|
330
|
+
|
|
331
|
+
<Text style={styles.demoLabel}>
|
|
332
|
+
Leading icon + text + trailing chevron — Add To Playlist
|
|
333
|
+
</Text>
|
|
334
|
+
<Item
|
|
335
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
336
|
+
data={{
|
|
337
|
+
title: "Add To Playlist",
|
|
338
|
+
leadingActionType: "addToPlaylist",
|
|
339
|
+
showTrailingChevron: true,
|
|
340
|
+
}}
|
|
341
|
+
/>
|
|
342
|
+
|
|
343
|
+
<Text style={styles.demoLabel}>Text only — Go To Playlist</Text>
|
|
344
|
+
<Item
|
|
345
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
346
|
+
data={{ title: "Go To Playlist" }}
|
|
347
|
+
/>
|
|
348
|
+
|
|
349
|
+
<Text style={styles.demoLabel}>Leading icon + text — Favorite</Text>
|
|
350
|
+
<Item
|
|
351
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
352
|
+
data={{ title: "Favorite", leadingActionType: "favorite" }}
|
|
353
|
+
/>
|
|
354
|
+
|
|
355
|
+
<Text style={styles.demoLabel}>Leading icon + text — Share</Text>
|
|
356
|
+
<Item
|
|
357
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
358
|
+
data={{ title: "Share", leadingActionType: "share" }}
|
|
359
|
+
/>
|
|
360
|
+
|
|
361
|
+
<Text style={styles.demoLabel}>Text only — Go To Artist</Text>
|
|
362
|
+
<Item
|
|
363
|
+
configuration={DEFAULT_ACTION_CONFIGURATION}
|
|
364
|
+
data={{ title: "Go To Artist" }}
|
|
365
|
+
/>
|
|
366
|
+
</View>
|
|
367
|
+
);
|
|
368
|
+
}
|
|
@@ -9,14 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import React from "react";
|
|
12
|
-
import {
|
|
13
|
-
Image,
|
|
14
|
-
Platform,
|
|
15
|
-
Pressable,
|
|
16
|
-
StyleSheet,
|
|
17
|
-
Text,
|
|
18
|
-
View,
|
|
19
|
-
} from "react-native";
|
|
12
|
+
import { Image, Platform, StyleSheet, Text, View } from "react-native";
|
|
20
13
|
|
|
21
14
|
const styles = StyleSheet.create({
|
|
22
15
|
container: {
|
|
@@ -155,12 +148,11 @@ export type ButtonData = {
|
|
|
155
148
|
disabled?: boolean;
|
|
156
149
|
};
|
|
157
150
|
|
|
158
|
-
export type
|
|
151
|
+
export type ItemProps = {
|
|
159
152
|
configuration: ButtonConfiguration;
|
|
160
153
|
data: ButtonData;
|
|
161
154
|
disabled?: boolean;
|
|
162
155
|
focused?: boolean;
|
|
163
|
-
onPress?: () => void;
|
|
164
156
|
};
|
|
165
157
|
|
|
166
158
|
// ---------------------------------------------------------------------------
|
|
@@ -178,7 +170,7 @@ const ACTION_ICON_ASSETS: Record<ButtonActionType, string> = {
|
|
|
178
170
|
confirm:
|
|
179
171
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAJElEQVR42mNgGAWjYBSQCv4TwKMWDHELho/hNE/3o2AUDDcAAPv0QMAyy1CtAAAAAElFTkSuQmCC",
|
|
180
172
|
cancel:
|
|
181
|
-
"data:image/png;base64,
|
|
173
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAASElEQVR42mNgGAUjGvynkVoUTf+pqA6nxv8UqiHbEooNx2cQ1QzHZiDVDcdlCcOQsoCmQUTTSKZpMqV5RqNLUUHTwm4UDBMAALBLQ73LTvoyAAAAAElFTkSuQmCC",
|
|
182
174
|
};
|
|
183
175
|
|
|
184
176
|
function getTextTransformStyle(
|
|
@@ -200,7 +192,6 @@ type ButtonContainerProps = {
|
|
|
200
192
|
disabled: boolean;
|
|
201
193
|
configuration: BackgroundConfiguration;
|
|
202
194
|
children: React.ReactNode;
|
|
203
|
-
onPress?: () => void;
|
|
204
195
|
};
|
|
205
196
|
|
|
206
197
|
function ButtonContainer({
|
|
@@ -208,22 +199,19 @@ function ButtonContainer({
|
|
|
208
199
|
disabled,
|
|
209
200
|
configuration,
|
|
210
201
|
children,
|
|
211
|
-
onPress,
|
|
212
202
|
}: ButtonContainerProps) {
|
|
213
|
-
const
|
|
203
|
+
const backgroundColor = disabled
|
|
214
204
|
? configuration.inactiveColor
|
|
215
205
|
: focused
|
|
216
206
|
? configuration.focusedColor
|
|
217
207
|
: configuration.defaultColor;
|
|
218
208
|
|
|
219
209
|
return (
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
style={({ pressed }) => [
|
|
210
|
+
<View
|
|
211
|
+
style={[
|
|
223
212
|
styles.container,
|
|
224
213
|
{
|
|
225
|
-
backgroundColor
|
|
226
|
-
pressed && !disabled ? configuration.focusedColor : defaultBgColor,
|
|
214
|
+
backgroundColor,
|
|
227
215
|
borderRadius: configuration.cornerRadius,
|
|
228
216
|
paddingTop: configuration.paddingTop,
|
|
229
217
|
paddingRight: configuration.paddingRight,
|
|
@@ -233,7 +221,7 @@ function ButtonContainer({
|
|
|
233
221
|
]}
|
|
234
222
|
>
|
|
235
223
|
{children}
|
|
236
|
-
</
|
|
224
|
+
</View>
|
|
237
225
|
);
|
|
238
226
|
}
|
|
239
227
|
|
|
@@ -307,16 +295,15 @@ function ButtonLeadingIcon({
|
|
|
307
295
|
}
|
|
308
296
|
|
|
309
297
|
// ---------------------------------------------------------------------------
|
|
310
|
-
//
|
|
298
|
+
// Item — single building block driven by configuration + data
|
|
311
299
|
// ---------------------------------------------------------------------------
|
|
312
300
|
|
|
313
|
-
export function
|
|
301
|
+
export function Item({
|
|
314
302
|
configuration,
|
|
315
303
|
data,
|
|
316
304
|
disabled,
|
|
317
305
|
focused = false,
|
|
318
|
-
|
|
319
|
-
}: AudioPlayerButtonProps) {
|
|
306
|
+
}: ItemProps) {
|
|
320
307
|
const {
|
|
321
308
|
background: backgroundConfiguration,
|
|
322
309
|
title: titleConfiguration,
|
|
@@ -334,7 +321,6 @@ export function AudioPlayerButton({
|
|
|
334
321
|
focused={focused}
|
|
335
322
|
disabled={isDisabled}
|
|
336
323
|
configuration={backgroundConfiguration}
|
|
337
|
-
onPress={onPress}
|
|
338
324
|
>
|
|
339
325
|
<View style={styles.contentRow}>
|
|
340
326
|
{showIcon ? (
|
|
@@ -400,3 +386,39 @@ export const VARIANT_LARGE_ICON: ButtonConfiguration = {
|
|
|
400
386
|
},
|
|
401
387
|
},
|
|
402
388
|
};
|
|
389
|
+
|
|
390
|
+
export default function App() {
|
|
391
|
+
return (
|
|
392
|
+
<View style={styles.demoScreen}>
|
|
393
|
+
<Text style={styles.demoHeading}>Modal Button Building Block</Text>
|
|
394
|
+
|
|
395
|
+
<Text style={styles.demoLabel}>Variant 1 — Text only (confirmation)</Text>
|
|
396
|
+
<Item configuration={VARIANT_TEXT_ONLY} data={{ title: "Confirm" }} />
|
|
397
|
+
|
|
398
|
+
<Text style={styles.demoLabel}>Variant 2 — Leading icon + text</Text>
|
|
399
|
+
<Item
|
|
400
|
+
configuration={VARIANT_WITH_ICON}
|
|
401
|
+
data={{ title: "Add To Playlist" }}
|
|
402
|
+
/>
|
|
403
|
+
|
|
404
|
+
<Text style={styles.demoLabel}>Inactive state</Text>
|
|
405
|
+
<Item
|
|
406
|
+
configuration={VARIANT_TEXT_ONLY}
|
|
407
|
+
data={{ title: "Unavailable" }}
|
|
408
|
+
disabled
|
|
409
|
+
/>
|
|
410
|
+
|
|
411
|
+
<Text style={styles.demoLabel}>Custom title config — uppercase</Text>
|
|
412
|
+
<Item
|
|
413
|
+
configuration={VARIANT_UPPERCASE_TITLE}
|
|
414
|
+
data={{ title: "Save Changes" }}
|
|
415
|
+
/>
|
|
416
|
+
|
|
417
|
+
<Text style={styles.demoLabel}>Custom icons config — 32×32</Text>
|
|
418
|
+
<Item
|
|
419
|
+
configuration={VARIANT_LARGE_ICON}
|
|
420
|
+
data={{ title: "Add To Queue" }}
|
|
421
|
+
/>
|
|
422
|
+
</View>
|
|
423
|
+
);
|
|
424
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import React, { useCallback, useState } from "react";
|
|
12
|
-
import {
|
|
12
|
+
import { Image, Platform, StyleSheet, Text, View } from "react-native";
|
|
13
13
|
|
|
14
14
|
const styles = StyleSheet.create({
|
|
15
15
|
row: {
|
|
@@ -123,7 +123,6 @@ export type ActionButtonsStyleConfiguration = {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
export type HeaderConfiguration = {
|
|
126
|
-
paddingTop?: number;
|
|
127
126
|
variant: HeaderVariant;
|
|
128
127
|
title: TitleConfiguration;
|
|
129
128
|
closeButton: CloseButtonConfiguration;
|
|
@@ -169,17 +168,12 @@ export type HeaderData = {
|
|
|
169
168
|
title: string;
|
|
170
169
|
};
|
|
171
170
|
|
|
172
|
-
export type
|
|
171
|
+
export type ItemProps = {
|
|
173
172
|
configuration: HeaderConfiguration;
|
|
174
173
|
data: HeaderData;
|
|
175
174
|
focusedCloseButton?: boolean;
|
|
176
175
|
focusedLeadingAction?: boolean;
|
|
177
176
|
focusedTrailingAction?: boolean;
|
|
178
|
-
onClose?: () => void;
|
|
179
|
-
onBack?: () => void;
|
|
180
|
-
onCancel?: () => void;
|
|
181
|
-
onDone?: () => void;
|
|
182
|
-
onClear?: () => void;
|
|
183
177
|
};
|
|
184
178
|
|
|
185
179
|
// ---------------------------------------------------------------------------
|
|
@@ -208,9 +202,9 @@ type ActionButtonsBehaviorSpec = {
|
|
|
208
202
|
const CONTAINER_SPEC: Record<HeaderVariant, ContainerSpec> = {
|
|
209
203
|
singleLine: {
|
|
210
204
|
horizontalGutter: 16,
|
|
211
|
-
paddingTop:
|
|
212
|
-
paddingRight:
|
|
213
|
-
paddingBottom:
|
|
205
|
+
paddingTop: 0,
|
|
206
|
+
paddingRight: 14,
|
|
207
|
+
paddingBottom: 8,
|
|
214
208
|
paddingLeft: 20,
|
|
215
209
|
},
|
|
216
210
|
headerWithActions: {
|
|
@@ -262,6 +256,9 @@ const ACTION_BUTTONS_BEHAVIOR: Record<
|
|
|
262
256
|
},
|
|
263
257
|
};
|
|
264
258
|
|
|
259
|
+
const DEFAULT_CLOSE_BUTTON_ASSET =
|
|
260
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAl0lEQVR42u2YQQ7AIAgE/f+naQ899dDYyiLT7DyAnRijwBjGGLNEnKCy4qJCNlVYKZ2aETeUshLhTGlZbUVh5UGkB8hlM4PKZDMCy2VXgrfJfhHYLvtGpI3sjFA72SextrKz0m1bUYwsTvhX97f9C4F8g5G/HLKPQHZqyF4YOW0g5znkxCytjV6koFZVqGVg5Yc0jDFmiQNENiwNUMoCZAAAAABJRU5ErkJggg==";
|
|
261
|
+
|
|
265
262
|
const CLOSE_BUTTON_SPEC = {
|
|
266
263
|
width: 44,
|
|
267
264
|
height: 44,
|
|
@@ -301,26 +298,16 @@ function shouldShowActionSlot(slot: ActionSlotSpec, sectionEnabled: boolean) {
|
|
|
301
298
|
|
|
302
299
|
type HeaderContainerProps = {
|
|
303
300
|
variant: HeaderVariant;
|
|
304
|
-
configuration: HeaderConfiguration;
|
|
305
301
|
children: React.ReactNode;
|
|
306
302
|
};
|
|
307
303
|
|
|
308
|
-
function HeaderContainer({
|
|
309
|
-
variant,
|
|
310
|
-
configuration,
|
|
311
|
-
children,
|
|
312
|
-
}: HeaderContainerProps) {
|
|
304
|
+
function HeaderContainer({ variant, children }: HeaderContainerProps) {
|
|
313
305
|
const container = CONTAINER_SPEC[variant];
|
|
314
306
|
|
|
315
|
-
const paddingTop =
|
|
316
|
-
configuration.paddingTop !== undefined
|
|
317
|
-
? configuration.paddingTop
|
|
318
|
-
: container.paddingTop;
|
|
319
|
-
|
|
320
307
|
return (
|
|
321
308
|
<View
|
|
322
309
|
style={{
|
|
323
|
-
paddingTop: paddingTop,
|
|
310
|
+
paddingTop: container.paddingTop,
|
|
324
311
|
paddingRight: container.paddingRight,
|
|
325
312
|
paddingBottom: container.paddingBottom,
|
|
326
313
|
paddingLeft: container.paddingLeft,
|
|
@@ -369,80 +356,21 @@ function HeaderTitle({ title, configuration, centered }: HeaderTitleProps) {
|
|
|
369
356
|
type HeaderCloseButtonProps = {
|
|
370
357
|
configuration: CloseButtonConfiguration;
|
|
371
358
|
focused?: boolean;
|
|
372
|
-
onPress?: () => void;
|
|
373
359
|
};
|
|
374
360
|
|
|
375
361
|
function HeaderCloseButton({
|
|
376
362
|
configuration,
|
|
377
363
|
focused = false,
|
|
378
|
-
onPress,
|
|
379
364
|
}: HeaderCloseButtonProps) {
|
|
380
365
|
if (!configuration.enabled) {
|
|
381
366
|
return null;
|
|
382
367
|
}
|
|
383
368
|
|
|
384
|
-
const
|
|
369
|
+
const asset = configuration.asset ?? DEFAULT_CLOSE_BUTTON_ASSET;
|
|
385
370
|
|
|
386
371
|
return (
|
|
387
|
-
<
|
|
388
|
-
|
|
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 }) => [
|
|
372
|
+
<View
|
|
373
|
+
style={[
|
|
446
374
|
styles.closeButton,
|
|
447
375
|
{
|
|
448
376
|
width: CLOSE_BUTTON_SPEC.width,
|
|
@@ -454,14 +382,19 @@ function HeaderBackButton({ focused = false, onPress }: HeaderBackButtonProps) {
|
|
|
454
382
|
borderRadius: CLOSE_BUTTON_SPEC.width / 2,
|
|
455
383
|
borderWidth: 1,
|
|
456
384
|
borderColor: "#FFFFFF",
|
|
457
|
-
opacity:
|
|
385
|
+
opacity: focused ? 0.7 : 1,
|
|
458
386
|
},
|
|
459
387
|
]}
|
|
460
388
|
>
|
|
461
|
-
<
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
389
|
+
<Image
|
|
390
|
+
source={{ uri: asset }}
|
|
391
|
+
style={{
|
|
392
|
+
width: CLOSE_BUTTON_SPEC.width * 0.55,
|
|
393
|
+
height: CLOSE_BUTTON_SPEC.height * 0.55,
|
|
394
|
+
}}
|
|
395
|
+
resizeMode="contain"
|
|
396
|
+
/>
|
|
397
|
+
</View>
|
|
465
398
|
);
|
|
466
399
|
}
|
|
467
400
|
|
|
@@ -469,29 +402,25 @@ type HeaderActionButtonProps = {
|
|
|
469
402
|
actionType: HeaderActionType;
|
|
470
403
|
configuration: ActionButtonsStyleConfiguration;
|
|
471
404
|
focused?: boolean;
|
|
472
|
-
onPress?: () => void;
|
|
473
405
|
};
|
|
474
406
|
|
|
475
407
|
function HeaderActionButton({
|
|
476
408
|
actionType,
|
|
477
409
|
configuration,
|
|
478
410
|
focused = false,
|
|
479
|
-
onPress,
|
|
480
411
|
}: HeaderActionButtonProps) {
|
|
481
412
|
return (
|
|
482
|
-
<
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
? configuration.focusedBackgroundColor
|
|
488
|
-
: configuration.defaultBackgroundColor,
|
|
413
|
+
<View
|
|
414
|
+
style={{
|
|
415
|
+
backgroundColor: focused
|
|
416
|
+
? configuration.focusedBackgroundColor
|
|
417
|
+
: configuration.defaultBackgroundColor,
|
|
489
418
|
borderRadius: ACTION_BUTTON_LAYOUT_SPEC.cornerRadius,
|
|
490
419
|
paddingTop: ACTION_BUTTON_LAYOUT_SPEC.paddingTop,
|
|
491
420
|
paddingRight: ACTION_BUTTON_LAYOUT_SPEC.paddingRight,
|
|
492
421
|
paddingBottom: ACTION_BUTTON_LAYOUT_SPEC.paddingBottom,
|
|
493
422
|
paddingLeft: ACTION_BUTTON_LAYOUT_SPEC.paddingLeft,
|
|
494
|
-
}
|
|
423
|
+
}}
|
|
495
424
|
>
|
|
496
425
|
<Text
|
|
497
426
|
style={{
|
|
@@ -515,7 +444,7 @@ function HeaderActionButton({
|
|
|
515
444
|
>
|
|
516
445
|
{ACTION_LABELS[actionType]}
|
|
517
446
|
</Text>
|
|
518
|
-
</
|
|
447
|
+
</View>
|
|
519
448
|
);
|
|
520
449
|
}
|
|
521
450
|
|
|
@@ -607,21 +536,16 @@ function CenterAlignedHeaderLayout({
|
|
|
607
536
|
}
|
|
608
537
|
|
|
609
538
|
// ---------------------------------------------------------------------------
|
|
610
|
-
//
|
|
539
|
+
// Item
|
|
611
540
|
// ---------------------------------------------------------------------------
|
|
612
541
|
|
|
613
|
-
export function
|
|
542
|
+
export function Item({
|
|
614
543
|
configuration,
|
|
615
544
|
data,
|
|
616
545
|
focusedCloseButton = false,
|
|
617
546
|
focusedLeadingAction = false,
|
|
618
547
|
focusedTrailingAction = false,
|
|
619
|
-
|
|
620
|
-
onBack,
|
|
621
|
-
onCancel,
|
|
622
|
-
onDone,
|
|
623
|
-
onClear,
|
|
624
|
-
}: AudioPlayerHeaderProps) {
|
|
548
|
+
}: ItemProps) {
|
|
625
549
|
const { variant, title, closeButton, actionButtons } = configuration;
|
|
626
550
|
const { title: titleText } = data;
|
|
627
551
|
|
|
@@ -644,10 +568,7 @@ export function AudioPlayerHeader({
|
|
|
644
568
|
actionType={behavior.leading.actionType}
|
|
645
569
|
configuration={actionButtons}
|
|
646
570
|
focused={focusedLeadingAction}
|
|
647
|
-
onPress={onCancel}
|
|
648
571
|
/>
|
|
649
|
-
) : onBack ? (
|
|
650
|
-
<HeaderBackButton focused={focusedCloseButton} onPress={onBack} />
|
|
651
572
|
) : null;
|
|
652
573
|
|
|
653
574
|
const trailingContent = showTrailingAction ? (
|
|
@@ -655,19 +576,17 @@ export function AudioPlayerHeader({
|
|
|
655
576
|
actionType={behavior.trailing.actionType}
|
|
656
577
|
configuration={actionButtons}
|
|
657
578
|
focused={focusedTrailingAction}
|
|
658
|
-
onPress={behavior.trailing.actionType === "done" ? onDone : onClear}
|
|
659
579
|
/>
|
|
660
580
|
) : closeButton.enabled && !isCenterAligned ? (
|
|
661
581
|
<HeaderCloseButton
|
|
662
582
|
configuration={closeButton}
|
|
663
583
|
focused={focusedCloseButton}
|
|
664
|
-
onPress={onClose}
|
|
665
584
|
/>
|
|
666
585
|
) : null;
|
|
667
586
|
|
|
668
587
|
if (isCenterAligned) {
|
|
669
588
|
return (
|
|
670
|
-
<HeaderContainer variant={variant}
|
|
589
|
+
<HeaderContainer variant={variant}>
|
|
671
590
|
<CenterAlignedHeaderLayout
|
|
672
591
|
horizontalGutter={container.horizontalGutter}
|
|
673
592
|
title={title}
|
|
@@ -680,7 +599,7 @@ export function AudioPlayerHeader({
|
|
|
680
599
|
}
|
|
681
600
|
|
|
682
601
|
return (
|
|
683
|
-
<HeaderContainer variant={variant}
|
|
602
|
+
<HeaderContainer variant={variant}>
|
|
684
603
|
<View style={styles.row}>
|
|
685
604
|
{leadingContent ? (
|
|
686
605
|
<>
|
|
@@ -728,7 +647,6 @@ export const VARIANT_HEADER_WITH_ACTIONS: HeaderConfiguration = {
|
|
|
728
647
|
},
|
|
729
648
|
closeButton: { enabled: false },
|
|
730
649
|
actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
|
|
731
|
-
paddingTop: 16,
|
|
732
650
|
};
|
|
733
651
|
|
|
734
652
|
/** Variant 2 — single side action (layout rule demo) */
|
|
@@ -747,7 +665,6 @@ export const VARIANT_HEADER_WITH_CANCEL_ONLY: HeaderConfiguration = {
|
|
|
747
665
|
},
|
|
748
666
|
closeButton: { enabled: false },
|
|
749
667
|
actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
|
|
750
|
-
paddingTop: 16,
|
|
751
668
|
};
|
|
752
669
|
|
|
753
670
|
/** Variant 3 — Section Header */
|
|
@@ -775,7 +692,7 @@ export default function App() {
|
|
|
775
692
|
|
|
776
693
|
<View style={styles.demoBlock}>
|
|
777
694
|
<Text style={styles.demoLabel}>Single Line Header</Text>
|
|
778
|
-
<
|
|
695
|
+
<Item
|
|
779
696
|
configuration={VARIANT_SINGLE_LINE_HEADER}
|
|
780
697
|
data={{ title: "Playback Speed" }}
|
|
781
698
|
/>
|
|
@@ -783,7 +700,7 @@ export default function App() {
|
|
|
783
700
|
|
|
784
701
|
<View style={styles.demoBlock}>
|
|
785
702
|
<Text style={styles.demoLabel}>Header With Actions</Text>
|
|
786
|
-
<
|
|
703
|
+
<Item
|
|
787
704
|
configuration={VARIANT_HEADER_WITH_ACTIONS}
|
|
788
705
|
data={{ title: "Playback Speed" }}
|
|
789
706
|
/>
|
|
@@ -793,7 +710,7 @@ export default function App() {
|
|
|
793
710
|
<Text style={styles.demoLabel}>
|
|
794
711
|
Header With Actions — single side action
|
|
795
712
|
</Text>
|
|
796
|
-
<
|
|
713
|
+
<Item
|
|
797
714
|
configuration={VARIANT_HEADER_WITH_CANCEL_ONLY}
|
|
798
715
|
data={{ title: "Playback Speed" }}
|
|
799
716
|
/>
|
|
@@ -801,7 +718,7 @@ export default function App() {
|
|
|
801
718
|
|
|
802
719
|
<View style={styles.demoBlock}>
|
|
803
720
|
<Text style={styles.demoLabel}>Section Header</Text>
|
|
804
|
-
<
|
|
721
|
+
<Item
|
|
805
722
|
configuration={VARIANT_SECTION_HEADER}
|
|
806
723
|
data={{ title: "Next in Queue" }}
|
|
807
724
|
/>
|