@applicaster/zapp-react-native-ui-components 13.0.0-alpha.9103242840 → 13.0.0-alpha.9112802542

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 (130) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  3. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  5. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  6. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  8. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  9. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  11. package/Components/BaseFocusable/index.ios.ts +1 -1
  12. package/Components/BaseFocusable/index.tsx +2 -3
  13. package/Components/Cell/Cell.tsx +7 -3
  14. package/Components/Cell/CellWithFocusable.tsx +43 -58
  15. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  16. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  17. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  18. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  19. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  20. package/Components/ErrorScreen/index.tsx +6 -6
  21. package/Components/Focusable/Focusable.tsx +1 -0
  22. package/Components/Focusable/Touchable.tsx +19 -20
  23. package/Components/Focusable/index.android.tsx +10 -3
  24. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -83
  25. package/Components/FocusableGroup/index.tsx +1 -3
  26. package/Components/FocusableScrollView/index.tsx +6 -3
  27. package/Components/Layout/TV/NavBarContainer.tsx +14 -19
  28. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  29. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  30. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  31. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +2 -1
  32. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +2 -1
  33. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  34. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  35. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  36. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -11
  37. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  38. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  39. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  40. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  41. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  42. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  43. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  44. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  45. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  46. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  47. package/Components/MasterCell/utils/behaviorProvider.ts +133 -0
  48. package/Components/MasterCell/utils/index.ts +4 -130
  49. package/Components/ModalComponent/Button/index.tsx +6 -6
  50. package/Components/ModalComponent/Header/index.tsx +3 -3
  51. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  52. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  53. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  54. package/Components/PlayerContainer/PlayerContainer.tsx +8 -8
  55. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  56. package/Components/PlayerImageBackground/index.tsx +23 -3
  57. package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
  58. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  59. package/Components/River/RiverFooter.tsx +39 -9
  60. package/Components/River/RiverItem.tsx +37 -2
  61. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
  62. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  63. package/Components/River/__tests__/componentsMap.test.js +17 -5
  64. package/Components/River/__tests__/river.test.js +75 -40
  65. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  66. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  67. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  68. package/Components/Screen/hooks.ts +56 -0
  69. package/Components/Screen/index.tsx +16 -42
  70. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  71. package/Components/Tabs/Tab.tsx +11 -9
  72. package/Components/TextInputTv/index.tsx +4 -3
  73. package/Components/TrackedView/index.tsx +1 -0
  74. package/Components/Transitioner/AnimationManager.js +15 -15
  75. package/Components/Transitioner/Scene.tsx +53 -24
  76. package/Components/Transitioner/Transitioner.tsx +3 -3
  77. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  78. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -49
  79. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  80. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  81. package/Components/Transitioner/index.js +8 -4
  82. package/Components/VideoLive/LiveImageManager.ts +27 -1
  83. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  84. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
  85. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -5
  86. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +11 -11
  87. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +14 -13
  88. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -3
  89. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  90. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  91. package/Components/VideoModal/PlayerDetails.tsx +9 -6
  92. package/Components/VideoModal/PlayerWrapper.tsx +17 -36
  93. package/Components/VideoModal/VideoModal.tsx +14 -23
  94. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
  95. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
  96. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  97. package/Components/VideoModal/hooks/index.ts +7 -0
  98. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  99. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  100. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  101. package/Components/VideoModal/utils.ts +1 -1
  102. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  103. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  104. package/Components/Viewport/__tests__/utils.test.js +5 -4
  105. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  106. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  107. package/Components/ZappUIComponent/index.tsx +3 -16
  108. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  109. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  110. package/Contexts/ComponentsMapOffsetContext/index.tsx +8 -5
  111. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  112. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  113. package/Contexts/ScreenContext/index.tsx +6 -12
  114. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  115. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  116. package/Decorators/Navigator/index.tsx +1 -1
  117. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  118. package/Decorators/RiverResolver/index.tsx +1 -1
  119. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  120. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  121. package/Decorators/ZappPipesDataConnector/index.tsx +4 -1
  122. package/package.json +7 -10
  123. package/tsconfig.json +2 -3
  124. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  125. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  126. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  127. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  128. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  129. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  130. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, Text } from "react-native";
3
- import { shallow } from "enzyme";
4
- import { shallowToJson } from "enzyme-to-json";
3
+ import { render } from "@testing-library/react-native";
4
+ import { AppContainer } from "../index";
5
5
 
6
6
  const styles = {
7
7
  iphone: {
@@ -15,11 +15,9 @@ jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
15
15
  })),
16
16
  }));
17
17
 
18
- const { AppContainer } = require("../index");
19
-
20
18
  describe("<AppContainer />", () => {
21
19
  it("renders correctly", () => {
22
- const wrapper = shallow(
20
+ const { toJSON } = render(
23
21
  <AppContainer styles={styles}>
24
22
  <View>
25
23
  <Text>I'm an app</Text>
@@ -27,6 +25,6 @@ describe("<AppContainer />", () => {
27
25
  </AppContainer>
28
26
  );
29
27
 
30
- expect(shallowToJson(wrapper)).toMatchSnapshot();
28
+ expect(toJSON()).toMatchSnapshot();
31
29
  });
32
30
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { Runtime } from "../Runtime";
6
5
 
@@ -18,14 +17,12 @@ const RuntimeProps = (isRTL) => ({
18
17
 
19
18
  describe("<Runtime />", () => {
20
19
  it("RTL renders correctly", () => {
21
- const wrapper = shallow(<Runtime {...RuntimeProps(true)} />);
22
-
23
- expect(shallowToJson(wrapper)).toMatchSnapshot();
20
+ const { toJSON } = render(<Runtime {...RuntimeProps(true)} />);
21
+ expect(toJSON()).toMatchSnapshot();
24
22
  });
25
23
 
26
24
  it("LTR renders correctly", () => {
27
- const wrapper = shallow(<Runtime {...RuntimeProps(false)} />);
28
-
29
- expect(shallowToJson(wrapper)).toMatchSnapshot();
25
+ const { toJSON } = render(<Runtime {...RuntimeProps(false)} />);
26
+ expect(toJSON()).toMatchSnapshot();
30
27
  });
31
28
  });
@@ -1,123 +1,66 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<AudioPlayer /> renders correctly 1`] = `
4
- <AudioPlayerLayout
5
- config={
4
+ <View
5
+ pointerEvents="none"
6
+ style={
6
7
  {
7
- "artworkAspectRatio": "1:1",
8
- "audioPlayerBackgroundImageQuery": "",
9
- "backgroundColor": "black",
10
- "backgroundImage": "https://example.com",
11
- "channelIcon": "https://example.com",
12
- "isRTL": true,
13
- "magicBackground": false,
14
- "runTimeFontFamily": undefined,
15
- "runTimeFontSize": undefined,
16
- "summaryColor": "white",
17
- "summaryFontFamily": undefined,
18
- "summaryFontSize": undefined,
19
- "titleColor": "white",
20
- "titleFontFamily": undefined,
21
- "titleFontSize": undefined,
8
+ "backgroundColor": "transparent",
9
+ "overflow": "hidden",
22
10
  }
23
11
  }
24
- style={{}}
25
12
  >
26
- <Channel
27
- config={
13
+ <View
14
+ collapsable={false}
15
+ style={
28
16
  {
29
- "artworkAspectRatio": "1:1",
30
- "audioPlayerBackgroundImageQuery": "",
31
- "backgroundColor": "black",
32
- "backgroundImage": "https://example.com",
33
- "channelIcon": "https://example.com",
34
- "isRTL": true,
35
- "magicBackground": false,
36
- "runTimeFontFamily": undefined,
37
- "runTimeFontSize": undefined,
38
- "summaryColor": "white",
39
- "summaryFontFamily": undefined,
40
- "summaryFontSize": undefined,
41
- "titleColor": "white",
42
- "titleFontFamily": undefined,
43
- "titleFontSize": undefined,
17
+ "backgroundColor": "transparent",
18
+ "opacity": 0,
19
+ "overflow": "hidden",
44
20
  }
45
21
  }
46
- srcImage="https://example.com"
47
- />
48
- <Title
49
- config={
50
- {
51
- "artworkAspectRatio": "1:1",
52
- "audioPlayerBackgroundImageQuery": "",
53
- "backgroundColor": "black",
54
- "backgroundImage": "https://example.com",
55
- "channelIcon": "https://example.com",
56
- "isRTL": true,
57
- "magicBackground": false,
58
- "runTimeFontFamily": undefined,
59
- "runTimeFontSize": undefined,
60
- "summaryColor": "white",
61
- "summaryFontFamily": undefined,
62
- "summaryFontSize": undefined,
63
- "titleColor": "white",
64
- "titleFontFamily": undefined,
65
- "titleFontSize": undefined,
66
- }
67
- }
68
- title="tittle"
69
- />
70
- <Summary
71
- config={
72
- {
73
- "artworkAspectRatio": "1:1",
74
- "audioPlayerBackgroundImageQuery": "",
75
- "backgroundColor": "black",
76
- "backgroundImage": "https://example.com",
77
- "channelIcon": "https://example.com",
78
- "isRTL": true,
79
- "magicBackground": false,
80
- "runTimeFontFamily": undefined,
81
- "runTimeFontSize": undefined,
82
- "summaryColor": "white",
83
- "summaryFontFamily": undefined,
84
- "summaryFontSize": undefined,
85
- "titleColor": "white",
86
- "titleFontFamily": undefined,
87
- "titleFontSize": undefined,
22
+ >
23
+ <View
24
+ accessibilityIgnoresInvertColors={true}
25
+ style={
26
+ {
27
+ "flex": 1,
28
+ }
88
29
  }
89
- }
90
- summary="Summary"
91
- />
92
- <Runtime
93
- audio_player_artwork_aspect_ratio="1:1"
94
- audio_player_background_color="black"
95
- audio_player_background_image="https://example.com"
96
- audio_player_channel_icon="https://example.com"
97
- audio_player_rtl={true}
98
- audio_player_summary_color="white"
99
- audio_player_title_color="white"
100
- config={
101
- {
102
- "artworkAspectRatio": "1:1",
103
- "audioPlayerBackgroundImageQuery": "",
104
- "backgroundColor": "black",
105
- "backgroundImage": "https://example.com",
106
- "channelIcon": "https://example.com",
107
- "isRTL": true,
108
- "magicBackground": false,
109
- "runTimeFontFamily": undefined,
110
- "runTimeFontSize": undefined,
111
- "summaryColor": "white",
112
- "summaryFontFamily": undefined,
113
- "summaryFontSize": undefined,
114
- "titleColor": "white",
115
- "titleFontFamily": undefined,
116
- "titleFontSize": undefined,
117
- }
118
- }
119
- end_time="11:11"
120
- start_time="10:10"
121
- />
122
- </AudioPlayerLayout>
30
+ >
31
+ <Image
32
+ resizeMode="cover"
33
+ source={
34
+ {
35
+ "uri": "https://example.com",
36
+ }
37
+ }
38
+ style={
39
+ [
40
+ {
41
+ "bottom": 0,
42
+ "left": 0,
43
+ "position": "absolute",
44
+ "right": 0,
45
+ "top": 0,
46
+ },
47
+ {
48
+ "height": undefined,
49
+ "width": undefined,
50
+ },
51
+ undefined,
52
+ ]
53
+ }
54
+ />
55
+ <View
56
+ style={
57
+ {
58
+ "backgroundColor": "transparent",
59
+ "overflow": "hidden",
60
+ }
61
+ }
62
+ />
63
+ </View>
64
+ </View>
65
+ </View>
123
66
  `;
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`<AudioPlayerLayout /> renders correctly 1`] = `
3
+ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
4
4
  <View
5
5
  pointerEvents="none"
6
6
  style={
@@ -10,32 +10,48 @@ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
10
10
  }
11
11
  }
12
12
  >
13
- <ForwardRef(AnimatedComponentWrapper)
13
+ <View
14
+ collapsable={false}
14
15
  style={
15
- [
16
- {
17
- "backgroundColor": "transparent",
18
- "overflow": "hidden",
19
- },
20
- {
21
- "opacity": 0,
22
- },
23
- ]
16
+ {
17
+ "backgroundColor": "transparent",
18
+ "opacity": 0,
19
+ "overflow": "hidden",
20
+ }
24
21
  }
25
22
  >
26
- <ImageBackground
27
- resizeMode="cover"
28
- source={
29
- {
30
- "uri": "https://example.com",
31
- }
32
- }
23
+ <View
24
+ accessibilityIgnoresInvertColors={true}
33
25
  style={
34
26
  {
35
27
  "flex": 1,
36
28
  }
37
29
  }
38
30
  >
31
+ <Image
32
+ resizeMode="cover"
33
+ source={
34
+ {
35
+ "uri": "https://example.com",
36
+ }
37
+ }
38
+ style={
39
+ [
40
+ {
41
+ "bottom": 0,
42
+ "left": 0,
43
+ "position": "absolute",
44
+ "right": 0,
45
+ "top": 0,
46
+ },
47
+ {
48
+ "height": undefined,
49
+ "width": undefined,
50
+ },
51
+ undefined,
52
+ ]
53
+ }
54
+ />
39
55
  <View
40
56
  style={
41
57
  {
@@ -44,7 +60,7 @@ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
44
60
  }
45
61
  }
46
62
  />
47
- </ImageBackground>
48
- </ForwardRef(AnimatedComponentWrapper)>
63
+ </View>
64
+ </View>
49
65
  </View>
50
66
  `;
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { Artwork } from "../Artwork";
6
5
 
@@ -16,9 +15,8 @@ const artWorkProps = {
16
15
  };
17
16
 
18
17
  describe("<Artwork />", () => {
19
- const wrapper = shallow(<Artwork {...artWorkProps} />);
20
-
21
18
  it("renders correctly", () => {
22
- expect(shallowToJson(wrapper)).toMatchSnapshot();
19
+ const { toJSON } = render(<Artwork {...artWorkProps} />);
20
+ expect(toJSON()).toMatchSnapshot();
23
21
  });
24
22
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { AudioPlayer } from "../AudioPlayer";
6
5
 
@@ -47,9 +46,8 @@ const audioPlayerProps = {
47
46
  };
48
47
 
49
48
  describe("<AudioPlayer />", () => {
50
- const wrapper = shallow(<AudioPlayer {...audioPlayerProps} />);
51
-
52
49
  it("renders correctly", () => {
53
- expect(shallowToJson(wrapper)).toMatchSnapshot();
50
+ const { toJSON } = render(<AudioPlayer {...audioPlayerProps} />);
51
+ expect(toJSON()).toMatchSnapshot();
54
52
  });
55
53
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { AudioPlayerLayout } from "../AudioPlayerLayout";
6
5
 
@@ -16,12 +15,12 @@ const audioPlayerLayoutProps = {
16
15
  children: [],
17
16
  };
18
17
 
19
- jest.useFakeTimers();
20
-
21
- describe("<AudioPlayerLayout />", () => {
22
- const wrapper = shallow(<AudioPlayerLayout {...audioPlayerLayoutProps} />);
23
-
18
+ describe("<AudioPlayerLayout />", () => {
24
19
  it("renders correctly", () => {
25
- expect(shallowToJson(wrapper)).toMatchSnapshot();
20
+ const { toJSON } = render(
21
+ <AudioPlayerLayout {...audioPlayerLayoutProps} />
22
+ );
23
+
24
+ expect(toJSON()).toMatchSnapshot();
26
25
  });
27
26
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { Channel } from "../Channel";
6
5
 
@@ -16,9 +15,8 @@ const channelProps = {
16
15
  };
17
16
 
18
17
  describe("<Channel />", () => {
19
- const wrapper = shallow(<Channel {...channelProps} />);
20
-
21
18
  it("renders correctly", () => {
22
- expect(shallowToJson(wrapper)).toMatchSnapshot();
19
+ const { toJSON } = render(<Channel {...channelProps} />);
20
+ expect(toJSON()).toMatchSnapshot();
23
21
  });
24
22
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { Summary } from "../Summary";
6
5
 
@@ -16,9 +15,8 @@ const summaryProps = {
16
15
  };
17
16
 
18
17
  describe("<Summary />", () => {
19
- const wrapper = shallow(<Summary {...summaryProps} />);
20
-
21
18
  it("renders correctly", () => {
22
- expect(shallowToJson(wrapper)).toMatchSnapshot();
19
+ const { toJSON } = render(<Summary {...summaryProps} />);
20
+ expect(toJSON()).toMatchSnapshot();
23
21
  });
24
22
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { render } from "@testing-library/react-native";
4
3
 
5
4
  import { Title } from "../Title";
6
5
 
@@ -16,9 +15,8 @@ const titleProps = {
16
15
  };
17
16
 
18
17
  describe("<Title />", () => {
19
- const wrapper = shallow(<Title {...titleProps} />);
20
-
21
18
  it("renders correctly", () => {
22
- expect(shallowToJson(wrapper)).toMatchSnapshot();
19
+ const { toJSON } = render(<Title {...titleProps} />);
20
+ expect(toJSON()).toMatchSnapshot();
23
21
  });
24
22
  });
@@ -25,7 +25,7 @@ type Props = {
25
25
  };
26
26
 
27
27
  export class BaseFocusable<
28
- T extends Props = Props
28
+ T extends Props = Props,
29
29
  > extends BaseFocusableInterface<T> {
30
30
  constructor(props) {
31
31
  super(props);
@@ -6,7 +6,6 @@ import {
6
6
  BoundingRect,
7
7
  } from "./BaseFocusable.interface";
8
8
 
9
- import { createReactRef } from "@applicaster/zapp-react-native-utils/reactUtils";
10
9
  import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
11
10
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
12
11
 
@@ -35,7 +34,7 @@ type Props = {
35
34
  };
36
35
 
37
36
  export class BaseFocusable<
38
- T extends Props = Props
37
+ T extends Props = Props,
39
38
  > extends BaseFocusableInterface<T> {
40
39
  constructor(props) {
41
40
  super(props);
@@ -45,7 +44,7 @@ export class BaseFocusable<
45
44
  focused: initialFocus || false,
46
45
  };
47
46
 
48
- this.ref = createReactRef();
47
+ this.ref = React.createRef();
49
48
  }
50
49
 
51
50
  componentDidMount() {
@@ -274,10 +274,14 @@ export class CellComponent extends React.Component<Props, State> {
274
274
  if (isFocused) {
275
275
  const accessibilityManager = AccessibilityManager.getInstance();
276
276
 
277
+ const accessibilityTitle =
278
+ item?.extensions?.accessibility?.label || item?.title || "";
279
+
280
+ const accessibilityHint =
281
+ item?.extensions?.accessibility?.hint || "";
282
+
277
283
  accessibilityManager.readText({
278
- text: String(
279
- item.extensions?.accessibility?.label || item.title
280
- ),
284
+ text: `${accessibilityTitle} ${accessibilityHint}`,
281
285
  });
282
286
  }
283
287
 
@@ -1,48 +1,10 @@
1
1
  import * as React from "react";
2
2
 
3
- import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
4
- import * as FOCUS_EVENTS from "@applicaster/zapp-react-native-utils/appUtils/focusManager/events";
5
3
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
6
4
  import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
7
5
 
8
- import { isAppleTV } from "../../Helpers/Platform";
9
6
  import { useCellState } from "../MasterCell/utils";
10
-
11
- const useCellFocusedState = (
12
- skipFocusManagerRegistration: boolean,
13
- groupId: string,
14
- id: string
15
- ) => {
16
- const [currentCellFocused, setCurrentCellFocused] = React.useState(false);
17
-
18
- React.useEffect(() => {
19
- const isGroupItemFocused = () => {
20
- if (!skipFocusManagerRegistration) {
21
- const isFocused = focusManager.isGroupItemFocused(groupId, id);
22
- setCurrentCellFocused(isFocused);
23
- }
24
- };
25
-
26
- const handler = () => {
27
- // tvOS hack for properly checking focus
28
- if (isAppleTV()) {
29
- setTimeout(() => {
30
- isGroupItemFocused();
31
- }, 0);
32
- } else {
33
- isGroupItemFocused();
34
- }
35
- };
36
-
37
- focusManager.on(FOCUS_EVENTS.FOCUS, handler);
38
-
39
- return () => {
40
- focusManager.removeHandler(FOCUS_EVENTS.FOCUS, handler);
41
- };
42
- }, [groupId, skipFocusManagerRegistration]);
43
-
44
- return currentCellFocused;
45
- };
7
+ import { FocusableGroup } from "../FocusableGroup";
46
8
 
47
9
  type Props = {
48
10
  item: ZappEntry;
@@ -75,11 +37,7 @@ export function CellWithFocusable(props: Props) {
75
37
  focused,
76
38
  } = props;
77
39
 
78
- const isFocused = useCellFocusedState(
79
- skipFocusManagerRegistration,
80
- groupId,
81
- id
82
- );
40
+ const [isFocused, setIsFocused] = React.useState(false);
83
41
 
84
42
  const state = useCellState({
85
43
  id: item.id,
@@ -96,26 +54,53 @@ export function CellWithFocusable(props: Props) {
96
54
  }
97
55
  }, [focusedButtonId]);
98
56
 
99
- const handleToggleFocus = (value) => {
100
- setFocusedButtonId(value.focusedButtonId);
57
+ const handleToggleFocus = React.useCallback(
58
+ (value) => {
59
+ setFocusedButtonId(value.focusedButtonId);
60
+
61
+ if (value.focusable) {
62
+ onFocus(value.focusable, value.mouse);
63
+ }
64
+ },
65
+ [onFocus]
66
+ );
67
+
68
+ const onGroupFocus = React.useCallback(() => {
69
+ if (!skipFocusManagerRegistration) {
70
+ setIsFocused(true);
71
+ }
72
+ }, [skipFocusManagerRegistration]);
101
73
 
102
- if (value.focusable) {
103
- onFocus(value.focusable, value.mouse);
74
+ const onGroupBlur = React.useCallback(() => {
75
+ if (!skipFocusManagerRegistration) {
76
+ setIsFocused(false);
104
77
  }
105
- };
78
+ }, [skipFocusManagerRegistration]);
106
79
 
107
80
  return (
108
- <CellRenderer
109
- item={item}
81
+ <FocusableGroup
82
+ id={`focusable-cell-wrapper-${id}`}
83
+ testID={"cell-with-focusable-cell-renderer-focusable-group"}
110
84
  groupId={groupId}
111
- onToggleFocus={handleToggleFocus}
112
- state={state}
113
- prefixId={id}
114
- focusedButtonId={focusedButtonId}
115
85
  preferredFocus={preferredFocus}
86
+ shouldUsePreferredFocus
87
+ onFocus={onGroupFocus}
88
+ onBlur={onGroupBlur}
116
89
  skipFocusManagerRegistration={skipFocusManagerRegistration}
117
- isFocusable={isFocusable}
118
- focused={focused}
119
- />
90
+ >
91
+ <CellRenderer
92
+ testID={"cell-with-focusable-cell-renderer"}
93
+ item={item}
94
+ groupId={`focusable-cell-wrapper-${id}`}
95
+ onToggleFocus={handleToggleFocus}
96
+ state={state}
97
+ prefixId={id}
98
+ focusedButtonId={focusedButtonId}
99
+ preferredFocus={true}
100
+ skipFocusManagerRegistration={skipFocusManagerRegistration}
101
+ isFocusable={isFocusable}
102
+ focused={focused}
103
+ />
104
+ </FocusableGroup>
120
105
  );
121
106
  }