@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5033140607 → 13.0.0-alpha.5330008750

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 (113) hide show
  1. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  2. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  3. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +6 -6
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +7 -7
  6. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  7. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  8. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  9. package/Components/BaseFocusable/index.ios.ts +1 -1
  10. package/Components/BaseFocusable/index.tsx +66 -29
  11. package/Components/Cell/Cell.tsx +14 -9
  12. package/Components/Cell/CellWithFocusable.tsx +1 -1
  13. package/Components/Cell/TvOSCellComponent.tsx +3 -8
  14. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +20 -20
  15. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +5 -3
  16. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +5 -5
  17. package/Components/ComponentResolver/__tests__/componentResolver.test.js +11 -9
  18. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  19. package/Components/Focusable/Focusable.tsx +0 -54
  20. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  21. package/Components/Focusable/Touchable.tsx +19 -20
  22. package/Components/FocusableList/index.tsx +0 -1
  23. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
  24. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
  25. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
  26. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  27. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
  28. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
  29. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  30. package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
  31. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  32. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  33. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
  34. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  35. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  36. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  37. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  38. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  39. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  40. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
  41. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -34
  42. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  43. package/Components/MasterCell/utils/index.ts +1 -1
  44. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  45. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  46. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  47. package/Components/PlayerContainer/PlayerContainer.tsx +5 -11
  48. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  49. package/Components/River/RefreshControl.tsx +1 -1
  50. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +17 -17
  51. package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
  52. package/Components/River/__tests__/componentsMap.test.js +61 -13
  53. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
  54. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
  55. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  56. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  57. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
  58. package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
  59. package/Components/Tabs/Tab.tsx +7 -6
  60. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  61. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  62. package/Components/TextInputTv/index.tsx +4 -4
  63. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  64. package/Components/Transitioner/AnimationManager.js +8 -8
  65. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  66. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -9
  67. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  68. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  69. package/Components/VideoLive/LiveImageManager.ts +27 -1
  70. package/Components/VideoLive/PlayerLiveImageComponent.tsx +18 -16
  71. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  72. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -10
  73. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +5 -1
  74. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  75. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +8 -7
  76. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
  77. package/Components/VideoModal/ModalAnimation/index.ts +2 -1
  78. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  79. package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
  80. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  81. package/Components/VideoModal/PlayerWrapper.tsx +16 -35
  82. package/Components/VideoModal/VideoModal.tsx +14 -23
  83. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  84. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  85. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  86. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  87. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  88. package/Components/VideoModal/hooks/index.ts +7 -0
  89. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  90. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  91. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  92. package/Components/VideoModal/utils.ts +3 -5
  93. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
  94. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  95. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
  96. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -30
  97. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  98. package/Contexts/ScreenContext/index.tsx +3 -2
  99. package/Decorators/Analytics/{index.js → index.tsx} +11 -11
  100. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
  101. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  102. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  103. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  104. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  105. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  106. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  107. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  108. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +5 -5
  109. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
  110. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  111. package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
  112. package/package.json +12 -6
  113. package/Decorators/RiverFeedLoader/utils.ts +0 -100
@@ -1,18 +1,13 @@
1
1
  import React from "react";
2
- import TestRenderer from "react-test-renderer";
3
-
4
- jest.mock("react-native", () => {
5
- const RNMock = jest.genMockFromModule("react-native");
6
- const { TextInput } = jest.requireActual("react-native");
7
-
8
- return {
9
- ...RNMock,
10
- TextInput,
11
- Platform: {
12
- OS: "samsung_tv",
13
- isTV: true,
14
- },
15
- };
2
+ import { Platform } from "react-native";
3
+ import { render } from "@testing-library/react-native";
4
+
5
+ Platform.OS = "samsung_tv";
6
+
7
+ Object.defineProperty(Platform, "isTV", {
8
+ get() {
9
+ return true;
10
+ },
16
11
  });
17
12
 
18
13
  jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
@@ -20,12 +15,12 @@ jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
20
15
  }));
21
16
 
22
17
  const { TextInputTv } = require("../");
23
- const { Platform, TextInput } = require("react-native");
18
+ const testIDToTest = "TextInput-tv";
24
19
 
25
20
  describe("<TextInputTv />", () => {
26
21
  it("renders", () => {
27
- const testInstance = TestRenderer.create(<TextInputTv />);
28
- expect(testInstance.toJSON).toBeTruthy();
22
+ const { toJSON } = render(<TextInputTv />);
23
+ expect(toJSON()).toMatchSnapshot();
29
24
  });
30
25
 
31
26
  describe("on native", () => {
@@ -34,8 +29,8 @@ describe("<TextInputTv />", () => {
34
29
  });
35
30
 
36
31
  it("returns React-Native TextInput component if not on samsung", () => {
37
- const testInstance = TestRenderer.create(<TextInputTv />);
38
- expect(testInstance.root.findByType(TextInput)).toBeTruthy();
32
+ const { getByTestId } = render(<TextInputTv />);
33
+ expect(getByTestId(testIDToTest)).toBeTruthy();
39
34
  });
40
35
  });
41
36
 
@@ -45,29 +40,30 @@ describe("<TextInputTv />", () => {
45
40
  });
46
41
 
47
42
  it("returns React input component if on samsung", () => {
48
- const testInstance = TestRenderer.create(<TextInputTv type="samsung" />);
49
- expect(testInstance.root.findByType("input")).toBeTruthy();
43
+ const { getByTestId } = render(<TextInputTv type="samsung" />);
44
+ expect(getByTestId(testIDToTest)).toBeTruthy();
50
45
  });
51
46
 
52
47
  it("flattens styles", () => {
53
48
  Platform.OS = "samsung_tv";
54
49
  const style = [{ width: 200 }, { height: 200 }];
55
- const testInstance = TestRenderer.create(<TextInputTv style={style} />);
56
50
 
57
- expect(typeof testInstance.root.findByType("input").props.style).toBe(
58
- "object"
51
+ const { getByTestId } = render(
52
+ <TextInputTv type="samsung" style={style} />
59
53
  );
54
+
55
+ expect(getByTestId(testIDToTest).props.style).toBeObject();
60
56
  });
61
57
 
62
58
  it("maps onChangeText to onChange", () => {
63
59
  Platform.OS = "samsung_tv";
64
60
  const onChangeText = jest.fn();
65
61
 
66
- const testInstance = TestRenderer.create(
67
- <TextInputTv onChangeText={onChangeText} />
62
+ const { getByTestId } = render(
63
+ <TextInputTv type="samsung" onChangeText={onChangeText} />
68
64
  );
69
65
 
70
- const inputInstance = testInstance.root.findByType("input");
66
+ const inputInstance = getByTestId(testIDToTest);
71
67
  expect(inputInstance.props.onChange).toBeDefined();
72
68
  expect(inputInstance.props.onChangeText).toBeUndefined();
73
69
  });
@@ -76,11 +72,11 @@ describe("<TextInputTv />", () => {
76
72
  Platform.OS = "samsung_tv";
77
73
  const onChangeText = jest.fn();
78
74
 
79
- const testInstance = TestRenderer.create(
80
- <TextInputTv onChangeText={onChangeText} />
75
+ const { getByTestId } = render(
76
+ <TextInputTv type="samsung" onChangeText={onChangeText} />
81
77
  );
82
78
 
83
- const inputInstance = testInstance.root.findByType("input");
79
+ const inputInstance = getByTestId(testIDToTest);
84
80
  const value = "foobar";
85
81
  inputInstance.props.onChange({ target: { value: value } });
86
82
  expect(onChangeText).toBeCalledWith(value);
@@ -89,11 +85,12 @@ describe("<TextInputTv />", () => {
89
85
  it("maps onEndEditing to onBlur", () => {
90
86
  Platform.OS = "samsung_tv";
91
87
 
92
- const testInstance = TestRenderer.create(
93
- <TextInputTv onEndEditing={() => null} />
88
+ const { getByTestId } = render(
89
+ <TextInputTv type="samsung" onEndEditing={() => null} />
94
90
  );
95
91
 
96
- const inputInstance = testInstance.root.findByType("input");
92
+ const inputInstance = getByTestId(testIDToTest);
93
+
97
94
  expect(inputInstance.props.onBlur).toBeDefined();
98
95
  expect(inputInstance.props.onEndEditing).toBeUndefined();
99
96
  });
@@ -101,11 +98,12 @@ describe("<TextInputTv />", () => {
101
98
  it("maps onPress to onClick", () => {
102
99
  Platform.OS = "samsung_tv";
103
100
 
104
- const testInstance = TestRenderer.create(
105
- <TextInputTv onPress={() => null} />
101
+ const { getByTestId } = render(
102
+ <TextInputTv type="samsung" onPress={() => null} />
106
103
  );
107
104
 
108
- const inputInstance = testInstance.root.findByType("input");
105
+ const inputInstance = getByTestId(testIDToTest);
106
+
109
107
  expect(inputInstance.props.onClick).toBeDefined();
110
108
  expect(inputInstance.props.onPress).toBeUndefined();
111
109
  });
@@ -113,22 +111,24 @@ describe("<TextInputTv />", () => {
113
111
  it("replaces secureTextEntry with type:'password'", () => {
114
112
  Platform.OS = "samsung_tv";
115
113
 
116
- const testInstance = TestRenderer.create(
117
- <TextInputTv secureTextEntry={true} />
114
+ const { getByTestId } = render(
115
+ <TextInputTv type="samsung" secureTextEntry />
118
116
  );
119
117
 
120
- const inputInstance = testInstance.root.findByType("input");
118
+ const inputInstance = getByTestId(testIDToTest);
119
+
121
120
  expect(inputInstance.props.type).toBe("password");
122
121
  });
123
122
 
124
123
  it("removes 'onChangeText', 'secureTextEntry', 'onEndEditing', 'onPress' props", () => {
125
124
  Platform.OS = "samsung_tv";
126
125
 
127
- const testInstance = TestRenderer.create(
128
- <TextInputTv onChangeText secureTextEntry onEndEditing />
126
+ const { getByTestId } = render(
127
+ <TextInputTv type="samsung" onChangeText secureTextEntry onEndEditing />
129
128
  );
130
129
 
131
- const inputInstance = testInstance.root.findByType("input");
130
+ const inputInstance = getByTestId(testIDToTest);
131
+
132
132
  expect(inputInstance.props.onChangeText).toBeUndefined();
133
133
  expect(inputInstance.props.secureTextEntry).toBeUndefined();
134
134
  expect(inputInstance.props.onEndEditing).toBeUndefined();
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<TextInputTv /> renders 1`] = `
4
+ <input
5
+ testID="TextInput-tv"
6
+ />
7
+ `;
@@ -94,8 +94,8 @@ function TextInputTV(props: Props, ref) {
94
94
  styles.textAlign === "center"
95
95
  ? styles.textAlign
96
96
  : styles.textAlign === "left"
97
- ? "right"
98
- : "left";
97
+ ? "right"
98
+ : "left";
99
99
 
100
100
  return { style: { ...styles, textAlign } };
101
101
  }
@@ -175,10 +175,10 @@ function TextInputTV(props: Props, ref) {
175
175
  return isWebPlatform ? (
176
176
  <>
177
177
  {additional && additional()}
178
- <input ref={ref} {...inputProps} />
178
+ <input testID="TextInput-tv" ref={ref} {...inputProps} />
179
179
  </>
180
180
  ) : (
181
- <TextInput ref={ref} {...inputProps} />
181
+ <TextInput testID="TextInput-tv" ref={ref} {...inputProps} />
182
182
  );
183
183
  }
184
184
 
@@ -14,7 +14,7 @@ exports[`<Touchable /> when not running in automated tests environment renders c
14
14
  onResponderTerminationRequest={[Function]}
15
15
  onStartShouldSetResponder={[Function]}
16
16
  style={
17
- Object {
17
+ {
18
18
  "opacity": 1,
19
19
  }
20
20
  }
@@ -40,7 +40,7 @@ exports[`<Touchable /> when running in automated tests environment has accessibl
40
40
  onResponderTerminationRequest={[Function]}
41
41
  onStartShouldSetResponder={[Function]}
42
42
  style={
43
- Object {
43
+ {
44
44
  "opacity": 1,
45
45
  }
46
46
  }
@@ -3,19 +3,19 @@ import { Animated } from "react-native";
3
3
  import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
4
4
 
5
5
  type TransitionConfig = {
6
- duration: number,
7
- easing: any,
6
+ duration: number;
7
+ easing: any;
8
8
  from: {
9
- style: any,
10
- },
9
+ style: any;
10
+ };
11
11
  to: {
12
- style: any,
13
- },
12
+ style: any;
13
+ };
14
14
  };
15
15
 
16
16
  type Props = {
17
- transitionConfig: TransitionConfig,
18
- contentStyle: { [string]: any },
17
+ transitionConfig: TransitionConfig;
18
+ contentStyle: { [string]: any };
19
19
  };
20
20
 
21
21
  /**
@@ -1,16 +1,16 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`AnimationManager initialState() returns a state composed from the initial configuration 1`] = `
4
- Object {
4
+ {
5
5
  "animating": false,
6
6
  "duration": 123,
7
7
  "easing": [MockFunction],
8
- "from": Object {
8
+ "from": {
9
9
  "index": 0,
10
10
  },
11
- "to": Object {
11
+ "to": {
12
12
  "index": 0,
13
- "style": Object {},
13
+ "style": {},
14
14
  },
15
15
  }
16
16
  `;
@@ -18,25 +18,25 @@ Object {
18
18
  exports[`AnimationManager returns the animation manager with the injected transition configuration 1`] = `
19
19
  AnimationManager {
20
20
  "animatedValue": 0,
21
- "config": Object {
22
- "back": Object {
21
+ "config": {
22
+ "back": {
23
23
  "duration": 123,
24
24
  "easing": [MockFunction],
25
- "from": Object {
26
- "style": Object {},
25
+ "from": {
26
+ "style": {},
27
27
  },
28
- "to": Object {
29
- "style": Object {},
28
+ "to": {
29
+ "style": {},
30
30
  },
31
31
  },
32
- "push": Object {
32
+ "push": {
33
33
  "duration": 123,
34
34
  "easing": [MockFunction],
35
- "from": Object {
36
- "style": Object {},
35
+ "from": {
36
+ "style": {},
37
37
  },
38
- "to": Object {
39
- "style": Object {},
38
+ "to": {
39
+ "style": {},
40
40
  },
41
41
  },
42
42
  },
@@ -44,25 +44,25 @@ AnimationManager {
44
44
  `;
45
45
 
46
46
  exports[`AnimationManager returns the animation manager with the injected transition configuration 2`] = `
47
- Object {
48
- "back": Object {
47
+ {
48
+ "back": {
49
49
  "duration": 123,
50
50
  "easing": [MockFunction],
51
- "from": Object {
52
- "style": Object {},
51
+ "from": {
52
+ "style": {},
53
53
  },
54
- "to": Object {
55
- "style": Object {},
54
+ "to": {
55
+ "style": {},
56
56
  },
57
57
  },
58
- "push": Object {
58
+ "push": {
59
59
  "duration": 123,
60
60
  "easing": [MockFunction],
61
- "from": Object {
62
- "style": Object {},
61
+ "from": {
62
+ "style": {},
63
63
  },
64
- "to": Object {
65
- "style": Object {},
64
+ "to": {
65
+ "style": {},
66
66
  },
67
67
  },
68
68
  }
@@ -4,14 +4,14 @@ exports[`<Scene /> renders correctly 1`] = `
4
4
  <ForwardRef(AnimatedComponentWrapper)
5
5
  pointerEvents="auto"
6
6
  style={
7
- Array [
8
- Object {
7
+ [
8
+ {
9
9
  "flex": 1,
10
10
  },
11
- Object {
11
+ {
12
12
  "paddingBottom": 49,
13
13
  },
14
- Object {
14
+ {
15
15
  "fontScale": 2,
16
16
  "height": 1334,
17
17
  "scale": 2,
@@ -33,14 +33,14 @@ exports[`<Scene /> renders the overlay while animating 1`] = `
33
33
  <ForwardRef(AnimatedComponentWrapper)
34
34
  pointerEvents="auto"
35
35
  style={
36
- Array [
37
- Object {
36
+ [
37
+ {
38
38
  "flex": 1,
39
39
  },
40
- Object {
40
+ {
41
41
  "paddingBottom": 49,
42
42
  },
43
- Object {
43
+ {
44
44
  "height": "100%",
45
45
  "width": "100%",
46
46
  },
@@ -54,7 +54,7 @@ exports[`<Scene /> renders the overlay while animating 1`] = `
54
54
  </ContextProvider>
55
55
  <ForwardRef(AnimatedComponentWrapper)
56
56
  style={
57
- Object {
57
+ {
58
58
  "opacity": 1,
59
59
  }
60
60
  }
@@ -5,34 +5,34 @@ exports[`transitionConfig accepts an Animated.Value as a parameter 1`] = `"Canno
5
5
  exports[`transitionConfig accepts an Animated.Value as a parameter 2`] = `[Function]`;
6
6
 
7
7
  exports[`transitionConfig returns a back object is valid 1`] = `
8
- Object {
8
+ {
9
9
  "duration": 350,
10
10
  "easing": [Function],
11
- "from": Object {
12
- "style": Object {
11
+ "from": {
12
+ "style": {
13
13
  "height": 1334,
14
14
  "position": "absolute",
15
- "transform": Array [
16
- Object {
15
+ "transform": [
16
+ {
17
17
  "translateX": 0,
18
18
  },
19
19
  ],
20
20
  "width": 750,
21
21
  },
22
22
  },
23
- "to": Object {
24
- "overlayStyle": Object {
23
+ "to": {
24
+ "overlayStyle": {
25
25
  "backgroundColor": "black",
26
26
  "height": 1334,
27
27
  "opacity": 0.35,
28
28
  "position": "absolute",
29
29
  "width": 750,
30
30
  },
31
- "style": Object {
31
+ "style": {
32
32
  "height": 1334,
33
33
  "position": "absolute",
34
- "transform": Array [
35
- Object {
34
+ "transform": [
35
+ {
36
36
  "translateX": -1,
37
37
  },
38
38
  ],
@@ -43,34 +43,34 @@ Object {
43
43
  `;
44
44
 
45
45
  exports[`transitionConfig returns a push object is valid 1`] = `
46
- Object {
46
+ {
47
47
  "duration": 350,
48
48
  "easing": [Function],
49
- "from": Object {
50
- "overlayStyle": Object {
49
+ "from": {
50
+ "overlayStyle": {
51
51
  "backgroundColor": "black",
52
52
  "height": 1334,
53
53
  "opacity": 0,
54
54
  "position": "absolute",
55
55
  "width": 750,
56
56
  },
57
- "style": Object {
57
+ "style": {
58
58
  "height": 1334,
59
59
  "position": "absolute",
60
- "transform": Array [
61
- Object {
60
+ "transform": [
61
+ {
62
62
  "translateX": 0,
63
63
  },
64
64
  ],
65
65
  "width": 750,
66
66
  },
67
67
  },
68
- "to": Object {
69
- "style": Object {
68
+ "to": {
69
+ "style": {
70
70
  "height": 1334,
71
71
  "position": "absolute",
72
- "transform": Array [
73
- Object {
72
+ "transform": [
73
+ {
74
74
  "translateX": 750,
75
75
  },
76
76
  ],
@@ -3,7 +3,7 @@
3
3
  exports[`<TransitionerComponent /> renders correctly 1`] = `
4
4
  <View
5
5
  style={
6
- Object {
6
+ {
7
7
  "flex": 1,
8
8
  "overflow": "hidden",
9
9
  }
@@ -12,7 +12,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
12
12
  <Scene
13
13
  isActive={true}
14
14
  screenUniqueId="mocked-uuid"
15
- style={Object {}}
15
+ style={{}}
16
16
  >
17
17
  <View
18
18
  foo="bar"
@@ -8,6 +8,8 @@ import { loggerLiveImageManager } from "./loggerHelper";
8
8
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
9
9
  import { Component } from "react";
10
10
 
11
+ const TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION = 500; // ms
12
+
11
13
  const { log_debug, log_info, log_error } = loggerLiveImageManager;
12
14
 
13
15
  export type LiveImageManagerEvent =
@@ -62,6 +64,9 @@ export class LiveImageManager implements PlayerLifecycleListener {
62
64
  protected currentlyPlaying: LiveImage | null = null;
63
65
  protected primaryPlayer: Player | null = null;
64
66
 
67
+ private checkPlayerPositionTimeout: ReturnType<typeof setTimeout> | null =
68
+ null;
69
+
65
70
  protected listeners: Record<
66
71
  string,
67
72
  Record<LiveImageManagerEvent, (event?: Record<string, any>) => void>
@@ -118,6 +123,11 @@ export class LiveImageManager implements PlayerLifecycleListener {
118
123
  });
119
124
  };
120
125
 
126
+ private cancelCheckPlayerPositionTimeout = () => {
127
+ clearTimeout(this.checkPlayerPositionTimeout);
128
+ this.checkPlayerPositionTimeout = null;
129
+ };
130
+
121
131
  public onViewportEnter = (item: LiveImage) => {
122
132
  log_debug(
123
133
  `onViewportEnter: live-image ${playerInfo(
@@ -125,7 +135,21 @@ export class LiveImageManager implements PlayerLifecycleListener {
125
135
  )}, primary ${playerInfo(this.primaryPlayer)}`
126
136
  );
127
137
 
128
- this.checkPlayerPosition(item);
138
+ if (!isTV()) {
139
+ // mobile only
140
+ // we have to delay running checkPlayerPosition, because sometimes on fast scrolling we get wrong order onEnter, then onLeave.
141
+ // which could cause select wrong item to play
142
+
143
+ this.cancelCheckPlayerPositionTimeout();
144
+
145
+ this.checkPlayerPositionTimeout = setTimeout(() => {
146
+ this.cancelCheckPlayerPositionTimeout();
147
+
148
+ this.checkPlayerPosition(item);
149
+ }, TIMEOUT_FOR_DELAY_CHECK_PLAYER_POSITION);
150
+ } else {
151
+ this.checkPlayerPosition(item);
152
+ }
129
153
  };
130
154
 
131
155
  public onViewportLeave = (item: LiveImage) => {
@@ -246,6 +270,8 @@ export class LiveImageManager implements PlayerLifecycleListener {
246
270
  };
247
271
 
248
272
  public checkPlayerPosition = (item: LiveImage) => {
273
+ this.cancelCheckPlayerPositionTimeout();
274
+
249
275
  log_debug(
250
276
  `checkPlayerPosition: live-image playerId: ${playerInfo(
251
277
  item.player
@@ -244,25 +244,27 @@ const PlayerLiveImageComponent = (props: Props) => {
244
244
  }, [item.id]);
245
245
 
246
246
  React.useEffect(() => {
247
- if (playerManager) {
248
- const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
247
+ if (isMeasurement(item) || !playerManager) {
248
+ return;
249
+ }
249
250
 
250
- if (isPlayerRegistered) {
251
- log_error(
252
- `PlayerLiveImageComponent: player ${playerId} already registered`
253
- );
254
- } else {
255
- playerManager.registerPlayer({
256
- id: playerId,
257
- playerController: controller,
258
- });
251
+ const isPlayerRegistered = playerManager.isPlayerRegistered(playerId);
259
252
 
260
- return () => {
261
- playerManager.unregisterPlayer(playerId);
262
- };
263
- }
253
+ if (isPlayerRegistered) {
254
+ log_error(
255
+ `PlayerLiveImageComponent: player ${playerId} already registered`
256
+ );
257
+ } else {
258
+ playerManager.registerPlayer({
259
+ id: playerId,
260
+ playerController: controller,
261
+ });
262
+
263
+ return () => {
264
+ playerManager.unregisterPlayer(playerId);
265
+ };
264
266
  }
265
- }, [liveImageItem, playerId, controller]);
267
+ }, [liveImageItem, playerId, controller, item.id]);
266
268
 
267
269
  const onPositionUpdated = React.useCallback(
268
270
  (data) => {