@applicaster/zapp-react-native-ui-components 16.0.0-rc.85 → 16.0.0-rc.87
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/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +1 -23
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +1 -36
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +1 -26
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +30 -25
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +7 -2
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +48 -1
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +0 -2
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +18 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +54 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +92 -51
- package/Components/ModalComponent/SortableList.tsx +38 -23
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +17 -0
- package/Components/ModalComponent/index.tsx +7 -9
- package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -59
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -75
- package/Components/River/__tests__/componentsMap.test.js +8 -3
- package/Components/Screen/navigationHandler.ts +8 -8
- package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
- package/Contexts/ModalNavigationContext/index.tsx +2 -2
- package/package.json +5 -5
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -314
|
@@ -14,95 +14,125 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
14
14
|
>
|
|
15
15
|
<RCTScrollView
|
|
16
16
|
ListFooterComponent={
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"closed": false,
|
|
27
|
-
"currentObservers": null,
|
|
28
|
-
"hasError": false,
|
|
29
|
-
"isStopped": false,
|
|
30
|
-
"observers": [
|
|
31
|
-
SafeSubscriber {
|
|
32
|
-
"_finalizers": [
|
|
33
|
-
Subscription {
|
|
34
|
-
"_finalizers": null,
|
|
35
|
-
"_parentage": [Circular],
|
|
36
|
-
"closed": false,
|
|
37
|
-
"initialTeardown": [Function],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
"_parentage": null,
|
|
41
|
-
"closed": false,
|
|
42
|
-
"destination": ConsumerObserver {
|
|
43
|
-
"partialObserver": {
|
|
44
|
-
"complete": undefined,
|
|
45
|
-
"error": undefined,
|
|
46
|
-
"next": [Function],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
"initialTeardown": undefined,
|
|
50
|
-
"isStopped": false,
|
|
17
|
+
<React.Fragment>
|
|
18
|
+
<Memo(RiverFooterComponent)
|
|
19
|
+
flatListHeight={null}
|
|
20
|
+
loadingState={
|
|
21
|
+
BehaviorSubject {
|
|
22
|
+
"_value": {
|
|
23
|
+
"done": false,
|
|
24
|
+
"index": -1,
|
|
25
|
+
"waitForAllComponents": false,
|
|
51
26
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
27
|
+
"closed": false,
|
|
28
|
+
"currentObservers": null,
|
|
29
|
+
"hasError": false,
|
|
30
|
+
"isStopped": false,
|
|
31
|
+
"observers": [
|
|
32
|
+
SafeSubscriber {
|
|
33
|
+
"_finalizers": [
|
|
34
|
+
Subscription {
|
|
35
|
+
"_finalizers": null,
|
|
36
|
+
"_parentage": [Circular],
|
|
37
|
+
"closed": false,
|
|
38
|
+
"initialTeardown": [Function],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"_parentage": null,
|
|
42
|
+
"closed": false,
|
|
43
|
+
"destination": ConsumerObserver {
|
|
44
|
+
"partialObserver": {
|
|
45
|
+
"complete": undefined,
|
|
46
|
+
"error": undefined,
|
|
47
|
+
"next": [Function],
|
|
48
|
+
},
|
|
68
49
|
},
|
|
50
|
+
"initialTeardown": undefined,
|
|
51
|
+
"isStopped": false,
|
|
69
52
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
SafeSubscriber {
|
|
54
|
+
"_finalizers": [
|
|
55
|
+
Subscription {
|
|
56
|
+
"_finalizers": null,
|
|
57
|
+
"_parentage": [Circular],
|
|
58
|
+
"closed": false,
|
|
59
|
+
"initialTeardown": [Function],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
"_parentage": null,
|
|
63
|
+
"closed": false,
|
|
64
|
+
"destination": ConsumerObserver {
|
|
65
|
+
"partialObserver": {
|
|
66
|
+
"complete": undefined,
|
|
67
|
+
"error": undefined,
|
|
68
|
+
"next": [Function],
|
|
69
|
+
},
|
|
80
70
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
"initialTeardown": undefined,
|
|
72
|
+
"isStopped": false,
|
|
73
|
+
},
|
|
74
|
+
SafeSubscriber {
|
|
75
|
+
"_finalizers": [
|
|
76
|
+
Subscription {
|
|
77
|
+
"_finalizers": null,
|
|
78
|
+
"_parentage": [Circular],
|
|
79
|
+
"closed": false,
|
|
80
|
+
"initialTeardown": [Function],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
"_parentage": null,
|
|
84
|
+
"closed": false,
|
|
85
|
+
"destination": ConsumerObserver {
|
|
86
|
+
"partialObserver": {
|
|
87
|
+
"complete": undefined,
|
|
88
|
+
"error": undefined,
|
|
89
|
+
"next": [Function],
|
|
90
|
+
},
|
|
89
91
|
},
|
|
92
|
+
"initialTeardown": undefined,
|
|
93
|
+
"isStopped": false,
|
|
90
94
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
],
|
|
96
|
+
"thrownError": null,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
<View
|
|
101
|
+
edges={
|
|
102
|
+
{
|
|
103
|
+
"bottom": "off",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
mode="margin"
|
|
107
|
+
style={
|
|
108
|
+
{
|
|
109
|
+
"height": 0.5,
|
|
110
|
+
"paddingBottom": undefined,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/>
|
|
114
|
+
</React.Fragment>
|
|
115
|
+
}
|
|
116
|
+
ListHeaderComponent={
|
|
117
|
+
<View
|
|
118
|
+
edges={
|
|
119
|
+
{
|
|
120
|
+
"top": "off",
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
mode="margin"
|
|
124
|
+
style={
|
|
125
|
+
{
|
|
126
|
+
"height": 0.5,
|
|
127
|
+
"paddingTop": undefined,
|
|
96
128
|
}
|
|
97
129
|
}
|
|
98
130
|
/>
|
|
99
131
|
}
|
|
100
132
|
contentContainerStyle={
|
|
101
133
|
{
|
|
102
|
-
"paddingBottom": undefined,
|
|
103
134
|
"paddingLeft": undefined,
|
|
104
135
|
"paddingRight": undefined,
|
|
105
|
-
"paddingTop": undefined,
|
|
106
136
|
}
|
|
107
137
|
}
|
|
108
138
|
data={
|
|
@@ -156,6 +186,25 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
156
186
|
windowSize={12}
|
|
157
187
|
>
|
|
158
188
|
<View>
|
|
189
|
+
<View
|
|
190
|
+
collapsable={false}
|
|
191
|
+
onLayout={[Function]}
|
|
192
|
+
>
|
|
193
|
+
<View
|
|
194
|
+
edges={
|
|
195
|
+
{
|
|
196
|
+
"top": "off",
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
mode="margin"
|
|
200
|
+
style={
|
|
201
|
+
{
|
|
202
|
+
"height": 0.5,
|
|
203
|
+
"paddingTop": undefined,
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/>
|
|
207
|
+
</View>
|
|
159
208
|
<View
|
|
160
209
|
onFocusCapture={[Function]}
|
|
161
210
|
onLayout={[Function]}
|
|
@@ -200,6 +249,20 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
200
249
|
size="large"
|
|
201
250
|
/>
|
|
202
251
|
</View>
|
|
252
|
+
<View
|
|
253
|
+
edges={
|
|
254
|
+
{
|
|
255
|
+
"bottom": "off",
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
mode="margin"
|
|
259
|
+
style={
|
|
260
|
+
{
|
|
261
|
+
"height": 0.5,
|
|
262
|
+
"paddingBottom": undefined,
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/>
|
|
203
266
|
</View>
|
|
204
267
|
</View>
|
|
205
268
|
</RCTScrollView>
|
|
@@ -11,9 +11,14 @@ jest.mock(
|
|
|
11
11
|
() => () => null
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
jest.mock("react-native-safe-area-context", () =>
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
jest.mock("react-native-safe-area-context", () => {
|
|
15
|
+
const { View } = jest.requireActual("react-native");
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
SafeAreaView: View,
|
|
19
|
+
useSafeAreaInsets: () => ({ top: 50 }),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
17
22
|
|
|
18
23
|
jest.mock("react-native", () => {
|
|
19
24
|
const RN = jest.genMockFromModule("react-native");
|
|
@@ -18,10 +18,9 @@ function shouldShowNavigation(route, screenData) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
) {
|
|
21
|
+
const currentScreenData = screenData?.targetScreen || screenData;
|
|
22
|
+
|
|
23
|
+
if (currentScreenData.type === "qb_search_screen") {
|
|
25
24
|
return false;
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -31,10 +30,11 @@ function shouldShowNavigation(route, screenData) {
|
|
|
31
30
|
return hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (currentScreenData?.general?.hide_menu) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (currentScreenData?.general?.allow_screen_plugin_presentation) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.87",
|
|
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,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-rc.87",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.87",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-rc.87",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.87",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"react-native-sortables": "1.7.1",
|
|
@@ -1,314 +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
|
-
});
|
|
29
|
-
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
// Configuration (green / editable fields from spec)
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
|
|
34
|
-
export type TextTransform =
|
|
35
|
-
| "default"
|
|
36
|
-
| "lowercase"
|
|
37
|
-
| "uppercase"
|
|
38
|
-
| "capitalize";
|
|
39
|
-
|
|
40
|
-
export type BackgroundConfiguration = {
|
|
41
|
-
defaultColor: string;
|
|
42
|
-
focusedColor: string;
|
|
43
|
-
cornerRadius: number;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type TitleConfiguration = {
|
|
47
|
-
fontColor: string;
|
|
48
|
-
focusedFontColor: string;
|
|
49
|
-
iosFontFamily: string;
|
|
50
|
-
androidFontFamily: string;
|
|
51
|
-
fontSize: number;
|
|
52
|
-
lineHeight: number;
|
|
53
|
-
iosLetterSpacing: number;
|
|
54
|
-
androidLetterSpacing: number;
|
|
55
|
-
textTransform: TextTransform;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type TrailingIconConfiguration = {
|
|
59
|
-
chevronAsset?: string;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type ActionConfiguration = {
|
|
63
|
-
background: BackgroundConfiguration;
|
|
64
|
-
title: TitleConfiguration;
|
|
65
|
-
trailingIcon: TrailingIconConfiguration;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const DEFAULT_BACKGROUND_CONFIGURATION: BackgroundConfiguration = {
|
|
69
|
-
defaultColor: "transparent",
|
|
70
|
-
focusedColor: "rgba(62, 62, 62, 1)",
|
|
71
|
-
cornerRadius: 12,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const DEFAULT_TITLE_CONFIGURATION: TitleConfiguration = {
|
|
75
|
-
fontColor: "#FFFFFF",
|
|
76
|
-
focusedFontColor: "#FFFFFF",
|
|
77
|
-
iosFontFamily: "SFProText-Semibold",
|
|
78
|
-
androidFontFamily: "Roboto-Medium",
|
|
79
|
-
fontSize: 15,
|
|
80
|
-
lineHeight: 24,
|
|
81
|
-
iosLetterSpacing: -0.2,
|
|
82
|
-
androidLetterSpacing: 0,
|
|
83
|
-
textTransform: "default",
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const DEFAULT_TRAILING_ICON_CONFIGURATION: TrailingIconConfiguration =
|
|
87
|
-
{};
|
|
88
|
-
|
|
89
|
-
export const DEFAULT_ACTION_CONFIGURATION: ActionConfiguration = {
|
|
90
|
-
background: DEFAULT_BACKGROUND_CONFIGURATION,
|
|
91
|
-
title: DEFAULT_TITLE_CONFIGURATION,
|
|
92
|
-
trailingIcon: DEFAULT_TRAILING_ICON_CONFIGURATION,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// ---------------------------------------------------------------------------
|
|
96
|
-
// Data (runtime — controls which elements are shown)
|
|
97
|
-
// ---------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
export type LeadingActionType =
|
|
100
|
-
| "addToQueue"
|
|
101
|
-
| "addToPlaylist"
|
|
102
|
-
| "favorite"
|
|
103
|
-
| "share"
|
|
104
|
-
| "sleepTimer"
|
|
105
|
-
| "playbackSpeed";
|
|
106
|
-
|
|
107
|
-
export type ActionData = {
|
|
108
|
-
title: string;
|
|
109
|
-
/** When set, leading icon is shown (Enable: On). */
|
|
110
|
-
leadingActionType?: LeadingActionType;
|
|
111
|
-
/** When true, trailing chevron is shown (Enable: On). */
|
|
112
|
-
showTrailingChevron?: boolean;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export type AudioPlayerActionProps = {
|
|
116
|
-
configuration: ActionConfiguration;
|
|
117
|
-
data: ActionData;
|
|
118
|
-
focused?: boolean;
|
|
119
|
-
onPress?: () => void;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// ---------------------------------------------------------------------------
|
|
123
|
-
// Hardcoded spec values (white fields)
|
|
124
|
-
// ---------------------------------------------------------------------------
|
|
125
|
-
|
|
126
|
-
const CONTAINER_SPEC = {
|
|
127
|
-
paddingTop: 13,
|
|
128
|
-
paddingRight: 10,
|
|
129
|
-
paddingBottom: 13,
|
|
130
|
-
paddingLeft: 10,
|
|
131
|
-
horizontalGutter: 12,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const ICON_SPEC = {
|
|
135
|
-
width: 24,
|
|
136
|
-
height: 24,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const DEFAULT_CHEVRON_ASSET =
|
|
140
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAALElEQVR42mNgGAXUBlu2bPmPjIeWBeiGDy0Lhrbrh1/qGXqZaxSMglEw0gEA4c+IpUrpYX4AAAAASUVORK5CYII=";
|
|
141
|
-
|
|
142
|
-
/** Hardcoded: action type → leading icon asset (base64 PNG). */
|
|
143
|
-
const LEADING_ICON_ASSETS: Record<LeadingActionType, string> = {
|
|
144
|
-
addToQueue:
|
|
145
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAALElEQVR42mNgGAUjE/xHAzS3gFgweC0Y+nEwGslkBRFFwTj8LBjNyaNgmAMAJTf+EEEZcS0AAAAASUVORK5CYII=",
|
|
146
|
-
addToPlaylist:
|
|
147
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAKUlEQVR42mNgGAVDBvxHA6MWjFpAvEGkglELKLdgNJmOWkA7C0YBzQAAivu+UKRR1ZIAAAAASUVORK5CYII=",
|
|
148
|
-
favorite:
|
|
149
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAKklEQVR42mNgGAWjYBTgBP+xAGLkRi0YQhbgM4wqBo9aMHgsGAWjgCAAALyAZqh4yyZZAAAAAElFTkSuQmCC",
|
|
150
|
-
share:
|
|
151
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAK0lEQVR42mNgGAVDDvxHAqMWjFowUiz4TwQYgRYQYxBFlo1aMPAWjAK6AgD2g7pUUT7VeAAAAABJRU5ErkJggg==",
|
|
152
|
-
sleepTimer:
|
|
153
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAYUlEQVR42tWUSQ4AIAgD+f+n8eJRliIQ6MmEZTSxJZokvipdXgZpAbzOO17AglIXI7XULxmCoEMwRGuWam6AdRsN4IJYTRH4PIDkhxTA92zUPNBcFDDHaOVR0RJ2LXG9QgemFVK8tpo4PwAAAABJRU5ErkJggg==",
|
|
154
|
-
playbackSpeed:
|
|
155
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAK0lEQVR42mNgGAVDDvxHAqMWjFowUiz4TwQYgRYQYxBFlo1aMPAWjAK6AgD2g7pUUT7VeAAAAABJRU5ErkJggg==",
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
function getTextTransformStyle(
|
|
159
|
-
textTransform: TextTransform
|
|
160
|
-
): "none" | "lowercase" | "uppercase" | "capitalize" {
|
|
161
|
-
return textTransform === "default" ? "none" : textTransform;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function shouldShowLeadingIcon(leadingActionType?: LeadingActionType) {
|
|
165
|
-
return !!leadingActionType;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function shouldShowTrailingIcon(showTrailingChevron?: boolean) {
|
|
169
|
-
return !!showTrailingChevron;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ---------------------------------------------------------------------------
|
|
173
|
-
// Inner components
|
|
174
|
-
// ---------------------------------------------------------------------------
|
|
175
|
-
|
|
176
|
-
type ActionContainerProps = {
|
|
177
|
-
configuration: BackgroundConfiguration;
|
|
178
|
-
focused: boolean;
|
|
179
|
-
children: React.ReactNode;
|
|
180
|
-
onPress?: () => void;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
function ActionContainer({
|
|
184
|
-
configuration,
|
|
185
|
-
focused,
|
|
186
|
-
children,
|
|
187
|
-
onPress,
|
|
188
|
-
}: ActionContainerProps) {
|
|
189
|
-
return (
|
|
190
|
-
<Pressable
|
|
191
|
-
onPress={onPress}
|
|
192
|
-
style={({ pressed }) => ({
|
|
193
|
-
backgroundColor:
|
|
194
|
-
pressed || focused
|
|
195
|
-
? configuration.focusedColor
|
|
196
|
-
: configuration.defaultColor,
|
|
197
|
-
borderRadius: configuration.cornerRadius,
|
|
198
|
-
paddingTop: CONTAINER_SPEC.paddingTop,
|
|
199
|
-
paddingRight: CONTAINER_SPEC.paddingRight,
|
|
200
|
-
paddingBottom: CONTAINER_SPEC.paddingBottom,
|
|
201
|
-
paddingLeft: CONTAINER_SPEC.paddingLeft,
|
|
202
|
-
})}
|
|
203
|
-
>
|
|
204
|
-
{children}
|
|
205
|
-
</Pressable>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
type ActionTitleProps = {
|
|
210
|
-
title: string;
|
|
211
|
-
configuration: TitleConfiguration;
|
|
212
|
-
focused: boolean;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
function ActionTitle({ title, configuration, focused }: ActionTitleProps) {
|
|
216
|
-
const letterSpacing =
|
|
217
|
-
Platform.OS === "ios"
|
|
218
|
-
? configuration.iosLetterSpacing
|
|
219
|
-
: configuration.androidLetterSpacing;
|
|
220
|
-
|
|
221
|
-
return (
|
|
222
|
-
<Text
|
|
223
|
-
style={{
|
|
224
|
-
flex: 1,
|
|
225
|
-
color: focused
|
|
226
|
-
? configuration.focusedFontColor
|
|
227
|
-
: configuration.fontColor,
|
|
228
|
-
fontSize: configuration.fontSize,
|
|
229
|
-
lineHeight: configuration.lineHeight,
|
|
230
|
-
letterSpacing,
|
|
231
|
-
fontFamily: Platform.select({
|
|
232
|
-
ios: configuration.iosFontFamily,
|
|
233
|
-
android: configuration.androidFontFamily,
|
|
234
|
-
default: configuration.androidFontFamily,
|
|
235
|
-
}),
|
|
236
|
-
textTransform: getTextTransformStyle(configuration.textTransform),
|
|
237
|
-
}}
|
|
238
|
-
numberOfLines={1}
|
|
239
|
-
>
|
|
240
|
-
{title}
|
|
241
|
-
</Text>
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
type ActionLeadingIconProps = {
|
|
246
|
-
actionType: LeadingActionType;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
function ActionLeadingIcon({ actionType }: ActionLeadingIconProps) {
|
|
250
|
-
return (
|
|
251
|
-
<Image
|
|
252
|
-
source={{ uri: LEADING_ICON_ASSETS[actionType] }}
|
|
253
|
-
style={{ width: ICON_SPEC.width, height: ICON_SPEC.height }}
|
|
254
|
-
resizeMode="contain"
|
|
255
|
-
/>
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
type ActionTrailingIconProps = {
|
|
260
|
-
configuration: TrailingIconConfiguration;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
function ActionTrailingIcon({ configuration }: ActionTrailingIconProps) {
|
|
264
|
-
const asset = configuration.chevronAsset ?? DEFAULT_CHEVRON_ASSET;
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<Image
|
|
268
|
-
source={{ uri: asset }}
|
|
269
|
-
style={{ width: ICON_SPEC.width, height: ICON_SPEC.height }}
|
|
270
|
-
resizeMode="contain"
|
|
271
|
-
/>
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// ---------------------------------------------------------------------------
|
|
276
|
-
// AudioPlayerAction
|
|
277
|
-
// ---------------------------------------------------------------------------
|
|
278
|
-
|
|
279
|
-
export function AudioPlayerAction({
|
|
280
|
-
configuration,
|
|
281
|
-
data,
|
|
282
|
-
focused = false,
|
|
283
|
-
onPress,
|
|
284
|
-
}: AudioPlayerActionProps) {
|
|
285
|
-
const { background, title, trailingIcon } = configuration;
|
|
286
|
-
const { title: label, leadingActionType, showTrailingChevron } = data;
|
|
287
|
-
|
|
288
|
-
const showLeading = shouldShowLeadingIcon(leadingActionType);
|
|
289
|
-
const showTrailing = shouldShowTrailingIcon(showTrailingChevron);
|
|
290
|
-
|
|
291
|
-
return (
|
|
292
|
-
<ActionContainer
|
|
293
|
-
configuration={background}
|
|
294
|
-
focused={focused}
|
|
295
|
-
onPress={onPress}
|
|
296
|
-
>
|
|
297
|
-
<View style={styles.row}>
|
|
298
|
-
{showLeading ? (
|
|
299
|
-
<>
|
|
300
|
-
<ActionLeadingIcon actionType={leadingActionType} />
|
|
301
|
-
<View style={{ width: CONTAINER_SPEC.horizontalGutter }} />
|
|
302
|
-
</>
|
|
303
|
-
) : null}
|
|
304
|
-
<ActionTitle title={label} configuration={title} focused={focused} />
|
|
305
|
-
{showTrailing ? (
|
|
306
|
-
<>
|
|
307
|
-
<View style={{ width: CONTAINER_SPEC.horizontalGutter }} />
|
|
308
|
-
<ActionTrailingIcon configuration={trailingIcon} />
|
|
309
|
-
</>
|
|
310
|
-
) : null}
|
|
311
|
-
</View>
|
|
312
|
-
</ActionContainer>
|
|
313
|
-
);
|
|
314
|
-
}
|