@applicaster/zapp-react-native-ui-components 15.0.0-alpha.3752284136 → 15.0.0-alpha.4057265013
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/Cell/Cell.tsx +6 -0
- package/Components/Cell/CellWithFocusable.tsx +9 -0
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -8
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +13 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +16 -29
- package/Components/HandlePlayable/utils.ts +31 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +40 -39
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +95 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +86 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/index.test.ts +141 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/index.ts +1 -1
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -2
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +233 -11
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +19 -15
- package/Components/MasterCell/hoc/__tests__/withAsyncRender.test.tsx +219 -0
- package/Components/MasterCell/hoc/withAsyncRender.tsx +9 -7
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +17 -9
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +16 -8
- package/Components/OfflineHandler/NotificationView/utils.ts +34 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +1 -9
- package/Components/River/ComponentsMap/ComponentsMap.tsx +16 -0
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/River/__tests__/componentsMap.test.js +38 -0
- package/Components/Screen/__tests__/Screen.test.tsx +1 -0
- package/Components/Screen/hooks.ts +73 -3
- package/Components/Screen/index.tsx +7 -1
- package/Components/Screen/orientationHandler.ts +7 -10
- package/Components/ScreenResolver/index.tsx +14 -10
- package/Components/Tabs/TabContent.tsx +7 -4
- package/Components/Transitioner/Scene.tsx +9 -15
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
- package/Components/Viewport/ViewportAware/index.tsx +16 -7
- package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
- package/Contexts/ScreenContext/index.tsx +54 -19
- package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
- package/Contexts/ZappHookModalContext/index.tsx +37 -61
- package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +18 -7
- package/Contexts/index.ts +0 -2
- package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -7
- package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +212 -5
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
- package/events/index.ts +3 -0
- package/events/scrollEndReached.ts +15 -0
- package/package.json +5 -5
- package/Components/PlayerContainer/useRestrictMobilePlayback.tsx +0 -101
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -26,11 +26,15 @@ type Props = {
|
|
|
26
26
|
componentAnchorPointY: number;
|
|
27
27
|
headerOffset?: number;
|
|
28
28
|
extraAnchorPointYOffset?: number;
|
|
29
|
+
componentPaddingTop?: number;
|
|
29
30
|
}) => void;
|
|
30
31
|
offsetUpdater: (arg1: string, arg2: number, arg3: number) => number;
|
|
31
32
|
componentId: string;
|
|
32
33
|
component: {
|
|
33
34
|
id: string;
|
|
35
|
+
styles?: {
|
|
36
|
+
component_padding_top?: number;
|
|
37
|
+
};
|
|
34
38
|
};
|
|
35
39
|
selected?: boolean;
|
|
36
40
|
CellRenderer: React.FunctionComponent<any> & {
|
|
@@ -178,6 +182,8 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
178
182
|
componentAnchorPointY,
|
|
179
183
|
headerOffset,
|
|
180
184
|
extraAnchorPointYOffset,
|
|
185
|
+
componentPaddingTop:
|
|
186
|
+
this.props?.component?.styles?.component_padding_top,
|
|
181
187
|
});
|
|
182
188
|
}
|
|
183
189
|
}
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
4
4
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
5
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
6
|
|
|
6
7
|
import { useCellState } from "../MasterCell/utils";
|
|
7
8
|
import { FocusableGroup } from "../FocusableGroup";
|
|
@@ -26,6 +27,13 @@ type Props = {
|
|
|
26
27
|
|
|
27
28
|
const addPrefix = (id: string) => `focusable-cell-wrapper-${id}`;
|
|
28
29
|
|
|
30
|
+
const wrapperStyles = {
|
|
31
|
+
flex: platformSelect({
|
|
32
|
+
tvos: 1,
|
|
33
|
+
default: undefined,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
|
|
29
37
|
export function CellWithFocusable(props: Props) {
|
|
30
38
|
const {
|
|
31
39
|
index,
|
|
@@ -94,6 +102,7 @@ export function CellWithFocusable(props: Props) {
|
|
|
94
102
|
onFocus={onGroupFocus}
|
|
95
103
|
onBlur={onGroupBlur}
|
|
96
104
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
105
|
+
style={wrapperStyles}
|
|
97
106
|
>
|
|
98
107
|
<CellWrapper style={styles.cellWrapper}>
|
|
99
108
|
<CellRenderer
|
|
@@ -13,7 +13,7 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
|
|
|
13
13
|
import { ScreenTrackedViewPositionsContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenTrackedViewPositionsContext";
|
|
14
14
|
import { useEventAlerts } from "./utils/useEventAlerts";
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const { log_debug } = createLogger({
|
|
17
17
|
category: "ScreenContainer",
|
|
18
18
|
subsystem: "General",
|
|
19
19
|
});
|
|
@@ -54,20 +54,15 @@ export const GeneralContentScreen = ({
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (!riverActionProvidersReady) {
|
|
56
56
|
if (actionsInitialStateSetters.length > 0) {
|
|
57
|
-
log_info(
|
|
58
|
-
"ScreenContainer: starting to check river action providers to initialize",
|
|
59
|
-
{ actionsInitialStateSetters }
|
|
60
|
-
);
|
|
61
|
-
|
|
62
57
|
allSettled(actionsInitialStateSetters).finally(() => {
|
|
63
|
-
|
|
58
|
+
log_debug(
|
|
64
59
|
"ScreenContainer: action provider ready, completed. Starting to present screen"
|
|
65
60
|
);
|
|
66
61
|
|
|
67
62
|
setRiverActionProvidersReady(true);
|
|
68
63
|
});
|
|
69
64
|
} else {
|
|
70
|
-
|
|
65
|
+
log_debug(
|
|
71
66
|
"ScreenContainer: no action provider to check, completed. Starting to present screen"
|
|
72
67
|
);
|
|
73
68
|
|
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
10
10
|
import { Categories } from "./logger";
|
|
11
11
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
12
|
-
import {
|
|
12
|
+
import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
-
ZappPipesEntryContext,
|
|
16
15
|
ZappPipesScreenContext,
|
|
17
16
|
ZappPipesSearchContext,
|
|
18
17
|
} from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
@@ -37,6 +36,7 @@ type Feeds = Record<string, ZappPipesData>;
|
|
|
37
36
|
type LayoutPresets = PresetsMapping["presets_mappings"];
|
|
38
37
|
|
|
39
38
|
const TABS_SCREEN_TYPE = "tabs_screen";
|
|
39
|
+
const QB_TABS_SCREEN_TYPE = "quick-brick-tabs";
|
|
40
40
|
const SMART_COMPONENT_TYPE = "quick-brick-smart-component";
|
|
41
41
|
const SOURCE_PATH = ["data", "source"];
|
|
42
42
|
const MAPPING_PATH = ["data", "mapping"];
|
|
@@ -135,16 +135,21 @@ export const useCurationAPI = (
|
|
|
135
135
|
[components]
|
|
136
136
|
);
|
|
137
137
|
|
|
138
|
-
const { pathname } = useRoute();
|
|
139
138
|
const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
|
|
140
139
|
const [screenContext] = ZappPipesScreenContext.useZappPipesContext();
|
|
141
140
|
|
|
142
|
-
const
|
|
141
|
+
const screenContextType = screenContext?.type;
|
|
143
142
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
const isNestedScreen =
|
|
144
|
+
screenContextType === TABS_SCREEN_TYPE ||
|
|
145
|
+
screenContextType === QB_TABS_SCREEN_TYPE;
|
|
146
|
+
|
|
147
|
+
const screenContextData = useScreenContext();
|
|
148
|
+
|
|
149
|
+
const entryContext = ((isNestedScreen && screenContextData?.nested?.entry
|
|
150
|
+
? screenContextData?.nested?.entry
|
|
151
|
+
: (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
|
|
152
|
+
{}) as ZappEntry;
|
|
148
153
|
|
|
149
154
|
const urlsMap = useMemo<{ [key: string]: string }>(() => {
|
|
150
155
|
const map = {};
|
|
@@ -5,8 +5,6 @@ import {
|
|
|
5
5
|
usePlugins,
|
|
6
6
|
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
7
7
|
import {
|
|
8
|
-
useDimensions,
|
|
9
|
-
useIsTablet as isTablet,
|
|
10
8
|
useNavigation,
|
|
11
9
|
useRivers,
|
|
12
10
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
@@ -15,8 +13,8 @@ import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
|
15
13
|
import { PlayerContainer } from "../PlayerContainer";
|
|
16
14
|
import { useModalSize } from "../VideoModal/hooks";
|
|
17
15
|
import { ViewStyle } from "react-native";
|
|
18
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
19
16
|
import { findCastPlugin, getPlayer } from "./utils";
|
|
17
|
+
import { useWaitForValidOrientation } from "../Screen/hooks";
|
|
20
18
|
|
|
21
19
|
type Props = {
|
|
22
20
|
item: ZappEntry;
|
|
@@ -31,13 +29,6 @@ type PlayableComponent = {
|
|
|
31
29
|
Component: React.ComponentType<any>;
|
|
32
30
|
};
|
|
33
31
|
|
|
34
|
-
const dimensionsContext: "window" | "screen" = platformSelect({
|
|
35
|
-
android_tv: "window",
|
|
36
|
-
amazon: "window",
|
|
37
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
-
default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
|
|
39
|
-
});
|
|
40
|
-
|
|
41
32
|
export function HandlePlayable({
|
|
42
33
|
item,
|
|
43
34
|
isModal,
|
|
@@ -97,27 +88,23 @@ export function HandlePlayable({
|
|
|
97
88
|
});
|
|
98
89
|
}, [casting]);
|
|
99
90
|
|
|
100
|
-
const { width: screenWidth, height: screenHeight } =
|
|
101
|
-
useDimensions(dimensionsContext);
|
|
102
|
-
|
|
103
91
|
const modalSize = useModalSize();
|
|
104
92
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
93
|
+
const isOrientationReady = useWaitForValidOrientation();
|
|
94
|
+
|
|
95
|
+
const style = React.useMemo(() => {
|
|
96
|
+
const isFullScreenReady =
|
|
97
|
+
mode === "PIP" || (mode === "FULLSCREEN" && isOrientationReady);
|
|
98
|
+
|
|
99
|
+
const getDimensionValue = (value: string | number) => {
|
|
100
|
+
return isModal ? value : isFullScreenReady ? "100%" : 0; // do not show player, until full screen mode is ready
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
width: getDimensionValue(modalSize.width),
|
|
105
|
+
height: getDimensionValue(modalSize.height),
|
|
106
|
+
} as ViewStyle;
|
|
107
|
+
}, [modalSize, isModal, mode, isOrientationReady]);
|
|
121
108
|
|
|
122
109
|
const Component = playable?.Component;
|
|
123
110
|
|
|
@@ -5,6 +5,14 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import { CHROMECAST_PLUGIN_ID, YOUTUBE_PLUGIN_ID } from "./const";
|
|
7
7
|
import { omit } from "@applicaster/zapp-react-native-utils/utils";
|
|
8
|
+
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
9
|
+
|
|
10
|
+
const { Logger } = getXray();
|
|
11
|
+
|
|
12
|
+
const logger = new Logger(
|
|
13
|
+
"QuickBrick",
|
|
14
|
+
"packages/zapp-react-native-ui-components/Components/HandlePlayable"
|
|
15
|
+
);
|
|
8
16
|
|
|
9
17
|
const getPlayerModuleProperties = (PlayerModule: ZappPlugin) => {
|
|
10
18
|
if (PlayerModule?.Component && typeof PlayerModule.Component === "object") {
|
|
@@ -52,10 +60,25 @@ export const getPlayer = (
|
|
|
52
60
|
if (type) {
|
|
53
61
|
PlayerModule = findPluginByIdentifier(type, plugins)?.module;
|
|
54
62
|
|
|
63
|
+
if (!PlayerModule) {
|
|
64
|
+
logger.error({
|
|
65
|
+
message:
|
|
66
|
+
"PlayerModule is undefined – type mapping may be wrong or type not set for player",
|
|
67
|
+
data: {
|
|
68
|
+
type,
|
|
69
|
+
screen_id,
|
|
70
|
+
item_type_value: item?.type?.value,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return [null, {}];
|
|
75
|
+
}
|
|
76
|
+
|
|
55
77
|
return getPlayerWithModuleProperties(PlayerModule);
|
|
56
78
|
}
|
|
57
79
|
}
|
|
58
80
|
|
|
81
|
+
// TODO: Probably should be removed, Youtube plugin is deprecated
|
|
59
82
|
if (item?.content?.type === "youtube-id") {
|
|
60
83
|
PlayerModule = findYoutubePlugin(plugins)?.module;
|
|
61
84
|
|
|
@@ -70,5 +93,13 @@ export const getPlayer = (
|
|
|
70
93
|
)
|
|
71
94
|
);
|
|
72
95
|
|
|
96
|
+
if (!PlayerModule) {
|
|
97
|
+
logger.error({
|
|
98
|
+
message: "PlayerModule is undefined – playable plugin not found",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return [null, {}];
|
|
102
|
+
}
|
|
103
|
+
|
|
73
104
|
return getPlayerWithModuleProperties(PlayerModule);
|
|
74
105
|
};
|
|
@@ -3,8 +3,8 @@ import { isNil } from "ramda";
|
|
|
3
3
|
import { ImageStyle, View } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
FIT_POSITION,
|
|
6
|
-
IMAGE_SIZING_FIT,
|
|
7
6
|
IMAGE_SIZING_FILL,
|
|
7
|
+
IMAGE_SIZING_FIT,
|
|
8
8
|
} from "@applicaster/zapp-react-native-utils/manifestUtils/secondaryImage";
|
|
9
9
|
import { QBImage as Image } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
10
10
|
|
|
@@ -25,49 +25,51 @@ interface Props {
|
|
|
25
25
|
fitPosition: typeof FIT_POSITION;
|
|
26
26
|
fixedWidth: number;
|
|
27
27
|
fixedHeight: number;
|
|
28
|
-
onAsyncRender
|
|
28
|
+
onAsyncRender?: () => void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** Secondary Image Dynamic does not render until the image is loaded */
|
|
32
|
-
const SecondaryImageDynamic = (
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const SecondaryImageDynamic = withAsyncRenderHOC(
|
|
33
|
+
(props: Props & { onAsyncRender: () => void }) => {
|
|
34
|
+
const { uri, style, displayMode, imageSizing, fitPosition, onAsyncRender } =
|
|
35
|
+
props;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const imageDimension = useGetImageDimensions(
|
|
38
|
+
uri,
|
|
39
|
+
style.width as number,
|
|
40
|
+
isImageSizingFit(imageSizing) ? undefined : (style.height as number)
|
|
41
|
+
);
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
const containerHeight = imageDimension?.height;
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
const containerWidth = style?.width;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
if (isNil(imageDimension?.aspectRatio)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
51
|
+
return (
|
|
52
|
+
<View style={style} onLayout={onAsyncRender}>
|
|
53
|
+
<Image
|
|
54
|
+
{...props}
|
|
55
|
+
source={{ uri }}
|
|
56
|
+
style={{
|
|
57
|
+
...getStyle({
|
|
58
|
+
imageSizing,
|
|
59
|
+
fitPosition,
|
|
60
|
+
displayMode,
|
|
61
|
+
imageDimension,
|
|
62
|
+
containerHeight,
|
|
63
|
+
containerWidth,
|
|
64
|
+
}),
|
|
65
|
+
borderRadius: style.borderRadius,
|
|
66
|
+
aspectRatio: imageDimension.aspectRatio,
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
71
73
|
|
|
72
74
|
/** Secondary Image Fixed does not render the image until the image is loaded, but keep container rendered */
|
|
73
75
|
const SecondaryImageFixed = (props: Props) => {
|
|
@@ -79,7 +81,6 @@ const SecondaryImageFixed = (props: Props) => {
|
|
|
79
81
|
fitPosition,
|
|
80
82
|
fixedHeight,
|
|
81
83
|
fixedWidth,
|
|
82
|
-
onAsyncRender,
|
|
83
84
|
} = props;
|
|
84
85
|
|
|
85
86
|
const imageDimension = useGetImageDimensions(
|
|
@@ -89,7 +90,7 @@ const SecondaryImageFixed = (props: Props) => {
|
|
|
89
90
|
);
|
|
90
91
|
|
|
91
92
|
return (
|
|
92
|
-
<View style={style}
|
|
93
|
+
<View style={style}>
|
|
93
94
|
{isNil(imageDimension?.aspectRatio) ? null : (
|
|
94
95
|
<Image
|
|
95
96
|
{...props}
|
|
@@ -128,4 +129,4 @@ const SecondaryImageComponent = (props: Props) => {
|
|
|
128
129
|
);
|
|
129
130
|
};
|
|
130
131
|
|
|
131
|
-
export const SecondaryImage =
|
|
132
|
+
export const SecondaryImage = SecondaryImageComponent;
|
|
@@ -10,6 +10,10 @@ describe("SecondaryImage - Image", () => {
|
|
|
10
10
|
displayMode="dynamic"
|
|
11
11
|
uri={undefined}
|
|
12
12
|
style={{ width: 100 }}
|
|
13
|
+
imageSizing="fit"
|
|
14
|
+
fitPosition="center"
|
|
15
|
+
fixedWidth={0}
|
|
16
|
+
fixedHeight={0}
|
|
13
17
|
/>
|
|
14
18
|
);
|
|
15
19
|
|
|
@@ -23,6 +27,10 @@ describe("SecondaryImage - Image", () => {
|
|
|
23
27
|
displayMode="dynamic"
|
|
24
28
|
uri="someurl"
|
|
25
29
|
style={{ width: 100 }}
|
|
30
|
+
imageSizing="fit"
|
|
31
|
+
fitPosition="center"
|
|
32
|
+
fixedWidth={0}
|
|
33
|
+
fixedHeight={0}
|
|
26
34
|
/>
|
|
27
35
|
);
|
|
28
36
|
|
|
@@ -36,6 +44,93 @@ describe("SecondaryImage - Image", () => {
|
|
|
36
44
|
uri="someUrl"
|
|
37
45
|
displayMode="dynamic"
|
|
38
46
|
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
47
|
+
imageSizing="fill"
|
|
48
|
+
fitPosition="center"
|
|
49
|
+
fixedWidth={0}
|
|
50
|
+
fixedHeight={0}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
expect(wrapper.toJSON()).not.toEqual(null);
|
|
55
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("SecondaryImage should render in fixed mode without image until loaded", async () => {
|
|
59
|
+
const wrapper = await render(
|
|
60
|
+
<SecondaryImage
|
|
61
|
+
displayMode="fixed"
|
|
62
|
+
uri="someurl"
|
|
63
|
+
style={{ width: 100, height: 100, borderRadius: 5 }}
|
|
64
|
+
imageSizing="fit"
|
|
65
|
+
fitPosition="center"
|
|
66
|
+
fixedWidth={100}
|
|
67
|
+
fixedHeight={100}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("SecondaryImage should not render in dynamic mode without image", async () => {
|
|
75
|
+
const wrapper = await render(
|
|
76
|
+
<SecondaryImage
|
|
77
|
+
displayMode="dynamic"
|
|
78
|
+
uri={null}
|
|
79
|
+
style={{ width: 100, height: 100 }}
|
|
80
|
+
imageSizing="fit"
|
|
81
|
+
fitPosition="center"
|
|
82
|
+
fixedWidth={0}
|
|
83
|
+
fixedHeight={0}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect(wrapper.toJSON()).toEqual(null);
|
|
88
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("SecondaryImage should render in fixed mode with known dimensions", async () => {
|
|
92
|
+
const wrapper = await render(
|
|
93
|
+
<SecondaryImage
|
|
94
|
+
uri="someUrl"
|
|
95
|
+
displayMode="fixed"
|
|
96
|
+
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
97
|
+
imageSizing="fill"
|
|
98
|
+
fitPosition="center"
|
|
99
|
+
fixedWidth={100}
|
|
100
|
+
fixedHeight={100}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
expect(wrapper.toJSON()).not.toEqual(null);
|
|
105
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("SecondaryImage dynamic mode should call onAsyncRender when provided", async () => {
|
|
109
|
+
const wrapper = await render(
|
|
110
|
+
<SecondaryImage
|
|
111
|
+
uri="someUrl"
|
|
112
|
+
displayMode="dynamic"
|
|
113
|
+
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
114
|
+
imageSizing="fill"
|
|
115
|
+
fitPosition="center"
|
|
116
|
+
fixedWidth={0}
|
|
117
|
+
fixedHeight={0}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
expect(wrapper.toJSON()).not.toEqual(null);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("SecondaryImage fixed mode should not use async render props", async () => {
|
|
125
|
+
const wrapper = await render(
|
|
126
|
+
<SecondaryImage
|
|
127
|
+
uri="someUrl"
|
|
128
|
+
displayMode="fixed"
|
|
129
|
+
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
130
|
+
imageSizing="fill"
|
|
131
|
+
fitPosition="center"
|
|
132
|
+
fixedWidth={100}
|
|
133
|
+
fixedHeight={100}
|
|
39
134
|
/>
|
|
40
135
|
);
|
|
41
136
|
|
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`SecondaryImage - Image SecondaryImage fixed mode should not use async render props 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"borderRadius": 10,
|
|
8
|
+
"height": 100,
|
|
9
|
+
"width": 100,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
>
|
|
13
|
+
<Image
|
|
14
|
+
displayMode="fixed"
|
|
15
|
+
fitPosition="center"
|
|
16
|
+
fixedHeight={100}
|
|
17
|
+
fixedWidth={100}
|
|
18
|
+
imageSizing="fill"
|
|
19
|
+
source={
|
|
20
|
+
{
|
|
21
|
+
"uri": "someUrl",
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
style={
|
|
25
|
+
{
|
|
26
|
+
"aspectRatio": 1,
|
|
27
|
+
"borderRadius": 10,
|
|
28
|
+
"height": 100,
|
|
29
|
+
"width": 100,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
uri="someUrl"
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
35
|
+
`;
|
|
36
|
+
|
|
3
37
|
exports[`SecondaryImage - Image SecondaryImage should not render if no aspect ratio (dynamic) 1`] = `null`;
|
|
4
38
|
|
|
5
39
|
exports[`SecondaryImage - Image SecondaryImage should not render if no uri 1`] = `null`;
|
|
6
40
|
|
|
41
|
+
exports[`SecondaryImage - Image SecondaryImage should not render in dynamic mode without image 1`] = `null`;
|
|
42
|
+
|
|
7
43
|
exports[`SecondaryImage - Image SecondaryImage should render if known dimensions 1`] = `
|
|
8
44
|
<View
|
|
9
45
|
onLayout={[Function]}
|
|
@@ -17,6 +53,10 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
17
53
|
>
|
|
18
54
|
<Image
|
|
19
55
|
displayMode="dynamic"
|
|
56
|
+
fitPosition="center"
|
|
57
|
+
fixedHeight={0}
|
|
58
|
+
fixedWidth={0}
|
|
59
|
+
imageSizing="fill"
|
|
20
60
|
onAsyncRender={[Function]}
|
|
21
61
|
source={
|
|
22
62
|
{
|
|
@@ -35,3 +75,49 @@ exports[`SecondaryImage - Image SecondaryImage should render if known dimensions
|
|
|
35
75
|
/>
|
|
36
76
|
</View>
|
|
37
77
|
`;
|
|
78
|
+
|
|
79
|
+
exports[`SecondaryImage - Image SecondaryImage should render in fixed mode with known dimensions 1`] = `
|
|
80
|
+
<View
|
|
81
|
+
style={
|
|
82
|
+
{
|
|
83
|
+
"borderRadius": 10,
|
|
84
|
+
"height": 100,
|
|
85
|
+
"width": 100,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
>
|
|
89
|
+
<Image
|
|
90
|
+
displayMode="fixed"
|
|
91
|
+
fitPosition="center"
|
|
92
|
+
fixedHeight={100}
|
|
93
|
+
fixedWidth={100}
|
|
94
|
+
imageSizing="fill"
|
|
95
|
+
source={
|
|
96
|
+
{
|
|
97
|
+
"uri": "someUrl",
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
style={
|
|
101
|
+
{
|
|
102
|
+
"aspectRatio": 1,
|
|
103
|
+
"borderRadius": 10,
|
|
104
|
+
"height": 100,
|
|
105
|
+
"width": 100,
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
uri="someUrl"
|
|
109
|
+
/>
|
|
110
|
+
</View>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
exports[`SecondaryImage - Image SecondaryImage should render in fixed mode without image until loaded 1`] = `
|
|
114
|
+
<View
|
|
115
|
+
style={
|
|
116
|
+
{
|
|
117
|
+
"borderRadius": 5,
|
|
118
|
+
"height": 100,
|
|
119
|
+
"width": 100,
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
`;
|