@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6523249552 → 13.0.0-alpha.6651373134

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 (132) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  3. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  6. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  8. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  9. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  11. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  12. package/Components/AudioPlayer/helpers.tsx +1 -0
  13. package/Components/BaseFocusable/index.tsx +1 -2
  14. package/Components/Cell/Cell.tsx +4 -13
  15. package/Components/Cell/CellWithFocusable.tsx +48 -59
  16. package/Components/Cell/CellWrapper.ts +5 -0
  17. package/Components/Cell/TvOSCellComponent.tsx +20 -22
  18. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  19. package/Components/Cell/index.js +3 -1
  20. package/Components/Cell/styles.ts +17 -0
  21. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  22. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  23. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  24. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  25. package/Components/ErrorScreen/index.tsx +14 -6
  26. package/Components/Focusable/Focusable.tsx +1 -0
  27. package/Components/Focusable/FocusableTvOS.tsx +5 -1
  28. package/Components/Focusable/index.android.tsx +10 -3
  29. package/Components/FocusableCell/index.tsx +1 -1
  30. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  31. package/Components/FocusableGroup/index.tsx +0 -3
  32. package/Components/FocusableList/index.tsx +26 -9
  33. package/Components/FocusableScrollView/index.tsx +43 -13
  34. package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
  35. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  36. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  37. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  38. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  39. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
  40. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
  41. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  42. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  43. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  44. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  45. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  46. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  47. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  48. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  49. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  50. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  51. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  52. package/Components/MasterCell/utils/index.ts +8 -134
  53. package/Components/ModalComponent/Button/assets.ts +1 -1
  54. package/Components/ModalComponent/Button/index.tsx +6 -6
  55. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  56. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  57. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  58. package/Components/OfflineHandler/utils/index.ts +1 -1
  59. package/Components/PlayerContainer/PlayerContainer.tsx +17 -13
  60. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  61. package/Components/PlayerImageBackground/index.tsx +1 -1
  62. package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
  63. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  64. package/Components/River/RiverFooter.tsx +39 -9
  65. package/Components/River/RiverItem.tsx +37 -2
  66. package/Components/River/TV/index.tsx +6 -1
  67. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
  68. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  69. package/Components/River/__tests__/componentsMap.test.js +3 -4
  70. package/Components/River/__tests__/river.test.js +75 -40
  71. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  72. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  73. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  74. package/Components/Screen/TV/index.web.tsx +5 -6
  75. package/Components/Screen/hooks.ts +53 -0
  76. package/Components/Screen/index.tsx +16 -43
  77. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  78. package/Components/Tabs/Tab.tsx +5 -3
  79. package/Components/TextInputTv/index.tsx +2 -1
  80. package/Components/TrackedView/index.tsx +1 -0
  81. package/Components/Transitioner/AnimationManager.js +15 -15
  82. package/Components/Transitioner/Scene.tsx +1 -1
  83. package/Components/Transitioner/Transitioner.tsx +3 -3
  84. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  85. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
  86. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  87. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  88. package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
  89. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  90. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  91. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +44 -30
  92. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  93. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +24 -11
  94. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -5
  95. package/Components/VideoModal/PlayerDetails.tsx +9 -6
  96. package/Components/VideoModal/PlayerWrapper.tsx +28 -5
  97. package/Components/VideoModal/VideoModal.tsx +2 -2
  98. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  99. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  100. package/Components/Viewport/__tests__/utils.test.js +5 -4
  101. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  102. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  103. package/Components/ZappUIComponent/index.tsx +3 -16
  104. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  105. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  106. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  107. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  108. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  109. package/Contexts/ScreenContext/index.tsx +3 -10
  110. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  111. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  112. package/Decorators/Navigator/index.tsx +1 -1
  113. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  114. package/Decorators/RiverResolver/index.tsx +6 -8
  115. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  116. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  117. package/package.json +7 -11
  118. package/tsconfig.json +2 -3
  119. package/.babelrc +0 -8
  120. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  121. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  122. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  123. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  124. package/Components/Cell/CellStyles/colors.js +0 -40
  125. package/Components/Cell/CellStyles/index.js +0 -15
  126. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  127. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  128. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  129. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  130. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  131. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  132. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
3
+
4
4
  import * as zappPipesRedux from "@applicaster/zapp-react-native-redux/ZappPipes";
5
5
  import configureStore from "redux-mock-store";
6
6
  import thunk from "redux-thunk";
@@ -8,6 +8,7 @@ import thunk from "redux-thunk";
8
8
  import { zappPipesDataConnector } from "../index";
9
9
 
10
10
  import { Hero } from "./Hero";
11
+ import { render } from "ejs";
11
12
 
12
13
  const mockStore = configureStore([thunk]);
13
14
 
@@ -20,6 +21,15 @@ const initialState = {
20
21
  },
21
22
  };
22
23
 
24
+ jest.mock(
25
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
26
+ () => ({
27
+ useIsScreenActive: () => ({
28
+ isScreenActive: true,
29
+ }),
30
+ })
31
+ );
32
+
23
33
  const store = mockStore(initialState);
24
34
 
25
35
  const zappPipesSpy = jest
@@ -31,6 +41,7 @@ const WrappedComponent = zappPipesDataConnector(Hero);
31
41
  const componentProp = (data) => ({ data });
32
42
 
33
43
  // tests need to be re-written due to TS refactor
44
+ // this test has old usage of enzyme API, that's need to be replaced with @testing-library/react-native
34
45
  describe.skip("zappPipesDataConnector", () => {
35
46
  beforeEach(() => {
36
47
  zappPipesSpy.mockClear();
@@ -43,7 +54,7 @@ describe.skip("zappPipesDataConnector", () => {
43
54
  it("loads the provided feed url", () => {
44
55
  expect(zappPipesDataConnector).toBeFunction();
45
56
 
46
- const wrapper = shallow(
57
+ const wrapper = renderWithProviders(
47
58
  <WrappedComponent
48
59
  component={componentProp(data)}
49
60
  feedUrl={feedUrl}
@@ -51,8 +62,7 @@ describe.skip("zappPipesDataConnector", () => {
51
62
  />
52
63
  ).dive();
53
64
 
54
- expect(shallowToJson(wrapper)).toMatchSnapshot();
55
- expect(wrapper.first().shallow()).toMatchSnapshot();
65
+ expect(wrapper.toJSON()).toMatchSnapshot();
56
66
 
57
67
  expect(zappPipesSpy).toHaveBeenCalledWith(feedUrl, {
58
68
  clearCache: false,
@@ -71,12 +81,11 @@ describe.skip("zappPipesDataConnector", () => {
71
81
  it("is a HoC", () => {
72
82
  expect(zappPipesDataConnector).toBeFunction();
73
83
 
74
- const wrapper = shallow(
84
+ const wrapper = renderWithProviders(
75
85
  <WrappedComponent component={componentProp(data)} store={store} />
76
86
  ).dive();
77
87
 
78
- expect(shallowToJson(wrapper)).toMatchSnapshot();
79
- expect(wrapper.first().shallow()).toMatchSnapshot();
88
+ expect(wrapper.toJSON()).toMatchSnapshot();
80
89
 
81
90
  expect(zappPipesSpy).toHaveBeenCalledWith(data.source, {
82
91
  clearCache: false,
@@ -99,12 +108,11 @@ describe.skip("zappPipesDataConnector", () => {
99
108
  it("calls clearCache true and silentRefresh with false", () => {
100
109
  expect(zappPipesDataConnector).toBeFunction();
101
110
 
102
- const wrapper = shallow(
111
+ const wrapper = renderWithProviders(
103
112
  <WrappedComponent component={{ data, rules }} store={store} />
104
113
  ).dive();
105
114
 
106
- expect(shallowToJson(wrapper)).toMatchSnapshot();
107
- expect(wrapper.first().shallow()).toMatchSnapshot();
115
+ expect(wrapper.toJSON()).toMatchSnapshot();
108
116
 
109
117
  expect(zappPipesSpy).toHaveBeenCalledWith(data.source, {
110
118
  clearCache: true,
@@ -123,12 +131,11 @@ describe.skip("zappPipesDataConnector", () => {
123
131
  it("is a HoC", () => {
124
132
  expect(zappPipesDataConnector).toBeFunction();
125
133
 
126
- const wrapper = shallow(
134
+ const wrapper = renderWithProviders(
127
135
  <WrappedComponent component={componentProp(data)} store={store} />
128
136
  ).dive();
129
137
 
130
- expect(shallowToJson(wrapper)).toMatchSnapshot();
131
- expect(wrapper.first().shallow()).toMatchSnapshot();
138
+ expect(wrapper.toJSON()).toMatchSnapshot();
132
139
 
133
140
  expect(zappPipesSpy).toHaveBeenCalledWith(
134
141
  "applicaster://fetchData?type=APPLICASTER_COLLECTION&collectionId=1234",
@@ -146,11 +153,11 @@ describe.skip("zappPipesDataConnector", () => {
146
153
  it("is a HoC", () => {
147
154
  expect(zappPipesDataConnector).toBeFunction();
148
155
 
149
- const wrapper = shallow(
156
+ const wrapper = renderWithProviders(
150
157
  <WrappedComponent component={componentProp(data)} store={store} />
151
158
  ).dive();
152
159
 
153
- expect(shallowToJson(wrapper)).toMatchSnapshot();
160
+ expect(wrapper.toJSON()).toMatchSnapshot();
154
161
  expect(wrapper.first().shallow()).toMatchSnapshot();
155
162
 
156
163
  expect(zappPipesSpy).toHaveBeenCalledWith(
@@ -171,11 +178,11 @@ describe.skip("zappPipesDataConnector", () => {
171
178
  };
172
179
 
173
180
  it("calls loadPipesData with favourites option", () => {
174
- const wrapper = shallow(
181
+ const wrapper = renderWithProviders(
175
182
  <WrappedComponent component={componentProp(data)} store={store} />
176
183
  ).dive();
177
184
 
178
- expect(shallowToJson(wrapper)).toMatchSnapshot();
185
+ expect(wrapper.toJSON()).toMatchSnapshot();
179
186
  expect(wrapper.first().shallow()).toMatchSnapshot();
180
187
 
181
188
  expect(zappPipesSpy).toHaveBeenCalledWith("FAVOURITES", {
@@ -188,7 +195,7 @@ describe.skip("zappPipesDataConnector", () => {
188
195
 
189
196
  describe("getDataSourceUrl", () => {
190
197
  it("returns null if data prop is empty", () => {
191
- const wrapper = shallow(
198
+ const wrapper = render(
192
199
  <WrappedComponent component={componentProp({})} store={store} />
193
200
  ).dive();
194
201
 
@@ -199,7 +206,7 @@ describe.skip("zappPipesDataConnector", () => {
199
206
  });
200
207
 
201
208
  it("returns null if data.source is falsy", () => {
202
- const wrapper = shallow(
209
+ const wrapper = renderWithProviders(
203
210
  <WrappedComponent
204
211
  component={componentProp({ source: null })}
205
212
  store={store}
@@ -222,7 +229,7 @@ describe.skip("zappPipesDataConnector", () => {
222
229
  it("reloads the app's datasource", () => {
223
230
  store.clearActions();
224
231
 
225
- const wrapper = shallow(
232
+ const wrapper = renderWithProviders(
226
233
  <WrappedComponent component={componentProp(data)} store={store} />
227
234
  ).dive();
228
235
 
@@ -251,7 +258,7 @@ describe.skip("zappPipesDataConnector", () => {
251
258
  entry: [{ id: "test-entry", title: "test entry" }],
252
259
  }));
253
260
 
254
- const wrapper = shallow(
261
+ const wrapper = renderWithProviders(
255
262
  <WrappedComponent
256
263
  component={{ data, getStaticComponentFeed }}
257
264
  store={store}
@@ -1,12 +1,10 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  /// <reference types="@applicaster/zapp-react-native-ui-components" />
3
3
  import React, { useEffect, useMemo } from "react";
4
- import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
5
4
 
6
5
  import * as R from "ramda";
7
6
  import { Platform } from "react-native";
8
7
  import Url from "url";
9
- import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
10
8
  import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
11
9
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
12
10
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
@@ -21,12 +19,7 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
21
19
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
22
20
 
23
21
  import { isVerticalListOrGrid } from "./utils";
24
- import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
25
- import {
26
- findEndpointForURL,
27
- HTTP_METHODS,
28
- } from "@applicaster/zapp-pipes-v2-client";
29
- import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
22
+ import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
30
23
 
31
24
  type Props = {
32
25
  component: ZappUIComponent;
@@ -237,7 +230,8 @@ export function zappPipesDataConnector(
237
230
  const entryContext =
238
231
  (shouldUseNestedContext && screenContextData?.nested?.entry
239
232
  ? screenContextData?.nested?.entry
240
- : screenContextData?.entry) || {};
233
+ : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
234
+ {};
241
235
 
242
236
  const screenContext =
243
237
  (shouldUseNestedContext && screenContextData?.nested?.screen
@@ -300,27 +294,7 @@ export function zappPipesDataConnector(
300
294
  return addListener(reloadData);
301
295
  }
302
296
  } else {
303
- const pipesEndpoints = appStore.get("pipesEndpoints");
304
-
305
- const endpointURL = findEndpointForURL(
306
- dataSourceUrl,
307
- pipesEndpoints,
308
- HTTP_METHODS.GET
309
- );
310
-
311
- const endpoint = pipesEndpoints?.[endpointURL];
312
-
313
- if (endpoint?.tags?.includes(ENDPOINT_TAGS.observe_storage)) {
314
- const subscriptions: (() => void)[] = endpoint.context_obj.map(
315
- (data: Record<string, any>) => {
316
- const { namespace, key } = getNamespaceAndKey(data.key);
317
-
318
- return localStorage.addListener({ key, namespace }, reloadData);
319
- }
320
- );
321
-
322
- return () => subscriptions.forEach((listener) => listener());
323
- }
297
+ return subscribeForUrlContextKeyChanges(dataSourceUrl, {}, reloadData);
324
298
  }
325
299
  }, [dataSourceUrl, reloadData]);
326
300
 
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.6523249552",
3
+ "version": "13.0.0-alpha.6651373134",
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",
7
7
  "scripts": {
8
- "test": "jest -w=2",
9
8
  "build": "echo skipping hybrid typescript build for now"
10
9
  },
11
10
  "publishConfig": {
@@ -29,15 +28,13 @@
29
28
  },
30
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
31
30
  "devDependencies": {
32
- "@types/react": "17.0.2",
33
- "@types/react-native": "0.69.6",
34
31
  "redux-mock-store": "^1.5.3"
35
32
  },
36
33
  "dependencies": {
37
- "@applicaster/applicaster-types": "13.0.0-alpha.6523249552",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.6523249552",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.6523249552",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.6523249552",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.6651373134",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.6651373134",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.6651373134",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.6651373134",
41
38
  "promise": "^8.3.0",
42
39
  "react-router-native": "^5.1.2",
43
40
  "url": "^0.11.0",
@@ -46,10 +43,9 @@
46
43
  "peerDependencies": {
47
44
  "@applicaster/zapp-pipes-v2-client": "*",
48
45
  "@react-native-community/netinfo": "*",
49
- "@types/node": "*",
50
46
  "immer": "*",
51
- "react": "17.0.2",
52
- "react-native": "0.68.6",
47
+ "react": "*",
48
+ "react-native": "*",
53
49
  "react-native-safe-area-context": "*",
54
50
  "react-native-svg": "*",
55
51
  "uglify-js": "*",
package/tsconfig.json CHANGED
@@ -2,8 +2,7 @@
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./lib",
5
- "rootDir": "./src"
5
+ "rootDir": "./"
6
6
  },
7
- "exclude": ["src/**/*.test.tsx"],
8
- "include": ["src/**/*"]
7
+ "include": ["**/*"],
9
8
  }
package/.babelrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": ["react-native", "flow", "react-native-stage-0/decorator-support"],
3
- "env": {
4
- "test": {
5
- "presets": [["env", { "modules": "commonjs" }], "react-native", "flow"]
6
- }
7
- }
8
- }
@@ -1,157 +0,0 @@
1
- import {
2
- getColor,
3
- ACTIVE_COLOR,
4
- BACKGROUND_COLOR,
5
- MAIN_TEXT_COLOR,
6
- FOCUSED_TEXT_COLOR,
7
- } from "../colors";
8
-
9
- const Image = "Image";
10
- const View = "View";
11
- const Text = "Text";
12
-
13
- const containerStyles = (styles) => ({
14
- flex: 1,
15
- flexDirection: "column",
16
- width: 384,
17
- height: 436,
18
- borderRadius: 4,
19
- backgroundColor: getColor(BACKGROUND_COLOR, styles),
20
- marginRight: 48,
21
- marginBottom: 48,
22
- });
23
-
24
- const focusedContainerStyles = (styles) => ({
25
- ...containerStyles(styles),
26
- backgroundColor: getColor(ACTIVE_COLOR, styles),
27
- });
28
-
29
- const imageStyle = {
30
- width: 384,
31
- height: 216,
32
- borderTopRightRadius: 4,
33
- borderTopLeftRadius: 4,
34
- };
35
-
36
- const titleContainerStyles = {
37
- width: 336,
38
- height: 60,
39
- marginHorizontal: 24,
40
- marginTop: 24,
41
- overflow: "hidden",
42
- };
43
-
44
- const titleStyles = (styles) => ({
45
- fontSize: 26,
46
- color: getColor(MAIN_TEXT_COLOR, styles),
47
- fontWeight: "bold",
48
- fontStyle: "normal",
49
- });
50
-
51
- const focusedTitleStyles = (styles) => ({
52
- ...titleStyles(styles),
53
- color: getColor(FOCUSED_TEXT_COLOR, styles),
54
- });
55
-
56
- const subtitleContainerStyles = {
57
- width: 336,
58
- height: 88,
59
- marginHorizontal: 24,
60
- marginTop: 24,
61
- overflow: "hidden",
62
- };
63
-
64
- const subtitleStyles = (styles) => ({
65
- fontSize: 24,
66
- fontWeight: "normal",
67
- opacity: 0.8,
68
- color: getColor(MAIN_TEXT_COLOR, styles),
69
- fontStyle: "normal",
70
- });
71
-
72
- const focusedSubtitleStyles = (styles) => ({
73
- ...subtitleStyles(styles),
74
- color: getColor(FOCUSED_TEXT_COLOR, styles),
75
- });
76
-
77
- const viewTree = (state, styles) => [
78
- {
79
- type: View,
80
- style:
81
- state === "focused"
82
- ? focusedContainerStyles(styles)
83
- : containerStyles(styles),
84
- elements: [
85
- {
86
- type: Image,
87
- style: imageStyle,
88
- data: [
89
- {
90
- func: "image_src_from_media_item",
91
- args: ["thumbnail-small"],
92
- propName: "uri",
93
- },
94
- ],
95
- },
96
- {
97
- type: View,
98
- style: titleContainerStyles,
99
- elements: [
100
- {
101
- type: Text,
102
- style:
103
- state === "focused"
104
- ? focusedTitleStyles(styles)
105
- : titleStyles(styles),
106
- data: [
107
- {
108
- func: "path",
109
- args: ["title"],
110
- propName: "label",
111
- },
112
- ],
113
- additionalProps: {
114
- numberOfLines: 2,
115
- },
116
- },
117
- ],
118
- },
119
- {
120
- type: View,
121
- style: subtitleContainerStyles,
122
- elements: [
123
- {
124
- type: Text,
125
- style:
126
- state === "focused"
127
- ? focusedSubtitleStyles(styles)
128
- : subtitleStyles(styles),
129
- data: [
130
- {
131
- func: "path",
132
- args: ["summary"],
133
- propName: "label",
134
- },
135
- ],
136
- additionalProps: {
137
- numberOfLines: 3,
138
- },
139
- },
140
- ],
141
- },
142
- ],
143
- },
144
- ];
145
-
146
- export const fallbackCellStyle = (styles) => ({
147
- content_types: {
148
- default: {
149
- states: {
150
- default: viewTree("default", styles),
151
- focused: viewTree("focused", styles),
152
- selected: viewTree("selected", styles),
153
- focused_selected: viewTree("focused_selected", styles),
154
- },
155
- },
156
- },
157
- });
@@ -1,111 +0,0 @@
1
- import {
2
- getColor,
3
- ACTIVE_COLOR,
4
- BACKGROUND_COLOR,
5
- MAIN_TEXT_COLOR,
6
- FOCUSED_TEXT_COLOR,
7
- } from "../colors";
8
-
9
- const Image = "Image";
10
- const View = "View";
11
- const Text = "Text";
12
-
13
- const containerStyles = (styles) => ({
14
- flex: 1,
15
- flexDirection: "column",
16
- width: 1280,
17
- height: 436,
18
- borderRadius: 4,
19
- backgroundColor: getColor(BACKGROUND_COLOR, styles),
20
- marginRight: 48,
21
- marginBottom: 48,
22
- });
23
-
24
- const focusedContainerStyles = (styles) => ({
25
- ...containerStyles(styles),
26
- backgroundColor: getColor(ACTIVE_COLOR, styles),
27
- });
28
-
29
- const imageStyle = {
30
- width: 1280,
31
- height: 352,
32
- borderTopRightRadius: 4,
33
- borderTopLeftRadius: 4,
34
- };
35
-
36
- const titleContainerStyles = {
37
- width: 1184,
38
- height: 60,
39
- marginHorizontal: 24,
40
- marginTop: 24,
41
- overflow: "hidden",
42
- };
43
-
44
- const titleStyles = (styles) => ({
45
- fontSize: 26,
46
- color: getColor(MAIN_TEXT_COLOR, styles),
47
- fontWeight: "bold",
48
- fontStyle: "normal",
49
- });
50
-
51
- const focusedTitleStyles = (styles) => ({
52
- ...titleStyles(styles),
53
- color: getColor(FOCUSED_TEXT_COLOR, styles),
54
- });
55
-
56
- const viewTree = (state, styles) => [
57
- {
58
- type: View,
59
- style:
60
- state === "focused"
61
- ? focusedContainerStyles(styles)
62
- : containerStyles(styles),
63
- elements: [
64
- {
65
- type: Image,
66
- style: imageStyle,
67
- data: [
68
- {
69
- func: "image_src_from_media_item",
70
- args: ["thumbnail-small"],
71
- propName: "uri",
72
- },
73
- ],
74
- },
75
- {
76
- type: View,
77
- style: titleContainerStyles,
78
- elements: [
79
- {
80
- type: Text,
81
- style:
82
- state === "focused"
83
- ? focusedTitleStyles(styles)
84
- : titleStyles(styles),
85
- data: [
86
- {
87
- func: "path",
88
- args: ["title"],
89
- propName: "label",
90
- },
91
- ],
92
- additionalProps: {
93
- numberOfLines: 2,
94
- },
95
- },
96
- ],
97
- },
98
- ],
99
- },
100
- ];
101
-
102
- export const hero = (styles) => ({
103
- content_types: {
104
- default: {
105
- states: {
106
- default: viewTree("default", styles),
107
- focused: viewTree("focused", styles),
108
- },
109
- },
110
- },
111
- });
@@ -1,68 +0,0 @@
1
- const viewTree = (state) => [
2
- {
3
- type: "View",
4
- style: {
5
- flex: 1,
6
- // aspectRatio: 1.0487804878,
7
- paddingTop: 14,
8
- paddingBottom: 14,
9
- paddingRight: 30,
10
- },
11
- elements: [
12
- {
13
- type: "View",
14
-
15
- elements: [
16
- {
17
- type: "Text",
18
-
19
- style: {
20
- // paddingHorizontal: "15%",
21
- paddingTop: "2%",
22
- paddingBottom: "2%",
23
- fontSize: 26,
24
- lineHeight: 32,
25
- color:
26
- state === "focused" || state === "selected"
27
- ? "rgba(239,239,239,1.0)"
28
- : "rgba(239,239,239,0.61)",
29
- fontWeight: "700",
30
- },
31
- data: [
32
- {
33
- func: "path",
34
- args: ["title"],
35
- propName: "label",
36
- },
37
- ],
38
- additionalProps: {
39
- numberOfLines: 2,
40
- },
41
- },
42
- {
43
- type: "View",
44
- style: {
45
- height: 10,
46
- alignItems: "center",
47
- justifyContent: "center",
48
- borderColor: state === "focused" ? "#FC461B" : "transparent",
49
- borderBottomWidth: 6,
50
- },
51
- },
52
- ],
53
- },
54
- ],
55
- },
56
- ];
57
-
58
- export const screenSelector = {
59
- content_types: {
60
- default: {
61
- states: {
62
- default: viewTree("default"),
63
- focused: viewTree("focused"),
64
- selected: viewTree("selected"),
65
- },
66
- },
67
- },
68
- };
@@ -1,19 +0,0 @@
1
- import * as R from "ramda";
2
-
3
- import { cellStyles } from "./index";
4
-
5
- type Props = {
6
- cellStyle: string | null | undefined;
7
- componentType: string | null | undefined;
8
- };
9
-
10
- export function cellStylesResolver({ cellStyle, componentType }: Props) {
11
- const componentCellStyles =
12
- R.prop(componentType, cellStyles) || cellStyles.default;
13
-
14
- const result =
15
- R.prop(cellStyle || "fallbackCellStyle", componentCellStyles) ||
16
- componentCellStyles.fallbackCellStyle;
17
-
18
- return result;
19
- }
@@ -1,40 +0,0 @@
1
- import { transformColorCode as fixColorHexCode } from "@applicaster/zapp-react-native-utils/transform";
2
- import * as R from "ramda";
3
-
4
- export const ACTIVE_COLOR = "ACTIVE_COLOR";
5
-
6
- export const BACKGROUND_COLOR = "BACKGROUND_COLOR";
7
-
8
- export const MAIN_TEXT_COLOR = "MAIN_TEXT_COLOR";
9
-
10
- export const FOCUSED_TEXT_COLOR = "FOCUSED_TEXT_COLOR";
11
-
12
- const colorKeyPath = (keyName) => ["tv", keyName, "color"];
13
-
14
- const COLORS = {
15
- [ACTIVE_COLOR]: {
16
- path: colorKeyPath("active"),
17
- default: "#FC461B",
18
- },
19
- [BACKGROUND_COLOR]: {
20
- path: colorKeyPath("background"),
21
- default: "#2F2F2F",
22
- },
23
- [MAIN_TEXT_COLOR]: {
24
- path: colorKeyPath("main_text"),
25
- default: "#EFEFEF",
26
- },
27
- [FOCUSED_TEXT_COLOR]: {
28
- path: colorKeyPath("focused_text_color"),
29
- default: "#FFFFFF",
30
- },
31
- };
32
-
33
- export const getColor = (name, styles) => {
34
- const colorKeyPath = R.path([name, "path"], COLORS);
35
-
36
- return (
37
- fixColorHexCode(R.path(colorKeyPath, styles)) ||
38
- R.path([name, "default"], COLORS)
39
- );
40
- };