@applicaster/zapp-react-native-ui-components 13.0.11-alpha.5714428013 → 13.0.11-rc.0
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/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +17 -65
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +3 -21
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -6
- package/Components/River/ComponentsMap/ComponentsMap.tsx +43 -55
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +2 -3
- package/Components/VideoModal/PlayerDetails.tsx +5 -7
- package/Components/VideoModal/PlayerWrapper.tsx +1 -0
- package/package.json +5 -5
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapHeightContext.ts +0 -8
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapRefContext.ts +0 -8
|
@@ -28,10 +28,17 @@ interface Props {
|
|
|
28
28
|
onAsyncRender: () => void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const SecondaryImageComponent = (props: Props) => {
|
|
32
|
+
const {
|
|
33
|
+
uri,
|
|
34
|
+
style,
|
|
35
|
+
displayMode,
|
|
36
|
+
imageSizing,
|
|
37
|
+
fitPosition,
|
|
38
|
+
fixedHeight,
|
|
39
|
+
fixedWidth,
|
|
40
|
+
onAsyncRender,
|
|
41
|
+
} = props;
|
|
35
42
|
|
|
36
43
|
const imageDimension = useGetImageDimensions(
|
|
37
44
|
uri,
|
|
@@ -39,9 +46,13 @@ const SecondaryImageDynamic = (props: Props) => {
|
|
|
39
46
|
isImageSizingFit(imageSizing) ? undefined : (style.height as number)
|
|
40
47
|
);
|
|
41
48
|
|
|
42
|
-
const containerHeight =
|
|
49
|
+
const containerHeight = isDisplayModeFixed(displayMode)
|
|
50
|
+
? fixedHeight
|
|
51
|
+
: imageDimension?.height;
|
|
43
52
|
|
|
44
|
-
const containerWidth =
|
|
53
|
+
const containerWidth = isDisplayModeFixed(displayMode)
|
|
54
|
+
? fixedWidth
|
|
55
|
+
: style?.width;
|
|
45
56
|
|
|
46
57
|
if (isNil(imageDimension?.aspectRatio)) {
|
|
47
58
|
return null;
|
|
@@ -69,63 +80,4 @@ const SecondaryImageDynamic = (props: Props) => {
|
|
|
69
80
|
);
|
|
70
81
|
};
|
|
71
82
|
|
|
72
|
-
/** Secondary Image Fixed does not render the image until the image is loaded, but keep container rendered */
|
|
73
|
-
const SecondaryImageFixed = (props: Props) => {
|
|
74
|
-
const {
|
|
75
|
-
uri,
|
|
76
|
-
style,
|
|
77
|
-
displayMode,
|
|
78
|
-
imageSizing,
|
|
79
|
-
fitPosition,
|
|
80
|
-
fixedHeight,
|
|
81
|
-
fixedWidth,
|
|
82
|
-
onAsyncRender,
|
|
83
|
-
} = props;
|
|
84
|
-
|
|
85
|
-
const imageDimension = useGetImageDimensions(
|
|
86
|
-
uri,
|
|
87
|
-
style.width as number,
|
|
88
|
-
isImageSizingFit(imageSizing) ? undefined : (style.height as number)
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<View style={style} onLayout={onAsyncRender}>
|
|
93
|
-
{isNil(imageDimension?.aspectRatio) ? null : (
|
|
94
|
-
<Image
|
|
95
|
-
{...props}
|
|
96
|
-
source={{ uri }}
|
|
97
|
-
style={{
|
|
98
|
-
...getStyle({
|
|
99
|
-
imageSizing,
|
|
100
|
-
fitPosition,
|
|
101
|
-
displayMode,
|
|
102
|
-
imageDimension,
|
|
103
|
-
containerHeight: fixedHeight,
|
|
104
|
-
containerWidth: fixedWidth,
|
|
105
|
-
}),
|
|
106
|
-
borderRadius: style.borderRadius,
|
|
107
|
-
aspectRatio: imageDimension.aspectRatio,
|
|
108
|
-
}}
|
|
109
|
-
/>
|
|
110
|
-
)}
|
|
111
|
-
</View>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const SecondaryImageComponent = (props: Props) => {
|
|
116
|
-
const { uri, displayMode } = props;
|
|
117
|
-
|
|
118
|
-
if (!uri) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const isFixed = isDisplayModeFixed(displayMode);
|
|
123
|
-
|
|
124
|
-
return isFixed ? (
|
|
125
|
-
<SecondaryImageFixed {...props} />
|
|
126
|
-
) : (
|
|
127
|
-
<SecondaryImageDynamic {...props} />
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
83
|
export const SecondaryImage = withAsyncRenderHOC(SecondaryImageComponent);
|
|
@@ -4,26 +4,9 @@ import { render } from "@testing-library/react-native";
|
|
|
4
4
|
import { SecondaryImage } from "../Image";
|
|
5
5
|
|
|
6
6
|
describe("SecondaryImage - Image", () => {
|
|
7
|
-
it("SecondaryImage should not render if no
|
|
7
|
+
it("SecondaryImage should not render if no aspect ratio", async () => {
|
|
8
8
|
const wrapper = await render(
|
|
9
|
-
<SecondaryImage
|
|
10
|
-
displayMode="dynamic"
|
|
11
|
-
uri={undefined}
|
|
12
|
-
style={{ width: 100 }}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
expect(wrapper.toJSON()).toEqual(null);
|
|
17
|
-
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("SecondaryImage should not render if no aspect ratio (dynamic)", async () => {
|
|
21
|
-
const wrapper = await render(
|
|
22
|
-
<SecondaryImage
|
|
23
|
-
displayMode="dynamic"
|
|
24
|
-
uri="someurl"
|
|
25
|
-
style={{ width: 100 }}
|
|
26
|
-
/>
|
|
9
|
+
<SecondaryImage uri="" style={{ width: 100 }} />
|
|
27
10
|
);
|
|
28
11
|
|
|
29
12
|
expect(wrapper.toJSON()).toEqual(null);
|
|
@@ -33,8 +16,7 @@ describe("SecondaryImage - Image", () => {
|
|
|
33
16
|
it("SecondaryImage should render if known dimensions", async () => {
|
|
34
17
|
const wrapper = await render(
|
|
35
18
|
<SecondaryImage
|
|
36
|
-
uri="
|
|
37
|
-
displayMode="dynamic"
|
|
19
|
+
uri=""
|
|
38
20
|
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
39
21
|
/>
|
|
40
22
|
);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`SecondaryImage - Image SecondaryImage should not render if no aspect ratio
|
|
4
|
-
|
|
5
|
-
exports[`SecondaryImage - Image SecondaryImage should not render if no uri 1`] = `null`;
|
|
3
|
+
exports[`SecondaryImage - Image SecondaryImage should not render if no aspect ratio 1`] = `null`;
|
|
6
4
|
|
|
7
5
|
exports[`SecondaryImage - Image SecondaryImage should render if known dimensions 1`] = `
|
|
8
6
|
<View
|
|
@@ -16,11 +14,10 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
16
14
|
}
|
|
17
15
|
>
|
|
18
16
|
<Image
|
|
19
|
-
displayMode="dynamic"
|
|
20
17
|
onAsyncRender={[Function]}
|
|
21
18
|
source={
|
|
22
19
|
{
|
|
23
|
-
"uri": "
|
|
20
|
+
"uri": "",
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
style={
|
|
@@ -31,7 +28,7 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
31
28
|
"width": 100,
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
uri="
|
|
31
|
+
uri=""
|
|
35
32
|
/>
|
|
36
33
|
</View>
|
|
37
34
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import {
|
|
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";
|
|
@@ -9,8 +9,8 @@ import { useScreenConfiguration } from "../useScreenConfiguration";
|
|
|
9
9
|
import { RefreshControl } from "../RefreshControl";
|
|
10
10
|
import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
11
11
|
import {
|
|
12
|
-
usePipesCacheReset,
|
|
13
12
|
useProfilerLogging,
|
|
13
|
+
usePipesCacheReset,
|
|
14
14
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
15
15
|
import { useLoadingState } from "./hooks/useLoadingState";
|
|
16
16
|
import { ViewportTracker } from "../../Viewport";
|
|
@@ -25,8 +25,6 @@ import { useScreenContextV2 } from "@applicaster/zapp-react-native-utils/reactHo
|
|
|
25
25
|
import { useShallow } from "zustand/react/shallow";
|
|
26
26
|
|
|
27
27
|
import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
28
|
-
import { ComponentsMapHeightContext } from "./ContextProviders/ComponentsMapHeightContext";
|
|
29
|
-
import { ComponentsMapRefContext } from "./ContextProviders/ComponentsMapRefContext";
|
|
30
28
|
|
|
31
29
|
const isAndroid = isAndroidPlatform();
|
|
32
30
|
|
|
@@ -72,7 +70,6 @@ function ComponentsMapComponent(props: Props) {
|
|
|
72
70
|
} = props;
|
|
73
71
|
|
|
74
72
|
const flatListRef = React.useRef<FlatList | null>(null);
|
|
75
|
-
const flatListWrapperRef = React.useRef<View | null>(null);
|
|
76
73
|
const screenConfig = useScreenConfiguration(riverId);
|
|
77
74
|
const screenData = useScreenData(riverId);
|
|
78
75
|
const pullToRefreshEnabled = screenData?.rules?.pull_to_refresh_enabled;
|
|
@@ -268,57 +265,48 @@ function ComponentsMapComponent(props: Props) {
|
|
|
268
265
|
// The Screen Picker in Mobile is completly different than the TV
|
|
269
266
|
// so the various offsets / margins in TV do not apply here.
|
|
270
267
|
return (
|
|
271
|
-
<View
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
renderItem={renderRiverItem}
|
|
302
|
-
data={riverComponents}
|
|
303
|
-
contentContainerStyle={contentContainerStyle}
|
|
304
|
-
ListFooterComponent={
|
|
305
|
-
<RiverFooter
|
|
306
|
-
flatListHeight={flatListHeight}
|
|
307
|
-
loadingState={loadingState}
|
|
308
|
-
/>
|
|
309
|
-
}
|
|
310
|
-
refreshControl={refreshControl}
|
|
311
|
-
onScrollBeginDrag={onScrollBeginDrag}
|
|
312
|
-
onScroll={onScroll}
|
|
313
|
-
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
314
|
-
onScrollEndDrag={_onScrollEndDrag}
|
|
315
|
-
scrollEventThrottle={16}
|
|
316
|
-
{...scrollViewExtraProps}
|
|
268
|
+
<View style={styles.container}>
|
|
269
|
+
<ScreenLoadingMeasurements
|
|
270
|
+
riverId={riverId}
|
|
271
|
+
numberOfComponents={riverComponents.length}
|
|
272
|
+
>
|
|
273
|
+
<ViewportTracker>
|
|
274
|
+
<FlatList
|
|
275
|
+
ref={(ref) => {
|
|
276
|
+
flatListRef.current = ref;
|
|
277
|
+
}}
|
|
278
|
+
// Fix for WebView rerender crashes on Android API 28+
|
|
279
|
+
// https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-964035468
|
|
280
|
+
overScrollMode={isAndroid ? "never" : "auto"}
|
|
281
|
+
scrollIndicatorInsets={scrollIndicatorInsets}
|
|
282
|
+
extraData={feed}
|
|
283
|
+
stickyHeaderIndices={stickyHeaderIndices}
|
|
284
|
+
removeClippedSubviews={isAndroid}
|
|
285
|
+
onLayout={handleOnLayout}
|
|
286
|
+
initialNumToRender={3}
|
|
287
|
+
maxToRenderPerBatch={10}
|
|
288
|
+
windowSize={12}
|
|
289
|
+
listKey={riverId}
|
|
290
|
+
keyExtractor={keyExtractor}
|
|
291
|
+
renderItem={renderRiverItem}
|
|
292
|
+
data={riverComponents}
|
|
293
|
+
contentContainerStyle={contentContainerStyle}
|
|
294
|
+
ListFooterComponent={
|
|
295
|
+
<RiverFooter
|
|
296
|
+
flatListHeight={flatListHeight}
|
|
297
|
+
loadingState={loadingState}
|
|
317
298
|
/>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
299
|
+
}
|
|
300
|
+
refreshControl={refreshControl}
|
|
301
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
302
|
+
onScroll={onScroll}
|
|
303
|
+
onMomentumScrollEnd={_onMomentumScrollEnd}
|
|
304
|
+
onScrollEndDrag={_onScrollEndDrag}
|
|
305
|
+
scrollEventThrottle={16}
|
|
306
|
+
{...scrollViewExtraProps}
|
|
307
|
+
/>
|
|
308
|
+
</ViewportTracker>
|
|
309
|
+
</ScreenLoadingMeasurements>
|
|
322
310
|
</View>
|
|
323
311
|
);
|
|
324
312
|
}
|
|
@@ -372,7 +372,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
372
372
|
maxDeltaY={lastSnap - modalSnapPoints[0]}
|
|
373
373
|
numberOfTaps={1}
|
|
374
374
|
>
|
|
375
|
-
<View pointerEvents="box-none"
|
|
375
|
+
<View pointerEvents="box-none">
|
|
376
376
|
<PanGestureHandler
|
|
377
377
|
enabled={isEnablePanGesture}
|
|
378
378
|
ref={panHandlerRef}
|
|
@@ -382,7 +382,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
382
382
|
onHandlerStateChange={onHandlerStateChange}
|
|
383
383
|
activeOffsetY={[-5, 5]}
|
|
384
384
|
>
|
|
385
|
-
<Animated.View
|
|
385
|
+
<Animated.View>
|
|
386
386
|
<NativeViewGestureHandler
|
|
387
387
|
ref={scrollRef}
|
|
388
388
|
waitFor={tapHandlerRef}
|
|
@@ -397,7 +397,6 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
397
397
|
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
398
398
|
scrollEventThrottle={1}
|
|
399
399
|
showsVerticalScrollIndicator={false}
|
|
400
|
-
contentContainerStyle={generalStyles.container}
|
|
401
400
|
>
|
|
402
401
|
{children}
|
|
403
402
|
</Animated.ScrollView>
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
Dimensions,
|
|
5
5
|
Easing,
|
|
6
6
|
StyleProp,
|
|
7
|
-
StyleSheet,
|
|
8
7
|
ViewStyle,
|
|
8
|
+
StyleSheet,
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
11
11
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
@@ -13,7 +13,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
|
13
13
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
14
14
|
|
|
15
15
|
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
16
|
-
const styles = StyleSheet.create({ flex1: { flex: 1 } });
|
|
17
16
|
|
|
18
17
|
type Configuration = {
|
|
19
18
|
[key: string]: any;
|
|
@@ -48,10 +47,11 @@ export const PlayerDetails = ({
|
|
|
48
47
|
const screenData = useTargetScreenData(entry);
|
|
49
48
|
const insets = useSafeAreaInsets();
|
|
50
49
|
|
|
51
|
-
const extraTabletStyles =
|
|
52
|
-
|
|
50
|
+
const extraTabletStyles = !isAudioPlayer
|
|
51
|
+
? isTabletLandscape
|
|
53
52
|
? { marginTop: -insets.top, paddingTop: insets.top + 20 }
|
|
54
|
-
:
|
|
53
|
+
: { marginTop: -8, paddingTop: -8 }
|
|
54
|
+
: {};
|
|
55
55
|
|
|
56
56
|
// Animation setup
|
|
57
57
|
const translateY = useRef(new Animated.Value(50)).current;
|
|
@@ -93,7 +93,6 @@ export const PlayerDetails = ({
|
|
|
93
93
|
transform: [{ translateY }],
|
|
94
94
|
opacity,
|
|
95
95
|
},
|
|
96
|
-
styles.flex1,
|
|
97
96
|
{
|
|
98
97
|
// workaround for avoid wrong text-height after going back to portrait rotation
|
|
99
98
|
// we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
|
|
@@ -108,7 +107,6 @@ export const PlayerDetails = ({
|
|
|
108
107
|
riverId={screenData.id}
|
|
109
108
|
feed={screenData?.data?.source}
|
|
110
109
|
riverComponents={screenData.ui_components}
|
|
111
|
-
isScreenWrappedInContainer
|
|
112
110
|
/>
|
|
113
111
|
) : null}
|
|
114
112
|
</Animated.View>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.11-
|
|
3
|
+
"version": "13.0.11-rc.0",
|
|
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.11-
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "13.0.11-
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "13.0.11-
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.11-
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.11-rc.0",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.11-rc.0",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.11-rc.0",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.11-rc.0",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"react-router-native": "^5.1.2",
|
|
40
40
|
"url": "^0.11.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
|
|
4
|
-
export const ComponentsMapRefContext =
|
|
5
|
-
React.createContext<React.RefObject<View | null> | null>(null);
|
|
6
|
-
|
|
7
|
-
export const useComponentsMapRef = () =>
|
|
8
|
-
React.useContext(ComponentsMapRefContext);
|