@applicaster/zapp-react-native-ui-components 12.0.0-rc.5 → 12.0.0-rc.51
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/AnimatedInOut/index.tsx +18 -10
- package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/Cell/Cell.tsx +2 -2
- package/Components/Cell/CellWithFocusable.tsx +21 -14
- package/Components/Cell/TvOSCellComponent.tsx +2 -2
- package/Components/ErrorScreen/index.tsx +1 -1
- package/Components/FocusableCell/index.tsx +7 -7
- package/Components/FocusableList/FocusableChild.ts +24 -14
- package/Components/FocusableList/FocusableItem.tsx +1 -1
- package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
- package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
- package/Components/FocusableList/index.tsx +26 -25
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +1 -1
- package/Components/HookRenderer/index.tsx +1 -6
- package/Components/Image/Image.android.tsx +3 -22
- package/Components/Image/Image.tsx +18 -2
- package/Components/Image/utils/index.ts +39 -0
- package/Components/Layout/TV/__tests__/index.test.tsx +1 -34
- package/Components/Layout/TV/index.tsx +20 -36
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +0 -1
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +8 -10
- package/Components/MasterCell/utils/index.ts +16 -5
- package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
- package/Components/ModalComponent/Button/Item.tsx +82 -0
- package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
- package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
- package/Components/ModalComponent/Button/assets.ts +4 -0
- package/Components/ModalComponent/Button/index.tsx +111 -0
- package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
- package/Components/ModalComponent/Header/Title.tsx +70 -0
- package/Components/ModalComponent/Header/assets.ts +4 -0
- package/Components/ModalComponent/Header/index.tsx +71 -0
- package/Components/ModalComponent/Header/utils.ts +79 -0
- package/Components/ModalComponent/index.tsx +38 -0
- package/Components/ModalComponent/utils.ts +126 -0
- package/Components/PlayerContainer/ErrorDisplay/ErrorDisplay.tsx +4 -7
- package/Components/PlayerContainer/PlayerContainer.tsx +60 -30
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
- package/Components/PlayerImageBackground/index.tsx +34 -8
- package/Components/River/ComponentsMap/ComponentsMap.tsx +25 -0
- package/Components/River/River.tsx +8 -5
- package/Components/River/TV/River.tsx +2 -2
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/River/__tests__/componentsMap.test.js +7 -0
- package/Components/River/useScreenConfiguration.ts +5 -6
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
- package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
- package/Components/RouteManager/index.tsx +5 -3
- package/Components/Screen/__tests__/Screen.test.tsx +48 -36
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +20 -6
- package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
- package/Components/Screen/index.tsx +92 -44
- package/Components/Screen/navigationHandler.ts +0 -82
- package/Components/Screen/orientationHandler.ts +1 -1
- package/Components/ScreenResolver/index.tsx +1 -1
- package/Components/Tabs/TV/styles.ts +1 -1
- package/Components/TrackedView/index.tsx +6 -3
- package/Components/VideoLive/LiveImageManager.ts +42 -13
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +22 -27
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +342 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +151 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +438 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +143 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
- package/Components/VideoModal/PlayerDetails.tsx +3 -0
- package/Components/VideoModal/PlayerWrapper.tsx +119 -95
- package/Components/VideoModal/VideoModal.tsx +8 -25
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +8 -3
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +242 -166
- package/Components/VideoModal/hooks/useModalSize.ts +13 -4
- package/Components/VideoModal/utils.ts +3 -3
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
- package/Components/ZappUIComponent/index.tsx +22 -12
- package/Components/index.js +2 -0
- package/Contexts/ScreenContext/index.tsx +1 -4
- package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
- package/Decorators/RiverResolver/index.tsx +0 -4
- package/Decorators/index.tsx +0 -4
- package/package.json +5 -6
- package/Components/VideoModal/hooks/usePosition.ts +0 -50
|
@@ -23,13 +23,13 @@ export const useConfiguration = () => {
|
|
|
23
23
|
const targetScreenConfiguration = rivers?.[targetScreenId];
|
|
24
24
|
|
|
25
25
|
const pluginConfiguration =
|
|
26
|
-
pluginConfigurations[targetScreenConfiguration
|
|
26
|
+
pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
|
|
27
27
|
|
|
28
28
|
const playerPluginConfig = playerManager.getPluginConfiguration();
|
|
29
29
|
|
|
30
30
|
const config = R.mergeRight(playerPluginConfig, {
|
|
31
|
-
...targetScreenConfiguration
|
|
32
|
-
...targetScreenConfiguration
|
|
31
|
+
...targetScreenConfiguration?.general,
|
|
32
|
+
...targetScreenConfiguration?.styles,
|
|
33
33
|
...pluginConfiguration,
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { shallow } from "enzyme";
|
|
6
|
+
import { create, act } from "react-test-renderer";
|
|
7
|
+
import { shallowToJson } from "enzyme-to-json";
|
|
8
|
+
|
|
9
|
+
import { ViewportEvents } from "../../ViewportEvents";
|
|
10
|
+
|
|
11
|
+
jest.useFakeTimers();
|
|
5
12
|
|
|
13
|
+
jest.mock("react-native/Libraries/ReactNative/UIManager", () => {
|
|
6
14
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
success(100, 100, 400, 400);
|
|
11
|
-
}),
|
|
12
|
-
},
|
|
13
|
-
findNodeHandle: jest.fn(() => 1234),
|
|
14
|
-
Animated: {
|
|
15
|
-
timing: jest.fn(() => ({ start: jest.fn() })),
|
|
15
|
+
...jest.requireActual("react-native/Libraries/ReactNative/NativeUIManager"),
|
|
16
|
+
measureLayout: (handle, parent, error, success) => {
|
|
17
|
+
success(100, 100, 400, 400);
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
jest.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
|
|
23
|
+
...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
|
|
24
|
+
findNodeHandle: () => 1234,
|
|
25
|
+
}));
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
import TestRenderer from "react-test-renderer";
|
|
24
|
-
import { act } from "@testing-library/react-hooks";
|
|
25
|
-
import { shallowToJson } from "enzyme-to-json";
|
|
27
|
+
const ReactNative = require("react-native");
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
const { Animated, ScrollView } = ReactNative;
|
|
30
|
+
|
|
31
|
+
Animated.timing = jest.fn(() => ({ start: jest.fn() }));
|
|
28
32
|
|
|
29
33
|
const viewportEventsManager = new ViewportEvents(true);
|
|
30
34
|
|
|
31
|
-
const {
|
|
32
|
-
const { ViewportAware } = require("../index");
|
|
35
|
+
const { ViewportAware } = require("../");
|
|
33
36
|
const { ViewportTracker } = require("../../ViewportTracker");
|
|
34
37
|
|
|
35
38
|
const TestComponent = (props) => {
|
|
@@ -116,7 +119,7 @@ describe("<ViewportAware />", () => {
|
|
|
116
119
|
});
|
|
117
120
|
|
|
118
121
|
it("invokes the onViewportEnter function when entering the viewport", () => {
|
|
119
|
-
const wrapper =
|
|
122
|
+
const wrapper = create(
|
|
120
123
|
getWrapper(() => (
|
|
121
124
|
<TestComponent
|
|
122
125
|
preTriggerRatio={0.1}
|
|
@@ -134,6 +137,8 @@ describe("<ViewportAware />", () => {
|
|
|
134
137
|
width: 1920,
|
|
135
138
|
height: 1080,
|
|
136
139
|
});
|
|
140
|
+
|
|
141
|
+
jest.runAllTimers();
|
|
137
142
|
});
|
|
138
143
|
|
|
139
144
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
@@ -151,7 +156,7 @@ describe("<ViewportAware />", () => {
|
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
it("invokes the onViewportLeave function when leaving the viewport", () => {
|
|
154
|
-
const wrapper =
|
|
159
|
+
const wrapper = create(
|
|
155
160
|
getWrapper(() => (
|
|
156
161
|
<TestComponent
|
|
157
162
|
preTriggerRatio={0.1}
|
|
@@ -5,11 +5,10 @@ import { ViewportEvents } from "../../ViewportEvents";
|
|
|
5
5
|
|
|
6
6
|
const TestComponent = () => <ScrollView />;
|
|
7
7
|
|
|
8
|
-
jest.mock("react-native", () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
8
|
+
jest.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
|
|
9
|
+
...jest.requireActual("react-native/Libraries/Renderer/shims/ReactNative"),
|
|
10
|
+
findNodeHandle: () => 1234,
|
|
11
|
+
}));
|
|
13
12
|
|
|
14
13
|
const viewportEventsManager = new ViewportEvents(true);
|
|
15
14
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { Placeholder } from "./Placeholder";
|
|
12
12
|
import { useInitialLoading } from "./hooks";
|
|
13
|
-
import {
|
|
13
|
+
import { useFocusable } from "../Focusable/index.android";
|
|
14
14
|
|
|
15
15
|
type ReactComponent = React.ComponentType<any>;
|
|
16
16
|
|
|
@@ -26,13 +26,23 @@ type ZappUIComponentType = {
|
|
|
26
26
|
options?: Options;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
type RenderComponentProps = any;
|
|
30
|
+
|
|
31
|
+
const RenderComponent = (
|
|
32
|
+
Component: ReactComponent | undefined,
|
|
33
|
+
args: RenderComponentProps
|
|
34
|
+
) => {
|
|
35
|
+
const { component, parent } = args;
|
|
32
36
|
|
|
37
|
+
const contextValue = React.useMemo(
|
|
38
|
+
() => ({ ...component, parent }),
|
|
39
|
+
[component, parent]
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (Component) {
|
|
33
43
|
return (
|
|
34
|
-
<UIComponentContext.Provider value={
|
|
35
|
-
<Component {...
|
|
44
|
+
<UIComponentContext.Provider value={contextValue}>
|
|
45
|
+
<Component {...args} />
|
|
36
46
|
</UIComponentContext.Provider>
|
|
37
47
|
);
|
|
38
48
|
}
|
|
@@ -117,7 +127,7 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
|
|
|
117
127
|
props;
|
|
118
128
|
|
|
119
129
|
const parent = useUIComponentContext();
|
|
120
|
-
const { setIsFocusable } =
|
|
130
|
+
const { setIsFocusable } = useFocusable();
|
|
121
131
|
|
|
122
132
|
const isLoading = toBooleanWithDefaultFalse(zappPipesData?.loading);
|
|
123
133
|
const isInitialLoading = useInitialLoading(isLoading);
|
|
@@ -154,11 +164,11 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
|
|
|
154
164
|
}, [props.component?.rules?.component_cells_focusable]);
|
|
155
165
|
|
|
156
166
|
if (isDataSourceEmpty(props) && allowsEmptyDataSource) {
|
|
157
|
-
return
|
|
167
|
+
return RenderComponent(Component, componentProps);
|
|
158
168
|
}
|
|
159
169
|
|
|
160
|
-
if (isLoading && !zappPipesData
|
|
161
|
-
return
|
|
170
|
+
if (isLoading && !zappPipesData?.data && isInitialLoading) {
|
|
171
|
+
return RenderComponent(LoadingComponent || Placeholder, componentProps);
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
if (zappPipesData?.error) {
|
|
@@ -167,9 +177,9 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
|
|
|
167
177
|
index: componentIndex,
|
|
168
178
|
});
|
|
169
179
|
|
|
170
|
-
return
|
|
180
|
+
return RenderComponent(ErrorComponent, componentProps);
|
|
171
181
|
}
|
|
172
182
|
|
|
173
|
-
return
|
|
183
|
+
return RenderComponent(Component, componentProps);
|
|
174
184
|
};
|
|
175
185
|
}
|
package/Components/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { createContext, ReactNode, useMemo, useState } from "react";
|
|
2
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
2
|
import {
|
|
4
3
|
useCurrentScreenData,
|
|
5
4
|
useNavigation,
|
|
6
5
|
useRoute,
|
|
6
|
+
isNavBarVisible,
|
|
7
7
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
8
8
|
import { useModalNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ModalNavigationContext";
|
|
9
9
|
import { useNestedNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NestedNavigationContext";
|
|
10
|
-
import { isNavBarVisible } from "../../Components/Screen/navigationHandler";
|
|
11
10
|
|
|
12
11
|
type ScreenContextType = {
|
|
13
12
|
navBar: {
|
|
@@ -42,8 +41,6 @@ export function ScreenContextProvider({
|
|
|
42
41
|
}) {
|
|
43
42
|
const { data, modalData, videoModalState, canGoBack } = useNavigation();
|
|
44
43
|
|
|
45
|
-
const { rivers: _rivers } = usePickFromState(["rivers", "plugins"]);
|
|
46
|
-
|
|
47
44
|
// There are 4 route scenarios
|
|
48
45
|
// For regular screens take date from navigator stack.
|
|
49
46
|
// is path is model grab screenData from modal state
|
|
@@ -12,11 +12,16 @@ export function withComponentsMapProvider(Component: React.ComponentType<any>) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const setComponentHeightById = (id: string | number, height: number) => {
|
|
15
|
-
componentsHeightMapRef.current = {
|
|
15
|
+
componentsHeightMapRef.current = {
|
|
16
|
+
...componentsHeightMapRef.current,
|
|
17
|
+
[id]: height,
|
|
18
|
+
};
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
return (
|
|
19
|
-
<ComponentsMapProvider
|
|
22
|
+
<ComponentsMapProvider
|
|
23
|
+
{...{ setComponentHeightById, getComponentHeightById }}
|
|
24
|
+
>
|
|
20
25
|
<Component {...props} />
|
|
21
26
|
</ComponentsMapProvider>
|
|
22
27
|
);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
ZappComponent,
|
|
5
|
-
ZappRivers,
|
|
6
|
-
} from "@applicaster/zapp-react-native-flow-types";
|
|
7
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
8
4
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
9
5
|
import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
package/Decorators/index.tsx
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.51",
|
|
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",
|
|
@@ -29,16 +29,15 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@applicaster/zapp-react-native-flow-types": "1.5.0",
|
|
33
32
|
"@types/react": "17.0.2",
|
|
34
33
|
"@types/react-native": "0.69.6",
|
|
35
34
|
"redux-mock-store": "^1.5.3"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@applicaster/applicaster-types": "12.0.0-rc.
|
|
39
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
40
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
41
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-rc.51",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.51",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.51",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.51",
|
|
42
41
|
"promise": "^8.3.0",
|
|
43
42
|
"react-router-native": "^5.1.2",
|
|
44
43
|
"url": "^0.11.0",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useNavigation,
|
|
3
|
-
useNavigationType,
|
|
4
|
-
MenuTypes,
|
|
5
|
-
useGetBottomTabBarHeight,
|
|
6
|
-
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
7
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
|
-
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
9
|
-
|
|
10
|
-
import { useConfiguration } from "../utils";
|
|
11
|
-
|
|
12
|
-
type Option<T> = T | undefined;
|
|
13
|
-
|
|
14
|
-
type Return = {
|
|
15
|
-
top: Option<number>;
|
|
16
|
-
height: Option<number>;
|
|
17
|
-
bottom: Option<number>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const usePosition = (): Return => {
|
|
21
|
-
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
22
|
-
const insets = useSafeAreaInsets();
|
|
23
|
-
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
videoModalState: { mode },
|
|
27
|
-
currentRoute,
|
|
28
|
-
screenData,
|
|
29
|
-
} = useNavigation();
|
|
30
|
-
|
|
31
|
-
const docked = mode === "MINIMIZED";
|
|
32
|
-
|
|
33
|
-
const navType = useNavigationType();
|
|
34
|
-
const isBottomBarNavigation = navType === MenuTypes.bottomTabBar;
|
|
35
|
-
|
|
36
|
-
const minimisedMarginBottom =
|
|
37
|
-
isMenuVisible(currentRoute, screenData) && isBottomBarNavigation
|
|
38
|
-
? bottomTabBarHeight
|
|
39
|
-
: insets.bottom;
|
|
40
|
-
|
|
41
|
-
if (docked) {
|
|
42
|
-
return {
|
|
43
|
-
top: undefined,
|
|
44
|
-
height: minimisedHeight,
|
|
45
|
-
bottom: minimisedMarginBottom,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return { top: 0, height: undefined, bottom: 0 };
|
|
50
|
-
};
|