@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3013095924 → 13.0.0-alpha.3044917147
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/AudioPlayer/AudioPlayerLayout.tsx +8 -9
- package/Components/ModalComponent/BottomSheetModalContent.tsx +26 -22
- package/Components/PlayerContainer/PlayerContainer.tsx +21 -39
- package/Components/River/ComponentsMap/ComponentsMap.tsx +11 -3
- package/Components/River/RiverItem.tsx +6 -2
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +7 -1
- package/Components/RouteManager/TestId.tsx +1 -5
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +0 -1
- package/Components/RouteManager/__tests__/testId.test.js +0 -4
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -0
- package/package.json +5 -5
|
@@ -32,7 +32,7 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
|
32
32
|
|
|
33
33
|
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const backgroundImageSource = { uri: backgroundImage };
|
|
36
36
|
|
|
37
37
|
const backgroundColorStyle = backgroundImage
|
|
38
38
|
? "transparent"
|
|
@@ -97,15 +97,14 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
|
97
97
|
|
|
98
98
|
const backgroundImgStyles = platformSelect({
|
|
99
99
|
tvos: {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
100
|
+
width: "100%",
|
|
101
|
+
height: "100%",
|
|
102
102
|
alignItems: "center",
|
|
103
103
|
justifyContent: "center",
|
|
104
104
|
},
|
|
105
105
|
android_tv: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
height: 1080,
|
|
106
|
+
width: "100%",
|
|
107
|
+
height: "100%",
|
|
109
108
|
alignItems: "center",
|
|
110
109
|
justifyContent: "center",
|
|
111
110
|
},
|
|
@@ -146,9 +145,9 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
|
146
145
|
},
|
|
147
146
|
});
|
|
148
147
|
|
|
149
|
-
const audioPlayerLayoutTV =
|
|
148
|
+
const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
|
|
150
149
|
<ImageBackground
|
|
151
|
-
source={
|
|
150
|
+
source={backgroundImageSource}
|
|
152
151
|
style={backgroundImgStyles}
|
|
153
152
|
resizeMode="cover"
|
|
154
153
|
>
|
|
@@ -178,7 +177,7 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
|
178
177
|
]}
|
|
179
178
|
>
|
|
180
179
|
<ImageBackground
|
|
181
|
-
source={
|
|
180
|
+
source={backgroundImageSource}
|
|
182
181
|
style={backgroundImgStyles}
|
|
183
182
|
resizeMode="cover"
|
|
184
183
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
|
-
import { View, ScrollView
|
|
2
|
+
import { View, ScrollView } from "react-native";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
4
|
import { ItemIconProps } from "./Button/ItemIcon";
|
|
5
5
|
import { ItemProps } from "./Button/Item";
|
|
@@ -9,7 +9,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
|
9
9
|
|
|
10
10
|
import type { PluginConfiguration } from "./";
|
|
11
11
|
|
|
12
|
-
import { ModalHeader } from "./Header";
|
|
12
|
+
import { ModalHeader as DefaultModalHeader } from "./Header";
|
|
13
13
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
14
14
|
|
|
15
15
|
type ModalComponentProps = {
|
|
@@ -22,6 +22,7 @@ type ModalComponentProps = {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
maxHeight?: number;
|
|
24
24
|
dismiss: () => void;
|
|
25
|
+
headerComponent?: React.ComponentType;
|
|
25
26
|
buttonComponent?: React.ComponentType;
|
|
26
27
|
iconProps?: ItemIconProps | ((theme: PluginConfiguration) => ItemIconProps);
|
|
27
28
|
itemProps?:
|
|
@@ -48,9 +49,11 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
|
48
49
|
dismiss,
|
|
49
50
|
summary,
|
|
50
51
|
title,
|
|
52
|
+
headerComponent: ModalHeader = DefaultModalHeader,
|
|
51
53
|
buttonComponent: ButtonComponent = Button,
|
|
52
|
-
getSelectedItemIcon = (
|
|
53
|
-
|
|
54
|
+
getSelectedItemIcon = ({
|
|
55
|
+
modal_bottom_sheet_item_selected_icon,
|
|
56
|
+
}: BaseThemePropertiesMobile) => modal_bottom_sheet_item_selected_icon,
|
|
54
57
|
getDefaultItemIcon = () => null,
|
|
55
58
|
iconPlacement,
|
|
56
59
|
} = props;
|
|
@@ -103,26 +106,27 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
|
103
106
|
/>
|
|
104
107
|
<ScrollView
|
|
105
108
|
contentContainerStyle={{
|
|
106
|
-
paddingBottom:
|
|
107
|
-
paddingBottom + (Platform.OS === "ios" ? bottomInset : 0),
|
|
109
|
+
paddingBottom: paddingBottom + bottomInset,
|
|
108
110
|
}}
|
|
109
111
|
>
|
|
110
|
-
{items.map((item, index) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
{items.map((item, index) =>
|
|
113
|
+
item ? (
|
|
114
|
+
<ButtonComponent
|
|
115
|
+
key={index}
|
|
116
|
+
configuration={theme}
|
|
117
|
+
selectedItem={current_selection}
|
|
118
|
+
item={item}
|
|
119
|
+
onPress={handlePress}
|
|
120
|
+
label={theme[item?.label] ?? item?.label}
|
|
121
|
+
iconBaseProps={iconBaseProps}
|
|
122
|
+
itemBaseProps={itemBaseProps}
|
|
123
|
+
labelBaseProps={labelBaseProps}
|
|
124
|
+
selectedItemIcon={getSelectedItemIcon(theme)}
|
|
125
|
+
defaultItemIcon={getDefaultItemIcon(theme)}
|
|
126
|
+
iconPlacement={iconPlacement}
|
|
127
|
+
/>
|
|
128
|
+
) : null
|
|
129
|
+
)}
|
|
126
130
|
</ScrollView>
|
|
127
131
|
</View>
|
|
128
132
|
);
|
|
@@ -6,11 +6,15 @@ import * as R from "ramda";
|
|
|
6
6
|
import uuid from "uuid/v4";
|
|
7
7
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
|
|
8
8
|
import {
|
|
9
|
-
isApplePlatform,
|
|
10
9
|
isTV,
|
|
11
10
|
platformSelect,
|
|
12
11
|
isAndroidTVPlatform,
|
|
12
|
+
isTvOSPlatform,
|
|
13
13
|
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
14
|
+
import {
|
|
15
|
+
isAudioItem,
|
|
16
|
+
isInlineTV as isInlineTVUtil,
|
|
17
|
+
} from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
14
18
|
|
|
15
19
|
import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
|
|
16
20
|
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
@@ -21,7 +25,7 @@ import {
|
|
|
21
25
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
22
26
|
|
|
23
27
|
import { PlayerStateContext } from "../../Contexts/PlayerStateContext";
|
|
24
|
-
|
|
28
|
+
|
|
25
29
|
import {
|
|
26
30
|
QUICK_BRICK_EVENTS,
|
|
27
31
|
QuickBrickEvent,
|
|
@@ -96,6 +100,11 @@ const focusableBottomContainerId = "player-container-bottom";
|
|
|
96
100
|
|
|
97
101
|
const isAndroidTV = isAndroidTVPlatform();
|
|
98
102
|
|
|
103
|
+
const isTvOS = isTvOSPlatform();
|
|
104
|
+
|
|
105
|
+
// height for container with additional content below player
|
|
106
|
+
const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
|
|
107
|
+
|
|
99
108
|
const withBorderHack = () => {
|
|
100
109
|
if (isAndroidTV) {
|
|
101
110
|
/* @HACK: see GH#7269 */
|
|
@@ -125,7 +134,7 @@ const webStyles = {
|
|
|
125
134
|
flex: "initial",
|
|
126
135
|
},
|
|
127
136
|
inlineRiver: {
|
|
128
|
-
height:
|
|
137
|
+
height: INLINE_CONTAINER_CONTENT_HEIGHT,
|
|
129
138
|
},
|
|
130
139
|
};
|
|
131
140
|
|
|
@@ -143,7 +152,7 @@ const nativeStyles = {
|
|
|
143
152
|
flex: 1,
|
|
144
153
|
},
|
|
145
154
|
inlineRiver: {
|
|
146
|
-
height:
|
|
155
|
+
height: INLINE_CONTAINER_CONTENT_HEIGHT,
|
|
147
156
|
},
|
|
148
157
|
};
|
|
149
158
|
|
|
@@ -163,12 +172,11 @@ const renderApplePlayer = ({
|
|
|
163
172
|
videoStyle,
|
|
164
173
|
playNextData,
|
|
165
174
|
}) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!isAppleTV() || !player) {
|
|
175
|
+
if (!isTvOS || !player) {
|
|
169
176
|
return null;
|
|
170
177
|
}
|
|
171
178
|
|
|
179
|
+
// render audio_player for tvos
|
|
172
180
|
if (isAudioContent) {
|
|
173
181
|
return (
|
|
174
182
|
<AudioPlayer
|
|
@@ -182,6 +190,8 @@ const renderApplePlayer = ({
|
|
|
182
190
|
return null;
|
|
183
191
|
}
|
|
184
192
|
|
|
193
|
+
const { title, summary } = item || {};
|
|
194
|
+
|
|
185
195
|
return (
|
|
186
196
|
<ProgramInfo
|
|
187
197
|
title={title}
|
|
@@ -192,21 +202,6 @@ const renderApplePlayer = ({
|
|
|
192
202
|
);
|
|
193
203
|
};
|
|
194
204
|
|
|
195
|
-
const renderRestPlayers = ({ item, showAudioPlayer, pluginConfiguration }) => {
|
|
196
|
-
if (isApplePlatform()) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
showAudioPlayer && (
|
|
202
|
-
<AudioPlayer
|
|
203
|
-
audio_item={item}
|
|
204
|
-
plugin_configuration={pluginConfiguration}
|
|
205
|
-
/>
|
|
206
|
-
)
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
205
|
const PlayerContainerComponent = (props: Props) => {
|
|
211
206
|
const {
|
|
212
207
|
Player,
|
|
@@ -336,7 +331,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
336
331
|
|
|
337
332
|
setState({ error: errorObj });
|
|
338
333
|
|
|
339
|
-
if (!
|
|
334
|
+
if (!isTvOS) {
|
|
340
335
|
setTimeout(() => {
|
|
341
336
|
close();
|
|
342
337
|
}, 800);
|
|
@@ -493,9 +488,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
493
488
|
// TODO: Skip hook call on TV platform
|
|
494
489
|
useBackHandler(backHandler);
|
|
495
490
|
|
|
496
|
-
const isAudioContent =
|
|
497
|
-
typeof item?.content?.type === "string" &&
|
|
498
|
-
item?.content?.type.includes("audio");
|
|
491
|
+
const isAudioContent = isAudioItem(item);
|
|
499
492
|
|
|
500
493
|
useEffect(() => {
|
|
501
494
|
if (!isAudioContent) {
|
|
@@ -569,10 +562,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
569
562
|
|
|
570
563
|
const uri = item?.content ? item.content?.src : null;
|
|
571
564
|
|
|
572
|
-
const isInlineTV =
|
|
573
|
-
screenData?.ui_components &&
|
|
574
|
-
screenData?.ui_components?.length > 0 &&
|
|
575
|
-
isTV();
|
|
565
|
+
const isInlineTV = isInlineTVUtil(screenData);
|
|
576
566
|
|
|
577
567
|
const inline =
|
|
578
568
|
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
|
|
@@ -627,12 +617,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
627
617
|
playNextData,
|
|
628
618
|
};
|
|
629
619
|
|
|
630
|
-
const restPlayerProps = {
|
|
631
|
-
item,
|
|
632
|
-
showAudioPlayer: isAudioContent,
|
|
633
|
-
pluginConfiguration,
|
|
634
|
-
};
|
|
635
|
-
|
|
636
620
|
return (
|
|
637
621
|
<PlayerStateContext.Provider value={value}>
|
|
638
622
|
<PlayerContainerContextProvider
|
|
@@ -708,8 +692,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
708
692
|
</Player>
|
|
709
693
|
</PlayerFocusableWrapperView>
|
|
710
694
|
|
|
711
|
-
{renderRestPlayers(restPlayerProps)}
|
|
712
|
-
|
|
713
695
|
{state.error ? <ErrorDisplay error={state.error} /> : null}
|
|
714
696
|
</View>
|
|
715
697
|
{/* Components container */}
|
|
@@ -733,7 +715,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
733
715
|
screenId={screenData.id}
|
|
734
716
|
key={item.id}
|
|
735
717
|
groupId={FocusableGroupMainContainerId}
|
|
736
|
-
cellTapAction={
|
|
718
|
+
cellTapAction={onCellTap}
|
|
737
719
|
extraAnchorPointYOffset={-600}
|
|
738
720
|
isScreenWrappedInContainer={true}
|
|
739
721
|
containerHeight={styles.inlineRiver.height}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { View, StyleSheet,
|
|
3
|
+
import { View, StyleSheet, FlatList } from "react-native";
|
|
4
4
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
5
|
import { RiverItem } from "../RiverItem";
|
|
6
6
|
import { RiverFooter } from "../RiverFooter";
|
|
@@ -24,6 +24,10 @@ import { withComponentsMapProvider } from "@applicaster/zapp-react-native-ui-com
|
|
|
24
24
|
import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
25
25
|
import { useShallow } from "zustand/react/shallow";
|
|
26
26
|
|
|
27
|
+
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
28
|
+
|
|
29
|
+
const isAndroid = isAndroidPlatform();
|
|
30
|
+
|
|
27
31
|
type Props = {
|
|
28
32
|
feed: ZappFeed;
|
|
29
33
|
groupId?: string;
|
|
@@ -273,12 +277,12 @@ function ComponentsMapComponent(props: Props) {
|
|
|
273
277
|
}}
|
|
274
278
|
// Fix for WebView rerender crashes on Android API 28+
|
|
275
279
|
// https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-964035468
|
|
276
|
-
overScrollMode={
|
|
280
|
+
overScrollMode={isAndroid ? "never" : "auto"}
|
|
277
281
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
278
282
|
extraData={feed}
|
|
279
283
|
stickyHeaderIndices={stickyHeaderIndices}
|
|
280
284
|
onLayout={handleOnLayout}
|
|
281
|
-
removeClippedSubviews
|
|
285
|
+
removeClippedSubviews={isAndroid}
|
|
282
286
|
initialNumToRender={3}
|
|
283
287
|
maxToRenderPerBatch={10}
|
|
284
288
|
windowSize={12}
|
|
@@ -299,6 +303,10 @@ function ComponentsMapComponent(props: Props) {
|
|
|
299
303
|
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
300
304
|
onScrollEndDrag={_onScrollEndDrag}
|
|
301
305
|
scrollEventThrottle={16}
|
|
306
|
+
maintainVisibleContentPosition={{
|
|
307
|
+
minIndexForVisible: 0,
|
|
308
|
+
autoscrollToTopThreshold: 10,
|
|
309
|
+
}}
|
|
302
310
|
{...scrollViewExtraProps}
|
|
303
311
|
/>
|
|
304
312
|
</ViewportTracker>
|
|
@@ -48,16 +48,20 @@ const useLoadingState = (
|
|
|
48
48
|
loadingState: RiverItemType["loadingState"]
|
|
49
49
|
) => {
|
|
50
50
|
const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
|
|
51
|
-
loadingState.getValue().index + 1
|
|
51
|
+
loadingState.getValue().index + 1 >= currentIndex
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
const subscription = loadingState.subscribe(({ index }) => {
|
|
56
|
-
if (index + 1
|
|
56
|
+
if (index + 1 >= currentIndex) {
|
|
57
57
|
setReadyToBeDisplayed(true);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
if (loadingState.getValue().index + 1 >= currentIndex) {
|
|
62
|
+
setReadyToBeDisplayed(true);
|
|
63
|
+
}
|
|
64
|
+
|
|
61
65
|
return () => {
|
|
62
66
|
subscription.unsubscribe();
|
|
63
67
|
};
|
|
@@ -135,6 +135,12 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
135
135
|
getItemCount={[Function]}
|
|
136
136
|
initialNumToRender={3}
|
|
137
137
|
keyExtractor={[Function]}
|
|
138
|
+
maintainVisibleContentPosition={
|
|
139
|
+
{
|
|
140
|
+
"autoscrollToTopThreshold": 10,
|
|
141
|
+
"minIndexForVisible": 0,
|
|
142
|
+
}
|
|
143
|
+
}
|
|
138
144
|
maxToRenderPerBatch={10}
|
|
139
145
|
onContentSizeChange={[Function]}
|
|
140
146
|
onLayout={[Function]}
|
|
@@ -145,7 +151,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
|
|
|
145
151
|
onScrollEndDrag={[Function]}
|
|
146
152
|
overScrollMode="auto"
|
|
147
153
|
refreshControl={null}
|
|
148
|
-
removeClippedSubviews={
|
|
154
|
+
removeClippedSubviews={false}
|
|
149
155
|
renderItem={[Function]}
|
|
150
156
|
scrollEventThrottle={16}
|
|
151
157
|
scrollIndicatorInsets={
|
|
@@ -12,11 +12,7 @@ const styles = StyleSheet.create({
|
|
|
12
12
|
|
|
13
13
|
export function TestId({ screenId, children }: Props) {
|
|
14
14
|
return (
|
|
15
|
-
<View
|
|
16
|
-
testID={screenId}
|
|
17
|
-
accessibilityLabel={screenId}
|
|
18
|
-
style={styles.container}
|
|
19
|
-
>
|
|
15
|
+
<View testID={screenId} style={styles.container}>
|
|
20
16
|
{children}
|
|
21
17
|
</View>
|
|
22
18
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.3044917147",
|
|
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",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"redux-mock-store": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.3044917147",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3044917147",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.3044917147",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.3044917147",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"react-router-native": "^5.1.2",
|
|
40
40
|
"url": "^0.11.0",
|