@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7921075302 → 12.0.0-alpha.8024419438

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.
Files changed (58) hide show
  1. package/Components/BaseFocusable/index.tsx +1 -1
  2. package/Components/Cell/Cell.tsx +5 -5
  3. package/Components/Cell/CellWithFocusable.tsx +17 -5
  4. package/Components/FocusableGroup/index.tsx +1 -0
  5. package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
  6. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
  7. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
  8. package/Components/Layout/TV/__tests__/index.test.tsx +19 -75
  9. package/Components/Layout/TV/index.tsx +12 -11
  10. package/Components/Layout/TV/index.web.tsx +33 -0
  11. package/Components/Layout/index.tsx +15 -11
  12. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
  13. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +87 -112
  14. package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
  15. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  16. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  17. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
  18. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
  19. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +4 -1
  20. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -3
  21. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  22. package/Components/MasterCell/utils/index.ts +17 -30
  23. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  24. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  25. package/Components/Navigator/StackNavigator.tsx +48 -0
  26. package/Components/Navigator/index.ts +1 -0
  27. package/Components/PlayerContainer/PlayerContainer.tsx +9 -1
  28. package/Components/River/ComponentsMap/ComponentsMap.tsx +6 -0
  29. package/Components/River/RefreshControl.tsx +55 -1
  30. package/Components/River/TV/River.tsx +0 -23
  31. package/Components/RouteManager/index.tsx +2 -2
  32. package/Components/Screen/TV/hooks/index.ts +3 -0
  33. package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
  34. package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
  35. package/Components/Screen/TV/index.web.tsx +179 -0
  36. package/Components/Screen/__tests__/Screen.test.tsx +3 -0
  37. package/Components/Screen/index.tsx +29 -1
  38. package/Components/ScreenResolver/index.tsx +3 -1
  39. package/Components/Transitioner/Scene.tsx +24 -19
  40. package/Components/Transitioner/Transitioner.tsx +21 -28
  41. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
  42. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  43. package/Components/VideoLive/LiveImageManager.ts +18 -1
  44. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +48 -38
  45. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +40 -33
  46. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +94 -71
  47. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +15 -4
  48. package/Components/VideoModal/PlayerDetails.tsx +3 -3
  49. package/Components/VideoModal/PlayerWrapper.tsx +67 -60
  50. package/Components/VideoModal/VideoModal.tsx +17 -17
  51. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -0
  52. package/Components/VideoModal/utils.ts +5 -2
  53. package/Contexts/ScreenContext/index.tsx +2 -2
  54. package/Contexts/ScreenDataContext/index.tsx +20 -0
  55. package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
  56. package/events/index.ts +1 -0
  57. package/package.json +5 -5
  58. package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
@@ -14,12 +14,13 @@ import { PlayerDetails } from "./PlayerDetails";
14
14
  import { playerDimesionsHack } from "./utils";
15
15
  import { PathnameContext } from "../../Contexts/PathnameContext";
16
16
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
17
+ import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
17
18
 
18
19
  import {
19
- AnimationComponent,
20
- ComponentAnimationType,
21
20
  AnimatedScrollModal,
22
21
  AnimatedVideoPlayerComponent,
22
+ AnimationComponent,
23
+ ComponentAnimationType,
23
24
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
24
25
 
25
26
  type DimensionsT = {
@@ -180,65 +181,71 @@ export const PlayerWrapper = (props: Props) => {
180
181
  [containerDimensions, playerDimesionsHack]
181
182
  );
182
183
 
184
+ const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
185
+
183
186
  return (
184
- <WrapperView
185
- edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
186
- style={[
187
- safeAreaStyles(configuration, isTablet),
188
- style,
189
- playerDimesionsHack,
190
- ]}
191
- >
192
- <AnimationComponent
193
- animationType={ComponentAnimationType.moveUpComponent}
194
- additionalData={{ saveArea: true }}
195
- style={directionStyles(isTabletLandscape)}
196
- >
197
- <ScreenContextProvider pathname={"videoModal"}>
198
- <PathnameContext.Provider value={"videoModal"}>
199
- <View
200
- testID={`${entry?.id}-player-container`}
201
- style={[
202
- defaultStyles.playerContainer,
203
- containerDimensions,
204
- containerStyle,
205
- playerDimesionsHack,
206
- ]}
207
- >
208
- <AnimationComponent
209
- animationType={ComponentAnimationType.moveUpComponent}
210
- style={isTabletLandscape ? defaultStyles.flex : undefined}
211
- additionalData={{
212
- useLayoutMeasure: isTabletLandscape,
213
- disableAnimatedComponent: !isTabletLandscape,
214
- resetAnimationValue: isTabletLandscape && docked,
215
- }}
216
- >
217
- <AnimatedVideoPlayerComponent>
218
- {children(childrenStyles)}
219
- </AnimatedVideoPlayerComponent>
220
- </AnimationComponent>
221
- </View>
222
- <AnimatedScrollModal>
223
- {isInlineModal ? (
224
- <AnimationComponent
225
- animationType={ComponentAnimationType.componentFade}
226
- style={defaultStyles.flex}
187
+ <PathnameContext.Provider value={pathname}>
188
+ <ScreenContextProvider pathname={pathname}>
189
+ <WrapperView
190
+ edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
191
+ style={[
192
+ safeAreaStyles(configuration, isTablet),
193
+ style,
194
+ playerDimesionsHack,
195
+ ]}
196
+ >
197
+ <AnimationComponent
198
+ animationType={ComponentAnimationType.moveUpComponent}
199
+ additionalData={{ saveArea: true }}
200
+ style={directionStyles(isTabletLandscape)}
201
+ >
202
+ <PathnameContext.Provider value={pathname}>
203
+ <ScreenContextProvider pathname={pathname}>
204
+ <View
205
+ testID={`${entry?.id}-player-container`}
206
+ style={[
207
+ defaultStyles.playerContainer,
208
+ containerDimensions,
209
+ containerStyle,
210
+ playerDimesionsHack,
211
+ ]}
227
212
  >
228
- <PlayerDetails
229
- configuration={configuration}
230
- style={defaultStyles.playerDetails}
231
- entry={entry}
232
- isTabletLandscape={isTabletLandscape}
233
- />
234
- </AnimationComponent>
235
- ) : (
236
- <View style={defaultStyles.playerDetails} />
237
- )}
238
- </AnimatedScrollModal>
239
- </PathnameContext.Provider>
240
- </ScreenContextProvider>
241
- </AnimationComponent>
242
- </WrapperView>
213
+ <AnimationComponent
214
+ animationType={ComponentAnimationType.moveUpComponent}
215
+ style={isTabletLandscape ? defaultStyles.flex : undefined}
216
+ additionalData={{
217
+ useLayoutMeasure: isTabletLandscape,
218
+ disableAnimatedComponent: !isTabletLandscape,
219
+ resetAnimationValue: isTabletLandscape && docked,
220
+ }}
221
+ >
222
+ <AnimatedVideoPlayerComponent>
223
+ {children(childrenStyles)}
224
+ </AnimatedVideoPlayerComponent>
225
+ </AnimationComponent>
226
+ </View>
227
+ <AnimatedScrollModal>
228
+ {isInlineModal ? (
229
+ <AnimationComponent
230
+ animationType={ComponentAnimationType.componentFade}
231
+ style={defaultStyles.flex}
232
+ >
233
+ <PlayerDetails
234
+ configuration={configuration}
235
+ style={defaultStyles.playerDetails}
236
+ entry={entry}
237
+ isTabletLandscape={isTabletLandscape}
238
+ />
239
+ </AnimationComponent>
240
+ ) : (
241
+ <View style={defaultStyles.playerDetails} />
242
+ )}
243
+ </AnimatedScrollModal>
244
+ </ScreenContextProvider>
245
+ </PathnameContext.Provider>
246
+ </AnimationComponent>
247
+ </WrapperView>
248
+ </ScreenContextProvider>
249
+ </PathnameContext.Provider>
243
250
  );
244
251
  };
@@ -129,17 +129,17 @@ const VideoModalComponent = () => {
129
129
  const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
130
130
 
131
131
  return (
132
- <AnimatedPlayerModalWrapper
133
- style={[
134
- styles.container,
135
- {
136
- backgroundColor,
137
- },
138
- ]}
139
- >
132
+ <PathnameContext.Provider value={pathname}>
140
133
  <ScreenContextProvider pathname={pathname}>
141
- <PathnameContext.Provider value={pathname}>
142
- {itemIdHooksFinished === item?.id ? (
134
+ {itemIdHooksFinished === item?.id ? (
135
+ <AnimatedPlayerModalWrapper
136
+ style={[
137
+ styles.container,
138
+ {
139
+ backgroundColor,
140
+ },
141
+ ]}
142
+ >
143
143
  <HandlePlayable
144
144
  item={item}
145
145
  isModal={mode !== "PIP"}
@@ -147,14 +147,14 @@ const VideoModalComponent = () => {
147
147
  modalWidth={modalSize.width}
148
148
  mode={mode}
149
149
  />
150
- ) : (
151
- <View style={styles.loaderContainer}>
152
- <Spinner />
153
- </View>
154
- )}
155
- </PathnameContext.Provider>
150
+ </AnimatedPlayerModalWrapper>
151
+ ) : (
152
+ <View style={styles.loaderContainer}>
153
+ <Spinner />
154
+ </View>
155
+ )}
156
156
  </ScreenContextProvider>
157
- </AnimatedPlayerModalWrapper>
157
+ </PathnameContext.Provider>
158
158
  );
159
159
  };
160
160
 
@@ -25,6 +25,13 @@ jest.mock("react-native-gesture-handler");
25
25
 
26
26
  jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
27
27
 
28
+ jest.mock(
29
+ "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
30
+ () => ({
31
+ useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
32
+ })
33
+ );
34
+
28
35
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
29
36
  useIsTablet,
30
37
  }));
@@ -33,8 +33,11 @@ export const useConfiguration = () => {
33
33
  ...pluginConfiguration,
34
34
  });
35
35
 
36
- const { minimised_height, minimised_height_tablet, modal_background_color } =
37
- config;
36
+ const {
37
+ minimised_height = 0,
38
+ minimised_height_tablet = 0,
39
+ modal_background_color,
40
+ } = config;
38
41
 
39
42
  const minimisedHeight = useIsTablet()
40
43
  ? minimised_height_tablet
@@ -26,7 +26,7 @@ interface NavBarStoreState {
26
26
  setSummary: (subtitle: string) => void;
27
27
  height: number;
28
28
  scrollState: number;
29
- isOnBottomNavBar: boolean;
29
+ contentPosition: string;
30
30
  scrollYAnimated: Animated.Value;
31
31
  }
32
32
 
@@ -52,7 +52,7 @@ const createStore = () =>
52
52
  visible: true,
53
53
  height: 0,
54
54
  scrollState: 0,
55
- isOnBottomNavBar: true,
55
+ contentPosition: "",
56
56
  scrollYAnimated: new Animated.Value(0),
57
57
  setTitle(title) {
58
58
  set({ title });
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
3
+
4
+ export const ScreenDataContext = React.createContext<any>(null);
5
+
6
+ // Use this only to provide initial screenData context, before the Transitioner and Screen is rendered.
7
+ export const withScreenDataContextProvider = (Component: any) => {
8
+ return function ScreenDataContextProvider(props: any) {
9
+ const { activeRiver } = useNavigation();
10
+
11
+ // use only initial activeRiver as this context should only be used for "Home", initial route
12
+ const screenData = React.useMemo(() => ({ screen: activeRiver }), []);
13
+
14
+ return (
15
+ <ScreenDataContext.Provider value={screenData}>
16
+ <Component {...props} />
17
+ </ScreenDataContext.Provider>
18
+ );
19
+ };
20
+ };
@@ -63,7 +63,7 @@ function prepareContext(
63
63
  const parent = findParent(currentContext, route, getChildren);
64
64
 
65
65
  const newEntry = {
66
- route: route,
66
+ route,
67
67
  id: uuid(),
68
68
  data: newContext,
69
69
  } as SingleEntry;
package/events/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export enum QBUIComponentEvents {
2
2
  toggleGradient = "toggleGradient",
3
3
  topMenuBarTV_onFocus = "topMenuBarTV_onFocus",
4
+ navigatorReplaceItem = "navigatorReplaceItem",
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-alpha.7921075302",
3
+ "version": "12.0.0-alpha.8024419438",
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",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.0-alpha.7921075302",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7921075302",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7921075302",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7921075302",
37
+ "@applicaster/applicaster-types": "12.0.0-alpha.8024419438",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.8024419438",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.8024419438",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.8024419438",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",
@@ -1,64 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
4
- import { ifEmptyUseFallback } from "@applicaster/zapp-react-native-utils/cellUtils";
5
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
- import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
7
- import { Spinner } from "@applicaster/zapp-react-native-ui-components/Components/Spinner";
8
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
9
-
10
- import { useScreenConfiguration } from "../../River/useScreenConfiguration";
11
-
12
- const styles = StyleSheet.create({
13
- container: {
14
- position: "absolute",
15
- top: 0,
16
- left: 0,
17
- right: 0,
18
- bottom: 0,
19
-
20
- alignItems: "center",
21
- justifyContent: "center",
22
- },
23
- });
24
-
25
- export const TransitionOverlay = () => {
26
- const screen = useCurrentScreenData();
27
-
28
- const { backgroundColor: screenBackgroundColor } = useScreenConfiguration(
29
- screen?.id
30
- );
31
-
32
- const theme = useTheme();
33
-
34
- const themeBackgroundColor = React.useMemo(
35
- () => theme.app_background_color,
36
- [theme.app_background_color]
37
- );
38
-
39
- const backgroundColor = ifEmptyUseFallback(
40
- screenBackgroundColor,
41
- themeBackgroundColor
42
- );
43
-
44
- const {
45
- appState: { isTransitioning },
46
- } = usePickFromState(["appState"]);
47
-
48
- if (!isWeb() || !isTransitioning) {
49
- return null;
50
- }
51
-
52
- return (
53
- <View
54
- style={[
55
- styles.container,
56
- {
57
- backgroundColor,
58
- },
59
- ]}
60
- >
61
- <Spinner size={"large"} />
62
- </View>
63
- );
64
- };