@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1199723621 → 13.0.0-alpha.1240837114

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 (52) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  2. package/Components/AudioPlayer/helpers.tsx +1 -0
  3. package/Components/Cell/Cell.tsx +3 -13
  4. package/Components/Cell/CellWithFocusable.tsx +18 -14
  5. package/Components/Cell/CellWrapper.ts +5 -0
  6. package/Components/Cell/styles.ts +17 -0
  7. package/Components/ErrorScreen/index.tsx +8 -0
  8. package/Components/FocusableCell/index.tsx +1 -1
  9. package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
  10. package/Components/FocusableGroup/index.tsx +0 -1
  11. package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
  12. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  13. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  14. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  15. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  16. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  17. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  18. package/Components/MasterCell/utils/index.ts +8 -134
  19. package/Components/ModalComponent/Button/assets.ts +1 -1
  20. package/Components/OfflineHandler/utils/index.ts +1 -1
  21. package/Components/PlayerContainer/PlayerContainer.tsx +9 -5
  22. package/Components/PlayerImageBackground/index.tsx +4 -24
  23. package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
  24. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  25. package/Components/Screen/TV/index.web.tsx +5 -6
  26. package/Components/Screen/hooks.ts +3 -6
  27. package/Components/TrackedView/index.tsx +1 -0
  28. package/Components/Transitioner/AnimationManager.js +15 -15
  29. package/Components/VideoLive/PlayerLiveImageComponent.tsx +4 -0
  30. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  31. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  32. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +33 -19
  33. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  34. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +17 -4
  35. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
  36. package/Components/VideoModal/VideoModal.tsx +2 -2
  37. package/Components/ZappUIComponent/index.tsx +4 -4
  38. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  39. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  40. package/Contexts/ScreenContext/index.tsx +3 -10
  41. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  42. package/Decorators/RiverResolver/index.tsx +5 -7
  43. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  44. package/package.json +5 -9
  45. package/tsconfig.json +2 -3
  46. package/.babelrc +0 -8
  47. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  48. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  49. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  50. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  51. package/Components/Cell/CellStyles/colors.js +0 -40
  52. package/Components/Cell/CellStyles/index.js +0 -15
@@ -228,6 +228,8 @@ export const AnimationView = ({
228
228
  isAudioItem,
229
229
  moveUpValue,
230
230
  moveComponentHorizontalValue,
231
+ isRTL,
232
+ inlineAudioPlayer,
231
233
  ]
232
234
  );
233
235
 
@@ -246,7 +248,7 @@ export const AnimationView = ({
246
248
  default:
247
249
  return getAnimationValue(
248
250
  animationType,
249
- PlayerAnimationStateEnum.maximaze
251
+ PlayerAnimationStateEnum.maximize
250
252
  ).toValue;
251
253
  }
252
254
  }, [defaultValue, videoModalState]);
@@ -278,6 +280,11 @@ export const AnimationView = ({
278
280
  moveUpValue,
279
281
  moveComponentHorizontalValue,
280
282
  videoModalMode,
283
+ isAudioItem,
284
+ isTablet,
285
+ isTabletLandscape,
286
+ isRTL,
287
+ inlineAudioPlayer,
281
288
  ]
282
289
  );
283
290
 
@@ -306,7 +313,7 @@ export const AnimationView = ({
306
313
  }
307
314
 
308
315
  if (
309
- videoModalMode === "MAXIMIZED" &&
316
+ (videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
310
317
  defaultValue.x !== screenWidth &&
311
318
  width &&
312
319
  height
@@ -332,7 +339,13 @@ export const AnimationView = ({
332
339
  animatedValue.setValue(value);
333
340
  }
334
341
  }
335
- }, [videoModalState]);
342
+ }, [
343
+ animatedValue,
344
+ animationType,
345
+ getAnimationValue,
346
+ playerAnimationState,
347
+ videoModalState,
348
+ ]);
336
349
 
337
350
  React.useEffect(() => {
338
351
  if (
@@ -344,7 +357,7 @@ export const AnimationView = ({
344
357
  animatedValue,
345
358
  getAnimationValue(animationType, playerAnimationState)
346
359
  ).start();
347
- } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
360
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
348
361
  animatedValue.setValue(defaultValue);
349
362
  }
350
363
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
14
14
 
15
15
  export enum PlayerAnimationStateEnum {
16
16
  minimize = "minimize",
17
- maximaze = "maximaze",
17
+ maximize = "maximize",
18
18
  drag_player = "drag_player",
19
19
  drag_scroll = "drag_scroll",
20
20
  }
21
21
 
22
- type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
22
+ export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
23
23
 
24
24
  export type ModalAnimationContextT = {
25
25
  isActiveGesture: boolean;
@@ -137,14 +137,14 @@ const VideoModalComponent = () => {
137
137
  styles.container,
138
138
  {
139
139
  backgroundColor,
140
+ width: modalSize.width,
141
+ height: modalSize.height,
140
142
  },
141
143
  ]}
142
144
  >
143
145
  <HandlePlayable
144
146
  item={item}
145
147
  isModal={mode !== "PIP"}
146
- modalHeight={modalSize.height}
147
- modalWidth={modalSize.width}
148
148
  mode={mode}
149
149
  />
150
150
  </AnimatedPlayerModalWrapper>
@@ -8,7 +8,6 @@ import {
8
8
 
9
9
  import { Placeholder } from "./Placeholder";
10
10
  import { useInitialLoading } from "./hooks";
11
- import { useIsFocusable } from "@applicaster/zapp-react-native-utils/focusManager";
12
11
 
13
12
  type ReactComponent = React.ComponentType<any>;
14
13
 
@@ -138,12 +137,13 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
138
137
  );
139
138
 
140
139
  const componentProps = React.useMemo(
141
- () => ({ ...props, parent }),
140
+ () => ({
141
+ ...props,
142
+ parent,
143
+ }),
142
144
  [props, parent]
143
145
  );
144
146
 
145
- useIsFocusable(componentProps);
146
-
147
147
  React.useEffect(() => {
148
148
  if (!skipOnLoadFinished && !isLoading) {
149
149
  onLoadFinished();
@@ -7,17 +7,11 @@ export const withFocusableContext = (Component) => {
7
7
  { groupId, ...props }: Record<string, any>,
8
8
  ref
9
9
  ) => {
10
- return (
11
- <FocusableGroupContext.Consumer>
12
- {(groupIdContext: string) => {
13
- // eslint-disable-next-line react/display-name
14
- const propsGroupId = groupId || null;
15
- const providedGroupId = propsGroupId || groupIdContext;
10
+ const groupIdContext = React.useContext(FocusableGroupContext);
11
+ const propsGroupId = groupId || null;
12
+ const providedGroupId = propsGroupId || groupIdContext;
16
13
 
17
- return <Component {...props} groupId={providedGroupId} ref={ref} />;
18
- }}
19
- </FocusableGroupContext.Consumer>
20
- );
14
+ return <Component {...props} groupId={providedGroupId} ref={ref} />;
21
15
  };
22
16
 
23
17
  return React.forwardRef(WithFocusableContext);
@@ -13,7 +13,7 @@ type ProviderProps = {
13
13
  };
14
14
  };
15
15
 
16
- const initialHeaderOffsetContext = () => ({
16
+ const initialHeaderOffsetContext: HeaderOffsetContextType = () => ({
17
17
  headerOffset: 0,
18
18
  headersAbove: null,
19
19
  });
@@ -24,11 +24,9 @@ export const HeaderOffsetContext = React.createContext<HeaderOffsetContextType>(
24
24
 
25
25
  export function withConsumer(Component) {
26
26
  return function WithConsumer(props) {
27
- return (
28
- <HeaderOffsetContext.Consumer>
29
- {(context) => <Component getHeaderOffset={context} {...props} />}
30
- </HeaderOffsetContext.Consumer>
31
- );
27
+ const getHeaderOffset = React.useContext(HeaderOffsetContext);
28
+
29
+ return <Component getHeaderOffset={getHeaderOffset} {...props} />;
32
30
  };
33
31
  }
34
32
 
@@ -176,15 +176,8 @@ export function ScreenContextProvider({
176
176
 
177
177
  export function withScreenContext(Component: React.ComponentType<any>) {
178
178
  return function WithScreenContextWrapper(props) {
179
- return (
180
- <ScreenContext.Consumer>
181
- {useCallback(
182
- (value) => (
183
- <Component {...props} screenContext={value} />
184
- ),
185
- [Component, props]
186
- )}
187
- </ScreenContext.Consumer>
188
- );
179
+ const screenContext = React.useContext(ScreenContext);
180
+
181
+ return <Component {...props} screenContext={screenContext} />;
189
182
  };
190
183
  }
@@ -8,10 +8,11 @@ type LayoutContext = {
8
8
  componentAnchorPointY: number | null;
9
9
  componentAvailableWidth: number | null;
10
10
  setScreenLayout?: (properties: {}) => void;
11
+ resetScreenLayout?: () => void;
11
12
  extraAnchorPointYOffset: number;
12
13
  };
13
14
 
14
- const screenLayoutContext: LayoutContext = {
15
+ const initialScreenLayoutContext: LayoutContext = {
15
16
  screenMarginTop: null,
16
17
  screenMarginBottom: null,
17
18
  screenHeight: null,
@@ -21,8 +22,9 @@ const screenLayoutContext: LayoutContext = {
21
22
  extraAnchorPointYOffset: 0,
22
23
  };
23
24
 
24
- export const ScreenLayoutContext =
25
- React.createContext<LayoutContext>(screenLayoutContext);
25
+ export const ScreenLayoutContext = React.createContext<LayoutContext>(
26
+ initialScreenLayoutContext
27
+ );
26
28
 
27
29
  export function ScreenLayoutContextConsumer(Component) {
28
30
  return function WithConsumer(props) {
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
 
3
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
3
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
5
4
  import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
5
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
6
6
 
7
7
  type Props = ZappUIComponentProps & {
8
8
  rivers: ZappRivers;
@@ -12,27 +12,25 @@ type Props = ZappUIComponentProps & {
12
12
 
13
13
  export function withRiver(Component: ZappComponent): ZappComponent {
14
14
  const RiverWithData = ({ screenId, ...otherProps }: Props) => {
15
- const { rivers } = usePickFromState(["rivers"]);
15
+ const river = useRivers()?.[screenId];
16
16
  const pathname = usePathname();
17
- const river = rivers[screenId];
18
17
 
19
18
  if (!river) {
20
19
  return null;
21
20
  }
22
21
 
23
- if (!otherProps.screenData) {
24
- otherProps.screenData = river;
25
- }
26
-
27
22
  return (
28
23
  <Component
29
24
  screenId={screenId}
30
25
  river={river}
31
26
  key={isTV() ? pathname : undefined}
32
27
  {...otherProps}
28
+ screenData={otherProps.screenData || river}
33
29
  />
34
30
  );
35
31
  };
36
32
 
33
+ RiverWithData.displayName = `RiverWithData(${Component.displayName || Component.name})`;
34
+
37
35
  return RiverWithData;
38
36
  }
@@ -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.1199723621",
3
+ "version": "13.0.0-alpha.1240837114",
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.1199723621",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1199723621",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1199723621",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1199723621",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.1240837114",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1240837114",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1240837114",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1240837114",
41
38
  "promise": "^8.3.0",
42
39
  "react-router-native": "^5.1.2",
43
40
  "url": "^0.11.0",
@@ -46,7 +43,6 @@
46
43
  "peerDependencies": {
47
44
  "@applicaster/zapp-pipes-v2-client": "*",
48
45
  "@react-native-community/netinfo": "*",
49
- "@types/node": "*",
50
46
  "immer": "*",
51
47
  "react": "*",
52
48
  "react-native": "*",
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
- });