@applicaster/zapp-react-native-ui-components 14.0.0-alpha.2345544020 → 14.0.0-alpha.4748018412
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/Artwork.tsx +13 -12
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +4 -5
- package/Components/AudioPlayer/Runtime.tsx +2 -1
- package/Components/AudioPlayer/Summary.tsx +12 -9
- package/Components/AudioPlayer/Title.tsx +12 -9
- package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +2 -2
- package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +9 -5
- package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +1 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +1 -1
- package/Components/AudioPlayer/helpers.tsx +2 -2
- package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -5
- package/Components/River/RiverItem.tsx +8 -8
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +0 -6
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/package.json +5 -5
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, Image } from "react-native";
|
|
2
|
+
import { View, Image, StyleSheet } from "react-native";
|
|
3
3
|
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
4
|
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
marginHorizontal: 24,
|
|
8
|
+
},
|
|
9
|
+
image: {
|
|
10
|
+
width: 400,
|
|
11
|
+
height: 400,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
5
15
|
type Props = {
|
|
6
16
|
srcImage: string;
|
|
7
17
|
config?: {
|
|
@@ -14,24 +24,15 @@ type Props = {
|
|
|
14
24
|
};
|
|
15
25
|
};
|
|
16
26
|
|
|
17
|
-
const containerStyles = {
|
|
18
|
-
marginHorizontal: 24,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const imageStyles = {
|
|
22
|
-
width: 400,
|
|
23
|
-
height: 400,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
27
|
export function Artwork({ srcImage, config }: Props) {
|
|
27
28
|
const borderRadius = toNumberWithDefaultZero(config.artworkBorderRadius);
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
|
-
<View style={
|
|
31
|
+
<View style={styles.container}>
|
|
31
32
|
<Image
|
|
32
33
|
fadeDuration={0}
|
|
33
34
|
source={{ uri: srcImage }}
|
|
34
|
-
style={{
|
|
35
|
+
style={[styles.image, { borderRadius }]}
|
|
35
36
|
resizeMode="cover"
|
|
36
37
|
/>
|
|
37
38
|
</View>
|
|
@@ -41,17 +41,16 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
|
41
41
|
|
|
42
42
|
const mainContainerStyles = platformSelect({
|
|
43
43
|
tvos: {
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
44
|
+
width: "100%",
|
|
45
|
+
height: "100%",
|
|
46
46
|
alignItems: "center",
|
|
47
47
|
justifyContent: "center",
|
|
48
48
|
flexDirection: directionStyles(isRTL).flexDirection,
|
|
49
49
|
backgroundColor: backgroundColorStyle,
|
|
50
50
|
},
|
|
51
51
|
android_tv: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height: 1080,
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "100%",
|
|
55
54
|
alignItems: "center",
|
|
56
55
|
justifyContent: "center",
|
|
57
56
|
flexDirection: directionStyles(isRTL).flexDirection,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, ViewStyle, TextStyle } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
3
4
|
import { directionStyles } from "./helpers";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
@@ -31,7 +32,7 @@ const textStyles = ({
|
|
|
31
32
|
}) => ({
|
|
32
33
|
color: summaryColor,
|
|
33
34
|
opacity: 0.8,
|
|
34
|
-
fontSize:
|
|
35
|
+
fontSize: toNumberWithDefault(20, runTimeFontSize),
|
|
35
36
|
fontFamily: runTimeFontFamily || null,
|
|
36
37
|
...directionStyles(isRTL),
|
|
37
38
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, Text, TextStyle } from "react-native";
|
|
2
|
+
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
3
4
|
|
|
4
5
|
type Props = {
|
|
5
6
|
config: {
|
|
@@ -14,11 +15,13 @@ type Props = {
|
|
|
14
15
|
summary: string | number;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
width: 600,
|
|
21
|
+
height: 80,
|
|
22
|
+
marginBottom: 30,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
22
25
|
|
|
23
26
|
const textStyles = ({
|
|
24
27
|
summaryColor,
|
|
@@ -26,8 +29,8 @@ const textStyles = ({
|
|
|
26
29
|
summaryFontFamily,
|
|
27
30
|
summaryFontSize,
|
|
28
31
|
}) => ({
|
|
29
|
-
textAlign: (isRTL ? "
|
|
30
|
-
fontSize:
|
|
32
|
+
textAlign: (isRTL ? "right" : "left") as TextStyle["textAlign"],
|
|
33
|
+
fontSize: toNumberWithDefault(20, summaryFontSize),
|
|
31
34
|
color: summaryColor,
|
|
32
35
|
fontWeight: "600" as TextStyle["fontWeight"],
|
|
33
36
|
opacity: 0.8,
|
|
@@ -36,7 +39,7 @@ const textStyles = ({
|
|
|
36
39
|
|
|
37
40
|
export function Summary({ summary, config }: Props) {
|
|
38
41
|
return (
|
|
39
|
-
<View style={
|
|
42
|
+
<View style={styles.container}>
|
|
40
43
|
<Text style={textStyles(config)} numberOfLines={2}>
|
|
41
44
|
{summary}
|
|
42
45
|
</Text>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, Text, TextStyle } from "react-native";
|
|
2
|
+
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
3
4
|
|
|
4
5
|
type Props = {
|
|
5
6
|
config: {
|
|
@@ -14,15 +15,17 @@ type Props = {
|
|
|
14
15
|
title: string | number;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
width: 600,
|
|
21
|
+
height: 100,
|
|
22
|
+
marginBottom: 12,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
22
25
|
|
|
23
26
|
const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
|
|
24
|
-
textAlign: (isRTL ? "
|
|
25
|
-
fontSize:
|
|
27
|
+
textAlign: (isRTL ? "right" : "left") as TextStyle["textAlign"],
|
|
28
|
+
fontSize: toNumberWithDefault(38, titleFontSize),
|
|
26
29
|
fontWeight: "600" as TextStyle["fontWeight"],
|
|
27
30
|
color: titleColor,
|
|
28
31
|
fontFamily: titleFontFamily || null,
|
|
@@ -30,7 +33,7 @@ const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
|
|
|
30
33
|
|
|
31
34
|
export function Title({ title, config }: Props) {
|
|
32
35
|
return (
|
|
33
|
-
<View style={
|
|
36
|
+
<View style={styles.container}>
|
|
34
37
|
<Text style={textStyles(config)} numberOfLines={2}>
|
|
35
38
|
{title}
|
|
36
39
|
</Text>
|
|
@@ -20,7 +20,7 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
|
20
20
|
"fontSize": 20,
|
|
21
21
|
"justifyContent": "flex-start",
|
|
22
22
|
"opacity": 0.8,
|
|
23
|
-
"textAlign": "
|
|
23
|
+
"textAlign": "left",
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
>
|
|
@@ -49,7 +49,7 @@ exports[`<Runtime /> RTL renders correctly 1`] = `
|
|
|
49
49
|
"fontSize": 20,
|
|
50
50
|
"justifyContent": "flex-end",
|
|
51
51
|
"opacity": 0.8,
|
|
52
|
-
"textAlign": "
|
|
52
|
+
"textAlign": "right",
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
>
|
|
@@ -17,11 +17,15 @@ exports[`<Artwork /> renders correctly 1`] = `
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
style={
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
"height": 400,
|
|
23
|
+
"width": 400,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"borderRadius": 0,
|
|
27
|
+
},
|
|
28
|
+
]
|
|
25
29
|
}
|
|
26
30
|
/>
|
|
27
31
|
</View>
|
|
@@ -26,14 +26,14 @@ export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
|
|
|
26
26
|
const LTR = {
|
|
27
27
|
flexDirection: "row",
|
|
28
28
|
justifyContent: "flex-start",
|
|
29
|
-
textAlign: "
|
|
29
|
+
textAlign: "left",
|
|
30
30
|
alignItems: "flex-end",
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const RTL = {
|
|
34
34
|
flexDirection: "row-reverse",
|
|
35
35
|
justifyContent: "flex-end",
|
|
36
|
-
textAlign: "
|
|
36
|
+
textAlign: "right",
|
|
37
37
|
alignItems: "flex-start",
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -281,8 +281,8 @@ function ComponentsMapComponent(props: Props) {
|
|
|
281
281
|
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
282
282
|
extraData={feed}
|
|
283
283
|
stickyHeaderIndices={stickyHeaderIndices}
|
|
284
|
-
onLayout={handleOnLayout}
|
|
285
284
|
removeClippedSubviews={isAndroid}
|
|
285
|
+
onLayout={handleOnLayout}
|
|
286
286
|
initialNumToRender={3}
|
|
287
287
|
maxToRenderPerBatch={10}
|
|
288
288
|
windowSize={12}
|
|
@@ -303,10 +303,6 @@ function ComponentsMapComponent(props: Props) {
|
|
|
303
303
|
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
304
304
|
onScrollEndDrag={_onScrollEndDrag}
|
|
305
305
|
scrollEventThrottle={16}
|
|
306
|
-
maintainVisibleContentPosition={{
|
|
307
|
-
minIndexForVisible: 0,
|
|
308
|
-
autoscrollToTopThreshold: 10,
|
|
309
|
-
}}
|
|
310
306
|
{...scrollViewExtraProps}
|
|
311
307
|
/>
|
|
312
308
|
</ViewportTracker>
|
|
@@ -39,6 +39,10 @@ function getFeedUrl(feed: ZappFeed, index: number) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
const isNextIndex = (index, readyIndex) => {
|
|
43
|
+
return readyIndex + 1 >= index;
|
|
44
|
+
};
|
|
45
|
+
|
|
42
46
|
/**
|
|
43
47
|
* useLoadingState for RiverItemComponent
|
|
44
48
|
* takes currentIndex and loadingState as arguments
|
|
@@ -48,24 +52,20 @@ const useLoadingState = (
|
|
|
48
52
|
loadingState: RiverItemType["loadingState"]
|
|
49
53
|
) => {
|
|
50
54
|
const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
|
|
51
|
-
loadingState.getValue().index
|
|
55
|
+
isNextIndex(currentIndex, loadingState.getValue().index)
|
|
52
56
|
);
|
|
53
57
|
|
|
54
58
|
useEffect(() => {
|
|
55
59
|
const subscription = loadingState.subscribe(({ index }) => {
|
|
56
|
-
if (index
|
|
60
|
+
if (isNextIndex(currentIndex, index)) {
|
|
57
61
|
setReadyToBeDisplayed(true);
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
|
|
61
|
-
if (loadingState.getValue().index + 1 >= currentIndex) {
|
|
62
|
-
setReadyToBeDisplayed(true);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
65
|
return () => {
|
|
66
66
|
subscription.unsubscribe();
|
|
67
67
|
};
|
|
68
|
-
}, [
|
|
68
|
+
}, [currentIndex]);
|
|
69
69
|
|
|
70
70
|
return readyToBeDisplayed;
|
|
71
71
|
};
|
|
@@ -151,7 +151,7 @@ function RiverItemComponent(props: RiverItemType) {
|
|
|
151
151
|
component={item}
|
|
152
152
|
componentIndex={index}
|
|
153
153
|
onLoadFailed={onLoadFailed}
|
|
154
|
-
onLoadFinished={() => onLoadFinished(index)}
|
|
154
|
+
onLoadFinished={() => onLoadFinished(index)}
|
|
155
155
|
groupId={groupId}
|
|
156
156
|
feedUrl={feedUrl}
|
|
157
157
|
isLast={isLast}
|
|
@@ -135,12 +135,6 @@ 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
|
-
}
|
|
144
138
|
maxToRenderPerBatch={10}
|
|
145
139
|
onContentSizeChange={[Function]}
|
|
146
140
|
onLayout={[Function]}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
3
|
-
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
4
2
|
|
|
5
3
|
import { showDetails } from "./utils";
|
|
6
4
|
|
|
7
|
-
const TIMEOUT = 100; // ms
|
|
8
|
-
|
|
9
5
|
type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
|
|
10
6
|
|
|
7
|
+
const showPlayerDetails = (
|
|
8
|
+
isInline: boolean,
|
|
9
|
+
isDocked: boolean,
|
|
10
|
+
isPip: boolean,
|
|
11
|
+
isTablet: boolean
|
|
12
|
+
) => {
|
|
13
|
+
return showDetails({
|
|
14
|
+
isMobile: !isTablet,
|
|
15
|
+
isInline,
|
|
16
|
+
isDocked,
|
|
17
|
+
isPip,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
11
21
|
/**
|
|
12
22
|
* Custom hook to determine whether to show player details with a delay.
|
|
13
23
|
*
|
|
@@ -22,28 +32,7 @@ export const useDelayedPlayerDetails = ({
|
|
|
22
32
|
isDocked,
|
|
23
33
|
isPip,
|
|
24
34
|
}: Props): boolean => {
|
|
25
|
-
const [shouldShowDetails, setShouldShowDetails] = React.useState(false);
|
|
26
|
-
|
|
27
35
|
const isTablet = useIsTablet();
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
const subscription = withTimeout$(TIMEOUT).subscribe({
|
|
31
|
-
next: () => {
|
|
32
|
-
setShouldShowDetails(() => {
|
|
33
|
-
return showDetails({
|
|
34
|
-
isMobile: !isTablet,
|
|
35
|
-
isInline,
|
|
36
|
-
isDocked,
|
|
37
|
-
isPip,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return () => {
|
|
44
|
-
subscription.unsubscribe();
|
|
45
|
-
};
|
|
46
|
-
}, [isDocked, isTablet, isInline, isPip]);
|
|
47
|
-
|
|
48
|
-
return shouldShowDetails;
|
|
37
|
+
return showPlayerDetails(isInline, isDocked, isPip, isTablet);
|
|
49
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.4748018412",
|
|
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": "14.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.4748018412",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.4748018412",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.4748018412",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.4748018412",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"url": "^0.11.0",
|
|
40
40
|
"uuid": "^3.3.2"
|