@applicaster/zapp-react-native-ui-components 14.0.0-alpha.4385101226 → 14.0.0-alpha.4520122433

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 (69) hide show
  1. package/Components/BaseFocusable/index.tsx +23 -12
  2. package/Components/Cell/Cell.tsx +91 -64
  3. package/Components/Cell/CellWithFocusable.tsx +3 -0
  4. package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
  5. package/Components/FeedLoader/FeedLoader.tsx +7 -16
  6. package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
  7. package/Components/FeedLoader/index.js +2 -8
  8. package/Components/Focusable/Focusable.tsx +10 -3
  9. package/Components/Focusable/FocusableTvOS.tsx +2 -2
  10. package/Components/Focusable/Touchable.tsx +5 -3
  11. package/Components/Focusable/index.android.tsx +8 -4
  12. package/Components/FocusableGroup/FocusableTvOS.tsx +1 -1
  13. package/Components/FocusableList/FocusableItem.tsx +4 -3
  14. package/Components/FocusableList/FocusableListItemWrapper.tsx +2 -1
  15. package/Components/FocusableList/hooks/useCellState.android.ts +13 -3
  16. package/Components/FocusableList/index.tsx +16 -9
  17. package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
  18. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -6
  19. package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
  20. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +6 -2
  21. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +0 -12
  22. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +65 -17
  23. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +21 -3
  24. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +6 -3
  25. package/Components/MasterCell/DefaultComponents/Text/index.tsx +26 -6
  26. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
  27. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
  28. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
  29. package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
  30. package/Components/MasterCell/utils/index.ts +11 -5
  31. package/Components/OfflineHandler/__tests__/index.test.tsx +6 -13
  32. package/Components/PlayerContainer/PlayerContainer.tsx +4 -1
  33. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +0 -1
  34. package/Components/River/RefreshControl.tsx +11 -19
  35. package/Components/River/__tests__/river.test.js +12 -26
  36. package/Components/Screen/__tests__/Screen.test.tsx +5 -17
  37. package/Components/Screen/__tests__/navigationHandler.test.ts +133 -22
  38. package/Components/Screen/navigationHandler.ts +20 -2
  39. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +2 -2
  40. package/Components/Tabs/TV/Tabs.android.tsx +1 -1
  41. package/Components/Tabs/Tabs.tsx +2 -3
  42. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
  43. package/Components/TextInputTv/index.tsx +11 -0
  44. package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
  45. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +3 -9
  46. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +294 -0
  47. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +93 -0
  48. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +42 -22
  49. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
  50. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +9 -1
  51. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +40 -15
  52. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +2 -2
  53. package/Components/VideoModal/hooks/utils/index.ts +4 -0
  54. package/Contexts/CellFocusedStateContext/index.tsx +27 -0
  55. package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
  56. package/Contexts/ScreenContext/index.tsx +46 -6
  57. package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
  58. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
  59. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
  60. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
  61. package/Decorators/RiverFeedLoader/index.tsx +22 -4
  62. package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
  63. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +27 -27
  64. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +35 -10
  65. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
  66. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +157 -0
  67. package/events/index.ts +3 -0
  68. package/package.json +5 -5
  69. package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
@@ -3,61 +3,172 @@ import { isMenuVisible } from "../navigationHandler";
3
3
  describe("NavigationHandler", () => {
4
4
  describe("isMenuVisible", () => {
5
5
  it("returns false when the route is a player route", () => {
6
- const menuVisible = isMenuVisible("/playable/some_vod_item", {});
6
+ const menuVisible = isMenuVisible("/playable/some_vod_item", {}, [
7
+ {
8
+ identifier: "quick-brick-bottom-tabs",
9
+ category: "menu",
10
+ name: "Bottom Tabs",
11
+ },
12
+ ]);
13
+
7
14
  expect(menuVisible).toBe(false);
8
15
  });
9
16
 
10
17
  describe("when screen is a hook", () => {
11
18
  it("returns true if the `showNavBar` flag is set to true", () => {
12
- const menuVisible = isMenuVisible("", {
13
- hookPlugin: {
14
- module: {
15
- showNavBar: true,
19
+ const menuVisible = isMenuVisible(
20
+ "",
21
+ {
22
+ hookPlugin: {
23
+ module: {
24
+ showNavBar: true,
25
+ },
16
26
  },
27
+ navigations: [
28
+ {
29
+ navigation_type: "quick-brick-bottom-tabs",
30
+ identifier: "quick-brick-bottom-tabs",
31
+ category: "menu",
32
+ name: "Bottom Tabs",
33
+ },
34
+ ],
17
35
  },
18
- });
36
+ [
37
+ {
38
+ identifier: "quick-brick-bottom-tabs",
39
+ category: "menu",
40
+ name: "Bottom Tabs",
41
+ },
42
+ ]
43
+ );
19
44
 
20
45
  expect(menuVisible).toBe(true);
21
46
  });
22
47
 
23
48
  it("returns true if presentFullScreen flag is set to false", () => {
24
- const menuVisible = isMenuVisible("", {
25
- hookPlugin: {
26
- module: {
27
- presentFullScreen: false,
49
+ const menuVisible = isMenuVisible(
50
+ "",
51
+ {
52
+ hookPlugin: {
53
+ module: {
54
+ presentFullScreen: false,
55
+ },
28
56
  },
57
+ navigations: [
58
+ {
59
+ navigation_type: "quick-brick-bottom-tabs",
60
+ identifier: "quick-brick-bottom-tabs",
61
+ category: "menu",
62
+ name: "Bottom Tabs",
63
+ },
64
+ ],
29
65
  },
30
- });
66
+ [
67
+ {
68
+ identifier: "quick-brick-bottom-tabs",
69
+ category: "menu",
70
+ name: "Bottom Tabs",
71
+ },
72
+ ]
73
+ );
31
74
 
32
75
  expect(menuVisible).toBe(true);
33
76
  });
34
77
 
35
78
  it("returns false if presentFullScreen flag is set to true", () => {
36
- const menuVisible = isMenuVisible("", {
37
- hookPlugin: {
38
- module: {
39
- presentFullScreen: true,
79
+ const menuVisible = isMenuVisible(
80
+ "",
81
+ {
82
+ hookPlugin: {
83
+ module: {
84
+ presentFullScreen: true,
85
+ },
40
86
  },
87
+ navigations: [
88
+ {
89
+ navigation_type: "quick-brick-bottom-tabs",
90
+ identifier: "quick-brick-bottom-tabs",
91
+ category: "menu",
92
+ name: "Bottom Tabs",
93
+ },
94
+ ],
41
95
  },
42
- });
96
+ [
97
+ {
98
+ identifier: "quick-brick-bottom-tabs",
99
+ category: "menu",
100
+ name: "Bottom Tabs",
101
+ },
102
+ ]
103
+ );
43
104
 
44
105
  expect(menuVisible).toBe(false);
45
106
  });
46
107
  });
47
108
 
48
109
  it("returns false if the screen's general settings allow screen presentation", () => {
49
- const menuVisible = isMenuVisible("", {
50
- general: {
51
- allow_screen_plugin_presentation: true,
110
+ const menuVisible = isMenuVisible(
111
+ "",
112
+ {
113
+ general: {
114
+ allow_screen_plugin_presentation: true,
115
+ },
116
+ navigations: [
117
+ {
118
+ navigation_type: "quick-brick-bottom-tabs",
119
+ identifier: "quick-brick-bottom-tabs",
120
+ category: "menu",
121
+ name: "Bottom Tabs",
122
+ },
123
+ ],
52
124
  },
53
- });
125
+ [
126
+ {
127
+ identifier: "quick-brick-bottom-tabs",
128
+ category: "menu",
129
+ name: "Bottom Tabs",
130
+ },
131
+ ]
132
+ );
54
133
 
55
134
  expect(menuVisible).toBe(false);
56
135
  });
57
136
 
58
- it("returns true otherwise", () => {
59
- const menuVisible = isMenuVisible("", {});
137
+ it("returns false otherwise", () => {
138
+ const menuVisible = isMenuVisible(
139
+ "any",
140
+ {
141
+ navigations: [
142
+ {
143
+ navigation_type: "quick-brick-bottom-tabs",
144
+ identifier: "quick-brick-bottom-tabs",
145
+ category: "menu",
146
+ name: "Bottom Tabs",
147
+ },
148
+ ],
149
+ },
150
+ [
151
+ {
152
+ identifier: "quick-brick-bottom-tabs",
153
+ category: "menu",
154
+ name: "Bottom Tabs",
155
+ },
156
+ ]
157
+ );
158
+
60
159
  expect(menuVisible).toBe(true);
61
160
  });
161
+
162
+ it("returns false otherwise", () => {
163
+ const menuVisible = isMenuVisible("", {}, [
164
+ {
165
+ identifier: "quick-brick-bottom-tabs",
166
+ category: "menu",
167
+ name: "Bottom Tabs",
168
+ },
169
+ ]);
170
+
171
+ expect(menuVisible).toBe(false);
172
+ });
62
173
  });
63
174
  });
@@ -1,3 +1,5 @@
1
+ import { resolveNavigationPlugin } from "@applicaster/zapp-react-native-utils/navigationUtils";
2
+
1
3
  /**
2
4
  * This function helps to decide wether the menu should be presented on the screen
3
5
  * based on route and / or screen Data
@@ -14,12 +16,28 @@
14
16
  * @param {Object} screenData payload associated with the currently presented screen
15
17
  * @returns {Boolean}
16
18
  */
17
- export function isMenuVisible(route, screenData) {
19
+ export function isMenuVisible(route, screenData, plugins) {
20
+ const plugin = resolveNavigationPlugin({
21
+ category: "menu",
22
+ navigations:
23
+ screenData?.navigations || screenData?.targetScreen?.navigations,
24
+ plugins,
25
+ });
26
+
27
+ const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
28
+
29
+ if (!isBottomTabsPlugin) {
30
+ return false;
31
+ }
32
+
18
33
  if (route.includes("playable")) {
19
34
  return false;
20
35
  }
21
36
 
22
- if (screenData.type === "qb_search_screen") {
37
+ if (
38
+ screenData.type === "qb_search_screen" ||
39
+ screenData?.targetScreen?.type === "qb_search_screen"
40
+ ) {
23
41
  return false;
24
42
  }
25
43
 
@@ -19,9 +19,9 @@ describe("ScreenRevealManager", () => {
19
19
 
20
20
  const manager = new ScreenRevealManager(componentsToRender, mockCallback);
21
21
 
22
- expect(manager["numberOfComponentsWaitToLoadBeforePresent"]).toBe(3);
22
+ expect(manager.numberOfComponentsWaitToLoadBeforePresent).toBe(3);
23
23
 
24
- expect(manager["renderingState"]).toEqual([
24
+ expect(manager.renderingState).toEqual([
25
25
  COMPONENT_LOADING_STATE.UNKNOWN,
26
26
  COMPONENT_LOADING_STATE.UNKNOWN,
27
27
  COMPONENT_LOADING_STATE.UNKNOWN,
@@ -62,7 +62,7 @@ const TabsComponent = ({
62
62
  );
63
63
 
64
64
  const renderItem = useCallback(
65
- ({ item, index, focused }) => {
65
+ ({ item, index, focused }: { item: any; index: any; focused?: any }) => {
66
66
  const itemId = generateFocusableId(getId(item));
67
67
 
68
68
  const isSelected = R.equals(index, selectedEntryIndex);
@@ -158,12 +158,11 @@ const TabsComponent = ({
158
158
 
159
159
  const renderItem = React.useCallback(
160
160
  ({ item, index, item: { id } }: RenderItemProps) => (
161
- <>
161
+ <React.Fragment key={id}>
162
162
  <Tab
163
163
  ref={(ref) => {
164
164
  tabRefs.current[index] = ref;
165
165
  }}
166
- key={id}
167
166
  {...{
168
167
  title: getTitle(item),
169
168
  id,
@@ -177,7 +176,7 @@ const TabsComponent = ({
177
176
  {display_mode === "fractional" &&
178
177
  index !== tabs?.length - 1 &&
179
178
  renderGutter()}
180
- </>
179
+ </React.Fragment>
181
180
  ),
182
181
  [tabs, display_mode, configuration, onTabPress, getTitle, getSelectedItem]
183
182
  );
@@ -2,6 +2,19 @@
2
2
 
3
3
  exports[`<TextInputTv /> renders 1`] = `
4
4
  <input
5
+ accessibilityProps={
6
+ {
7
+ "accessibilityHint": "Enter text into Search",
8
+ "accessibilityLabel": "Search",
9
+ "accessibilityRole": "searchbox",
10
+ "accessible": true,
11
+ "aria-description": "Enter text into Search",
12
+ "aria-label": "Search",
13
+ "aria-role": "searchbox",
14
+ "role": "searchbox",
15
+ "tabindex": 0,
16
+ }
17
+ }
5
18
  testID="TextInput-tv"
6
19
  />
7
20
  `;
@@ -4,6 +4,7 @@ import { Appearance, Platform, StyleSheet, TextInput } from "react-native";
4
4
  import { isFunction } from "@applicaster/zapp-react-native-utils/functionUtils";
5
5
  import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
6
6
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
7
+ import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
7
8
 
8
9
  type Props = Partial<{
9
10
  style: any;
@@ -42,6 +43,8 @@ function TextInputTV(props: Props, ref) {
42
43
  const [colorScheme, setColorScheme] = useState(getInitialColorScheme());
43
44
  const isRTL = useIsRTL();
44
45
 
46
+ const accessibilityManager = useAccessibilityManager({});
47
+
45
48
  const onColorChange = useCallback(
46
49
  ({ colorScheme: color }) => {
47
50
  if (color !== colorScheme) {
@@ -153,6 +156,13 @@ function TextInputTV(props: Props, ref) {
153
156
  ])
154
157
  )(props);
155
158
 
159
+ const getAccessibilityProps = () => {
160
+ return {
161
+ accessibilityProps:
162
+ accessibilityManager.getInputAccessibilityProps("Search"),
163
+ };
164
+ };
165
+
156
166
  const inputProps = {
157
167
  ...getProps(),
158
168
  ...getStyle(),
@@ -161,6 +171,7 @@ function TextInputTV(props: Props, ref) {
161
171
  ...getSecureTextEntry(),
162
172
  ...getOnEndEditing(),
163
173
  ...getOnPress(),
174
+ ...getAccessibilityProps(),
164
175
  };
165
176
 
166
177
  if (
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { View, TouchableOpacity } from "react-native";
3
- import { create, act } from "react-test-renderer";
3
+ import { render } from "@testing-library/react-native";
4
4
 
5
5
  import { Touchable } from "..";
6
6
 
@@ -23,38 +23,31 @@ describe("<Touchable />", () => {
23
23
  });
24
24
 
25
25
  it("has accessible flag set to false", () => {
26
- let wrapper;
26
+ const { toJSON, UNSAFE_getByType } = render(<Touchable {...props} />);
27
27
 
28
- act(() => {
29
- wrapper = create(<Touchable {...props} />);
30
- });
31
-
32
- const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
33
- expect(wrapper.toJSON()).toMatchSnapshot();
28
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
29
+ expect(toJSON()).toMatchSnapshot();
34
30
  expect(touchableWrapper.props).toHaveProperty("accessible", false);
35
31
  });
36
32
  });
37
33
 
38
34
  describe("when not running in automated tests environment", () => {
39
- let wrapper;
40
-
41
- act(() => {
42
- wrapper = create(<Touchable {...props} />);
43
- });
44
-
45
- const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
46
-
47
35
  beforeEach(props.onPress.mockClear);
48
36
 
49
37
  it("renders correctly", () => {
50
- expect(wrapper.toJSON()).toMatchSnapshot();
38
+ const { toJSON } = render(<Touchable {...props} />);
39
+ expect(toJSON()).toMatchSnapshot();
51
40
  });
52
41
 
53
42
  it("has accessible flag set to true", () => {
43
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
44
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
54
45
  expect(touchableWrapper.props).toHaveProperty("accessible", true);
55
46
  });
56
47
 
57
48
  it("assigns testID and accessibilityLabel props correctly", () => {
49
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
50
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
58
51
  expect(touchableWrapper.props).toHaveProperty("testID", props.testID);
59
52
 
60
53
  expect(touchableWrapper.props).toHaveProperty(
@@ -64,6 +57,8 @@ describe("<Touchable />", () => {
64
57
  });
65
58
 
66
59
  it("calls the onPress event when it is pressed", () => {
60
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
61
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
67
62
  touchableWrapper.props.onPress();
68
63
  expect(props.onPress).toHaveBeenCalledTimes(1);
69
64
  });
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
- import { Animated, Platform, StyleSheet, View } from "react-native";
2
+ import { Animated, StyleSheet, View } from "react-native";
3
3
 
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import {
6
- GestureHandlerRootView,
7
6
  NativeViewGestureHandler,
8
7
  PanGestureHandler,
9
8
  State,
@@ -357,15 +356,10 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
357
356
  };
358
357
  }, [playerAnimationState, isAudioItem, isMinimizedModal]);
359
358
 
360
- const Wrapper = React.useMemo(
361
- () => (Platform.OS === "android" ? GestureHandlerRootView : View),
362
- []
363
- );
364
-
365
359
  const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
366
360
 
367
361
  return (
368
- <Wrapper style={generalStyles.container}>
362
+ <View style={generalStyles.container}>
369
363
  <TapGestureHandler
370
364
  maxDurationMs={100000}
371
365
  ref={tapHandlerRef}
@@ -405,7 +399,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
405
399
  </PanGestureHandler>
406
400
  </View>
407
401
  </TapGestureHandler>
408
- </Wrapper>
402
+ </View>
409
403
  );
410
404
  };
411
405