@applicaster/zapp-react-native-ui-components 13.0.0-rc.14 → 13.0.0-rc.141
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/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
- package/Components/AudioPlayer/index.tsx +15 -0
- package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
- package/Components/AudioPlayer/mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap +66 -0
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/tv/Artwork.tsx +40 -0
- package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +37 -79
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +2 -1
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +12 -9
- package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +12 -9
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +5 -8
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +6 -6
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +11 -6
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +3 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +3 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +3 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +3 -5
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +9 -7
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +3 -5
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +3 -5
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +3 -5
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -5
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +14 -63
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/BaseFocusable/index.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +67 -31
- package/Components/Cell/Cell.tsx +14 -14
- package/Components/Cell/CellWithFocusable.tsx +50 -59
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/TvOSCellComponent.tsx +20 -26
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/index.js +3 -1
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
- package/Components/CellRendererResolver/index.ts +2 -1
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
- package/Components/ErrorScreen/index.tsx +14 -6
- package/Components/Focusable/Focusable.tsx +1 -54
- package/Components/Focusable/FocusableTvOS.tsx +6 -2
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/FocusableList/index.tsx +26 -10
- package/Components/FocusableScrollView/index.tsx +43 -13
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -3
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
- package/Components/Layout/TV/LayoutBackground.tsx +28 -0
- package/Components/Layout/TV/NavBarContainer.tsx +19 -23
- package/Components/Layout/TV/ScreenContainer.tsx +8 -2
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
- package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
- package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
- package/Components/Layout/TV/index.tsx +6 -20
- package/Components/Layout/TV/index.web.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +9 -135
- package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
- package/Components/ModalComponent/Button/Item.tsx +6 -5
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +45 -62
- package/Components/ModalComponent/Header/index.tsx +12 -11
- package/Components/ModalComponent/utils.ts +55 -7
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
- package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +76 -66
- package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +2 -2
- package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -68
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RefreshControl.tsx +1 -1
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +44 -4
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +115 -46
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
- package/Components/River/__tests__/componentsMap.test.js +64 -17
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/TestId.tsx +1 -5
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -5
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +4 -6
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/__tests__/Screen.test.tsx +53 -31
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +6 -6
- package/Components/Screen/hooks.ts +53 -0
- package/Components/Screen/index.tsx +16 -42
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
- package/Components/Tabs/Tab.tsx +12 -9
- package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
- package/Components/TextInputTv/index.tsx +6 -5
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/Scene.tsx +53 -24
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
- package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -23
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +16 -15
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
- package/Components/VideoModal/ModalAnimation/const.ts +5 -0
- package/Components/VideoModal/ModalAnimation/index.ts +4 -1
- package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +32 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +18 -10
- package/Components/VideoModal/PlayerWrapper.tsx +51 -57
- package/Components/VideoModal/VideoModal.tsx +17 -11
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +74 -104
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +51 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +38 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +6 -9
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +4 -17
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
- package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +6 -12
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
- package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
- package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
- package/Decorators/RiverFeedLoader/index.tsx +1 -1
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
- package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
- package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
- package/package.json +13 -11
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/AudioPlayer/Artwork.tsx +0 -35
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -123
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -50
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -27
- package/Components/AudioPlayer/index.ts +0 -1
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverFeedLoader/utils.ts +0 -100
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
- /package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
|
+
import { CellRendererResolver } from "../";
|
|
4
5
|
|
|
5
|
-
jest.mock("../../default-cell-renderer", () =>
|
|
6
|
-
|
|
7
|
-
);
|
|
6
|
+
jest.mock("../../default-cell-renderer", () => {
|
|
7
|
+
const View = jest.requireActual("react-native").View;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
return jest.fn((prop) => <View whoAmI="default renderer" someProp={prop} />);
|
|
10
|
+
});
|
|
10
11
|
|
|
11
12
|
const component = {
|
|
12
13
|
styles: {
|
|
@@ -43,17 +44,9 @@ describe("CellRendererResolver", () => {
|
|
|
43
44
|
cellStyles,
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
it("renders correctly", () => {
|
|
47
|
-
const result = shallow(
|
|
48
|
-
getResult({ component, plugins, styles, cellStyles })
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
expect(result).toMatchSnapshot();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
47
|
describe("with a default renderer plugin", () => {
|
|
55
48
|
it("renders correctly", () => {
|
|
56
|
-
const
|
|
49
|
+
const { UNSAFE_root } = render(
|
|
57
50
|
getResult({
|
|
58
51
|
component,
|
|
59
52
|
plugins,
|
|
@@ -62,56 +55,63 @@ describe("CellRendererResolver", () => {
|
|
|
62
55
|
})
|
|
63
56
|
);
|
|
64
57
|
|
|
65
|
-
expect(
|
|
58
|
+
expect(UNSAFE_root).toBeDefined();
|
|
66
59
|
});
|
|
67
60
|
|
|
68
61
|
it("returns default plugin if component has no cell_plugin_configuration_id", () => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
const { UNSAFE_getByProps } = render(
|
|
63
|
+
getResult({
|
|
64
|
+
component: {},
|
|
65
|
+
plugins,
|
|
66
|
+
styles,
|
|
67
|
+
cellStyles,
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(UNSAFE_getByProps({ whoAmI: "default renderer" })).toBeTruthy();
|
|
78
72
|
});
|
|
79
73
|
|
|
80
74
|
it("returns default plugin if requested cell plugin configuration does not exist", () => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
const { UNSAFE_getByProps } = render(
|
|
76
|
+
getResult({
|
|
77
|
+
component: { styles: { cell_plugin_configuration_id: "wrong-id" } },
|
|
78
|
+
plugins,
|
|
79
|
+
styles,
|
|
80
|
+
cellStyles,
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
expect(UNSAFE_getByProps({ whoAmI: "default renderer" })).toBeTruthy();
|
|
89
85
|
});
|
|
90
86
|
|
|
91
87
|
it("returns default plugin if cellStyles store is empty", () => {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
const { UNSAFE_getByProps } = render(
|
|
89
|
+
getResult({
|
|
90
|
+
component,
|
|
91
|
+
plugins,
|
|
92
|
+
styles,
|
|
93
|
+
cellStyles: {},
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(UNSAFE_getByProps({ whoAmI: "default renderer" })).toBeTruthy();
|
|
100
98
|
});
|
|
101
99
|
|
|
102
100
|
it("returns null if requested renderer plugin does not exist", () => {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
const { UNSAFE_getByProps } = render(
|
|
102
|
+
getResult({
|
|
103
|
+
component: {
|
|
104
|
+
styles: {
|
|
105
|
+
cell_plugin_configuration_id: "FGHIJ-123456",
|
|
106
|
+
},
|
|
107
107
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
plugins,
|
|
109
|
+
styles,
|
|
110
|
+
cellStyles,
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
113
|
|
|
114
|
-
expect(
|
|
114
|
+
expect(UNSAFE_getByProps({ whoAmI: "default renderer" })).toBeTruthy();
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
2
|
+
import { isGroup } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
2
3
|
|
|
3
4
|
import { componentsLogger } from "../../Helpers/logger";
|
|
4
5
|
import defaultCellRenderer from "../default-cell-renderer";
|
|
@@ -80,7 +81,7 @@ export function CellRendererResolver({
|
|
|
80
81
|
}: Props) {
|
|
81
82
|
const cellRendererPlugin = getRendererPlugin(component, plugins, cellStyles);
|
|
82
83
|
|
|
83
|
-
if (!cellRendererPlugin && component
|
|
84
|
+
if (!cellRendererPlugin && !isGroup(component)) {
|
|
84
85
|
logger.warning({
|
|
85
86
|
message: "Could not resolve cell builder plugin",
|
|
86
87
|
data: { component },
|
|
@@ -1,48 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`ComponentResolver renders correctly 1`] = `
|
|
4
|
-
<ContextProvider
|
|
5
|
-
value={null}
|
|
6
|
-
>
|
|
7
|
-
<Memo(ComponentResolver)
|
|
8
|
-
cellStyles={Object {}}
|
|
9
|
-
component={
|
|
10
|
-
Object {
|
|
11
|
-
"component_type": "some_component",
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
components={
|
|
15
|
-
Object {
|
|
16
|
-
"SomeComponent": [MockFunction],
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
decorators={[MockFunction]}
|
|
20
|
-
dispatch={[Function]}
|
|
21
|
-
plugins={Array []}
|
|
22
|
-
store={
|
|
23
|
-
Object {
|
|
24
|
-
"clearActions": [Function],
|
|
25
|
-
"dispatch": [Function],
|
|
26
|
-
"getActions": [Function],
|
|
27
|
-
"getState": [Function],
|
|
28
|
-
"replaceReducer": [Function],
|
|
29
|
-
"subscribe": [Function],
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/>
|
|
33
|
-
</ContextProvider>
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
3
|
exports[`ComponentResolverComponent initializes the cell renderer plugin module if matching plugin exists 1`] = `
|
|
37
|
-
<
|
|
4
|
+
<View
|
|
38
5
|
rendered={true}
|
|
39
6
|
/>
|
|
40
7
|
`;
|
|
41
|
-
|
|
42
|
-
exports[`ComponentResolverComponent renders the Component if it exists 1`] = `
|
|
43
|
-
<mockConstructor
|
|
44
|
-
rendered={true}
|
|
45
|
-
/>
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
exports[`ComponentResolverComponent returns null if the component doesn't exist 1`] = `""`;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
5
4
|
import configureStore from "redux-mock-store";
|
|
6
5
|
|
|
7
|
-
const
|
|
6
|
+
const mockLogger = {
|
|
8
7
|
warning: jest.fn(),
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
jest.mock("../../../Helpers/logger", () => ({
|
|
12
11
|
componentsLogger: {
|
|
13
|
-
addSubsystem: jest.fn(() =>
|
|
12
|
+
addSubsystem: jest.fn(() => mockLogger),
|
|
14
13
|
},
|
|
15
14
|
}));
|
|
16
15
|
|
|
17
|
-
jest.mock("../../default-cell-renderer", () =>
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
jest.mock("../../default-cell-renderer", () => {
|
|
17
|
+
const View = jest.requireActual("react-native").View;
|
|
18
|
+
|
|
19
|
+
return jest.fn((prop) => <View whoAmI="default renderer" someProp={prop} />);
|
|
20
|
+
});
|
|
20
21
|
|
|
21
22
|
const mock_rtl_flag = false;
|
|
22
23
|
|
|
@@ -41,37 +42,36 @@ const store = configureStore()({
|
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
const component = { component_type: "some_component" };
|
|
44
|
-
const decorators =
|
|
45
|
+
const decorators = (x) => x;
|
|
45
46
|
const renderFunction = jest.fn((Comp) => <Comp rendered />);
|
|
46
47
|
|
|
47
48
|
function clearAllMocks() {
|
|
48
|
-
|
|
49
|
-
decorators.mockClear();
|
|
50
|
-
renderFunction.mockClear();
|
|
51
|
-
logger.warning.mockClear();
|
|
49
|
+
jest.clearAllMocks();
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
describe("ComponentResolver", () => {
|
|
55
53
|
beforeEach(clearAllMocks);
|
|
56
54
|
|
|
57
55
|
it("renders correctly", () => {
|
|
58
|
-
const
|
|
56
|
+
const { toJSON } = render(
|
|
59
57
|
<ComponentResolver
|
|
60
58
|
component={component}
|
|
61
59
|
decorators={decorators}
|
|
62
60
|
store={store}
|
|
63
|
-
|
|
61
|
+
>
|
|
62
|
+
{() => null}
|
|
63
|
+
</ComponentResolver>
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
expect(
|
|
66
|
+
expect(toJSON()).toBeNull();
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
describe("ComponentResolverComponent", () => {
|
|
71
71
|
beforeEach(clearAllMocks);
|
|
72
72
|
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const renderComponent = (component, plugins) =>
|
|
74
|
+
render(
|
|
75
75
|
<ComponentResolverComponent
|
|
76
76
|
components={components}
|
|
77
77
|
component={component}
|
|
@@ -85,9 +85,9 @@ describe("ComponentResolverComponent", () => {
|
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
it("renders the Component if it exists", () => {
|
|
88
|
-
const
|
|
88
|
+
const { toJSON } = renderComponent(component, plugins);
|
|
89
89
|
|
|
90
|
-
expect(
|
|
90
|
+
expect(toJSON()).not.toBeNull();
|
|
91
91
|
|
|
92
92
|
expect(renderFunction).toHaveBeenCalledWith(
|
|
93
93
|
SomeComponent,
|
|
@@ -96,24 +96,22 @@ describe("ComponentResolverComponent", () => {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
it("returns null if the component doesn't exist", () => {
|
|
99
|
-
const
|
|
99
|
+
const { UNSAFE_root } = renderComponent({ component_type: "foo" }, plugins);
|
|
100
100
|
|
|
101
101
|
const warningMessage =
|
|
102
102
|
"Component foo cannot be found - it is skipped from rendering";
|
|
103
103
|
|
|
104
|
-
expect(
|
|
105
|
-
expect(
|
|
104
|
+
expect(UNSAFE_root.children.length).toBe(0);
|
|
105
|
+
expect(mockLogger.warning).toHaveBeenCalledTimes(2);
|
|
106
106
|
|
|
107
|
-
expect(
|
|
108
|
-
|
|
109
|
-
expect(logger.warning).toHaveBeenNthCalledWith(
|
|
107
|
+
expect(mockLogger.warning).toHaveBeenNthCalledWith(
|
|
110
108
|
1,
|
|
111
109
|
expect.objectContaining({
|
|
112
110
|
message: "Could not resolve cell builder plugin",
|
|
113
111
|
})
|
|
114
112
|
);
|
|
115
113
|
|
|
116
|
-
expect(
|
|
114
|
+
expect(mockLogger.warning).toHaveBeenNthCalledWith(
|
|
117
115
|
2,
|
|
118
116
|
expect.objectContaining({
|
|
119
117
|
message: warningMessage,
|
|
@@ -122,11 +120,9 @@ describe("ComponentResolverComponent", () => {
|
|
|
122
120
|
});
|
|
123
121
|
|
|
124
122
|
it("initializes the cell renderer plugin module if matching plugin exists", () => {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const wrapper = getWrapper(component, plugins);
|
|
123
|
+
const { toJSON } = renderComponent(component, plugins);
|
|
128
124
|
|
|
129
|
-
expect(
|
|
125
|
+
expect(toJSON()).toMatchSnapshot();
|
|
130
126
|
|
|
131
127
|
expect(renderFunction).toHaveBeenCalledWith(
|
|
132
128
|
SomeComponent,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
3
|
|
|
4
|
-
import { ContentScreen } from "../
|
|
4
|
+
import { ContentScreen } from "../";
|
|
5
5
|
|
|
6
6
|
describe("<ContentScreen />", () => {
|
|
7
7
|
it("renders correctly", () => {
|
|
8
|
-
expect(() =>
|
|
8
|
+
expect(() => render(<ContentScreen />)).toThrowErrorMatchingSnapshot();
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`DISPLAY_STATES matches the snapshot 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"CONTENT": "CONTENT",
|
|
6
6
|
"CONTROLS": "CONTROLS",
|
|
7
7
|
"DISCOVERY": "DISCOVERY",
|
|
@@ -9,7 +9,7 @@ Object {
|
|
|
9
9
|
`;
|
|
10
10
|
|
|
11
11
|
exports[`DisplayStateContext has the correct properties 1`] = `
|
|
12
|
-
|
|
12
|
+
{
|
|
13
13
|
"Consumer": [MockFunction],
|
|
14
14
|
"Provider": [MockFunction],
|
|
15
15
|
"withConsumer": [MockFunction],
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
ImageStyle,
|
|
5
5
|
StyleSheet,
|
|
6
6
|
Text,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
TextStyle,
|
|
9
|
-
ImageStyle,
|
|
10
7
|
TextProps,
|
|
8
|
+
TextStyle,
|
|
9
|
+
View,
|
|
10
|
+
ViewStyle,
|
|
11
11
|
} from "react-native";
|
|
12
12
|
import { defaultAsset } from "./defaultAsset";
|
|
13
13
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
@@ -105,6 +105,11 @@ const defaultProps = {
|
|
|
105
105
|
alignItems: "center",
|
|
106
106
|
justifyContent: "center",
|
|
107
107
|
},
|
|
108
|
+
focusedButton: {
|
|
109
|
+
backgroundColor: "#3a3a3a",
|
|
110
|
+
borderColor: "#ffffff",
|
|
111
|
+
borderWidth: 2,
|
|
112
|
+
},
|
|
108
113
|
buttonText: {
|
|
109
114
|
fontFamily: platformSelect({
|
|
110
115
|
ios: "SFProText-Medium",
|
|
@@ -116,6 +121,9 @@ const defaultProps = {
|
|
|
116
121
|
color: "rgba(255, 255, 255, 1)",
|
|
117
122
|
textTransform: "uppercase",
|
|
118
123
|
},
|
|
124
|
+
focusedText: {
|
|
125
|
+
color: "#ffffff",
|
|
126
|
+
},
|
|
119
127
|
},
|
|
120
128
|
};
|
|
121
129
|
|
|
@@ -150,13 +158,13 @@ export function ErrorScreen(props: Props) {
|
|
|
150
158
|
return (
|
|
151
159
|
<View style={[baseStyles.container, styles.screen]}>
|
|
152
160
|
<View style={[baseStyles.container, styles.component]}>
|
|
153
|
-
{assetEnabled
|
|
161
|
+
{assetEnabled ? (
|
|
154
162
|
<Image
|
|
155
163
|
fadeDuration={0}
|
|
156
164
|
source={{ uri: asset }}
|
|
157
165
|
style={styles.asset}
|
|
158
166
|
/>
|
|
159
|
-
)}
|
|
167
|
+
) : null}
|
|
160
168
|
<Text style={styles.title} {...titleProps}>
|
|
161
169
|
{title}
|
|
162
170
|
</Text>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/* eslint-disable react/no-unknown-property */
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import * as R from "ramda";
|
|
3
3
|
|
|
4
4
|
import { BaseFocusable } from "../BaseFocusable";
|
|
5
5
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
@@ -42,8 +42,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
42
42
|
this.resetLongPressTimeout = this.resetLongPressTimeout.bind(this);
|
|
43
43
|
this.longPress = this.longPress.bind(this);
|
|
44
44
|
this.press = this.press.bind(this);
|
|
45
|
-
this.focus = this.focus.bind(this);
|
|
46
|
-
this.blur = this.blur.bind(this);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
/**
|
|
@@ -55,37 +53,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
55
53
|
return this.preferredFocus();
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
/**
|
|
59
|
-
* Sets the focus on this item. Will trigger sequentially a sequence of
|
|
60
|
-
* functions (willReceiveFocus, focus, hasReceivedFocus). If these functions (defined in the Focusable
|
|
61
|
-
* Item underlying component) return promises, execution will wait before it proceeds to the next. This
|
|
62
|
-
* is useful for triggering sequential operations that specifically require to fully run before or after
|
|
63
|
-
* focus is actually set on that item.
|
|
64
|
-
* @param {string} scrollDirection string representation of the direction of the navigation which landed
|
|
65
|
-
* to this item being focused
|
|
66
|
-
*/
|
|
67
|
-
setFocus(scrollDirection) {
|
|
68
|
-
const focusMethods = [
|
|
69
|
-
this.willReceiveFocus,
|
|
70
|
-
this.focus,
|
|
71
|
-
this.hasReceivedFocus,
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
const self = this;
|
|
75
|
-
|
|
76
|
-
return R.reduce(
|
|
77
|
-
(sequence, method) => {
|
|
78
|
-
return sequence
|
|
79
|
-
.then(() => method.apply(self, [scrollDirection]))
|
|
80
|
-
.catch((e) => {
|
|
81
|
-
throw e;
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
Promise.resolve(),
|
|
85
|
-
focusMethods
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
56
|
startLongPressTimeout() {
|
|
90
57
|
this.longPressTimeout = setTimeout(() => {
|
|
91
58
|
this.longPress(null);
|
|
@@ -102,26 +69,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
102
69
|
}
|
|
103
70
|
}
|
|
104
71
|
|
|
105
|
-
/**
|
|
106
|
-
* will invoke the underlying component's focus method
|
|
107
|
-
* @param {Object} scrollDirection
|
|
108
|
-
* @returns {Promise}
|
|
109
|
-
*/
|
|
110
|
-
focus(scrollDirection) {
|
|
111
|
-
return this.onFocus(this, scrollDirection); // invokeComponentMethod(this, "onFocus", scrollDirection);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* will invoke the underlying component's blur method
|
|
116
|
-
* @param {Object} scrollDirection
|
|
117
|
-
* @returns {Promise}
|
|
118
|
-
*/
|
|
119
|
-
blur(
|
|
120
|
-
scrollDirection?: FocusManager.Web.Direction | FocusManager.IOS.Direction
|
|
121
|
-
) {
|
|
122
|
-
return this.onBlur(this, scrollDirection);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
72
|
/**
|
|
126
73
|
* will invoke the underlying component's press method
|
|
127
74
|
* @param {Object} keyEvent
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
focusManager,
|
|
10
10
|
forceFocusableFocus,
|
|
11
11
|
} from "@applicaster/zapp-react-native-utils/appUtils/focusManager/index.ios";
|
|
12
|
-
import { findNodeHandle } from "react-native";
|
|
12
|
+
import { findNodeHandle, ViewStyle } from "react-native";
|
|
13
13
|
|
|
14
14
|
function noop() {}
|
|
15
15
|
|
|
@@ -35,6 +35,10 @@ type Props = {
|
|
|
35
35
|
forceFocus?: boolean;
|
|
36
36
|
initialFocus?: boolean;
|
|
37
37
|
onLayout?: (e: any) => void;
|
|
38
|
+
willReceiveFocus: () => void;
|
|
39
|
+
hasReceivedFocus: () => void;
|
|
40
|
+
offsetUpdater: (arg1: string, arg2: number) => number;
|
|
41
|
+
style: ViewStyle;
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
export class Focusable extends BaseFocusable<Props> {
|
|
@@ -90,7 +94,7 @@ export class Focusable extends BaseFocusable<Props> {
|
|
|
90
94
|
onBlur(nativeEvent);
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
setFocus(
|
|
97
|
+
setFocus(_direction, callback) {
|
|
94
98
|
const focusMethods = [
|
|
95
99
|
{ method: this.willReceiveFocus },
|
|
96
100
|
{ method: this.focus, args: [callback] },
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
type Props =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} & Partial<ParentFocus>;
|
|
3
|
+
type Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
onPress?: (ref: FocusManager.TouchableRef) => void;
|
|
7
|
+
onPressIn?: (ref: FocusManager.TouchableRef) => void;
|
|
8
|
+
onPressOut?: (ref: FocusManager.TouchableRef) => void;
|
|
9
|
+
onLongPress?: (ref: FocusManager.TouchableRef) => void;
|
|
10
|
+
onFocus?: (
|
|
11
|
+
ref: FocusManager.TouchableRef,
|
|
12
|
+
options: FocusManager.Android.CallbackOptions
|
|
13
|
+
) => void;
|
|
14
|
+
onBlur?: (
|
|
15
|
+
ref: FocusManager.TouchableRef,
|
|
16
|
+
options: FocusManager.Android.CallbackOptions
|
|
17
|
+
) => void;
|
|
18
|
+
|
|
19
|
+
disableFocus?: boolean;
|
|
20
|
+
blockFocus?: boolean;
|
|
21
|
+
} & Partial<ParentFocus>;
|
|
23
22
|
|
|
24
23
|
export class Touchable extends React.Component<Props> {
|
|
25
24
|
onPress(focusableRef: FocusManager.TouchableRef): void {
|
|
@@ -33,6 +33,8 @@ type Props = {
|
|
|
33
33
|
onLongPress?: (ref: FocusManager.FocusableRef) => void;
|
|
34
34
|
onRegister?: () => void;
|
|
35
35
|
isFocusableCell?: boolean;
|
|
36
|
+
/** only for FocusableScrollView */
|
|
37
|
+
onSetIsFocusable?: (isFocusable: boolean) => void;
|
|
36
38
|
} & ParentFocus;
|
|
37
39
|
|
|
38
40
|
export const FocusableContext = React.createContext<
|
|
@@ -67,6 +69,7 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
67
69
|
onLongPress,
|
|
68
70
|
onRegister = noop,
|
|
69
71
|
isFocusableCell = true,
|
|
72
|
+
onSetIsFocusable,
|
|
70
73
|
} = props;
|
|
71
74
|
|
|
72
75
|
const isRTL = useIsRTL();
|
|
@@ -137,9 +140,13 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
137
140
|
[onBlur]
|
|
138
141
|
);
|
|
139
142
|
|
|
140
|
-
const setIsFocusable = React.useCallback(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
const setIsFocusable = React.useCallback(
|
|
144
|
+
(blockFocus) => {
|
|
145
|
+
onSetIsFocusable?.(blockFocus);
|
|
146
|
+
setDisableFocus(!blockFocus);
|
|
147
|
+
},
|
|
148
|
+
[onSetIsFocusable]
|
|
149
|
+
);
|
|
143
150
|
|
|
144
151
|
const parentFocus = React.useMemo(
|
|
145
152
|
() => ({
|
|
@@ -23,7 +23,7 @@ export function FocusableCell(props: Props) {
|
|
|
23
23
|
behavior,
|
|
24
24
|
} = props;
|
|
25
25
|
|
|
26
|
-
const state = useCellState({
|
|
26
|
+
const state = useCellState({ item, behavior, focused });
|
|
27
27
|
|
|
28
28
|
React.useEffect(() => {
|
|
29
29
|
if (focused && scrollTo && !isAndroid) {
|