@applicaster/zapp-react-native-ui-components 13.0.0-alpha.7223526501 → 13.0.0-alpha.7586259907

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 (54) hide show
  1. package/Components/AnimatedInOut/index.tsx +3 -5
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  3. package/Components/AudioPlayer/helpers.tsx +1 -0
  4. package/Components/Cell/Cell.tsx +3 -13
  5. package/Components/Cell/CellWithFocusable.tsx +18 -14
  6. package/Components/Cell/CellWrapper.ts +5 -0
  7. package/Components/Cell/styles.ts +17 -0
  8. package/Components/ErrorScreen/index.tsx +8 -0
  9. package/Components/FocusableCell/index.tsx +1 -1
  10. package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
  11. package/Components/FocusableGroup/index.tsx +0 -1
  12. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  13. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  14. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  15. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  16. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  17. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  18. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  19. package/Components/MasterCell/utils/index.ts +8 -134
  20. package/Components/ModalComponent/Button/assets.ts +1 -1
  21. package/Components/OfflineHandler/utils/index.ts +1 -1
  22. package/Components/PlayerContainer/PlayerContainer.tsx +17 -6
  23. package/Components/PlayerImageBackground/index.tsx +4 -24
  24. package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -0
  25. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  26. package/Components/Screen/TV/index.web.tsx +5 -6
  27. package/Components/Screen/hooks.ts +3 -6
  28. package/Components/TrackedView/index.tsx +1 -0
  29. package/Components/Transitioner/AnimationManager.js +15 -15
  30. package/Components/VideoLive/PlayerLiveImageComponent.tsx +4 -0
  31. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  32. package/Components/VideoLive/animationUtils.ts +4 -7
  33. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  34. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +33 -19
  35. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  36. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +17 -4
  37. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
  38. package/Components/VideoModal/PlayerWrapper.tsx +26 -3
  39. package/Components/VideoModal/VideoModal.tsx +19 -4
  40. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  41. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  42. package/Contexts/ScreenContext/index.tsx +3 -10
  43. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  44. package/Decorators/RiverResolver/index.tsx +5 -7
  45. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  46. package/package.json +5 -9
  47. package/tsconfig.json +2 -3
  48. package/.babelrc +0 -8
  49. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  50. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  51. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  52. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  53. package/Components/Cell/CellStyles/colors.js +0 -40
  54. package/Components/Cell/CellStyles/index.js +0 -15
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
50
50
 
51
51
  const isNotMinimizeMaximazeAnimation =
52
52
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
53
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
53
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
54
54
 
55
55
  const isEnablePanGesture =
56
56
  !isLanguageOverlayVisible &&
@@ -89,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
89
89
  setLastSnap(destSnapPoint);
90
90
 
91
91
  if (destSnapPoint === modalSnapPoints[0]) {
92
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
92
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
93
93
  } else {
94
94
  lastScrollY.setValue(0);
95
95
  lastScrollYValue.current = 0;
@@ -105,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
105
105
  modalSnapPoints[1] - preparedTranslationY
106
106
  );
107
107
 
108
- setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
108
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
109
109
  } else {
110
110
  resetPlayerAnimationState();
111
111
  }
@@ -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;
@@ -100,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
100
100
  return ["top"];
101
101
  };
102
102
 
103
+ const isPercentage = (value: string | number): boolean => {
104
+ if (typeof value === "string") {
105
+ return value.includes("%");
106
+ }
107
+
108
+ return false;
109
+ };
110
+
111
+ const getPercentageOf = (percent: string, value: number) => {
112
+ const percentageValue = parseFloat(percent.replace("%", ""));
113
+
114
+ if (isNaN(percentageValue)) {
115
+ return value;
116
+ }
117
+
118
+ return (value * percentageValue) / 100;
119
+ };
120
+
103
121
  const getTabletWidth = (
104
122
  configuration: Configuration,
105
123
  dimensions: DimensionsT
@@ -108,18 +126,23 @@ const getTabletWidth = (
108
126
  configuration?.tablet_landscape_sidebar_width;
109
127
 
110
128
  const { width } = dimensions;
129
+ let widthValue = Number(width);
130
+
131
+ if (isPercentage(width)) {
132
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
133
+ }
111
134
 
112
135
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
113
136
 
114
137
  if (tablet_landscape_sidebar_width?.includes("%")) {
115
- return Number(width) * (1 - sidebarWidth / 100);
138
+ return widthValue * (1 - sidebarWidth / 100);
116
139
  }
117
140
 
118
141
  if (Number.isNaN(sidebarWidth)) {
119
- return Number(width) * 0.65;
142
+ return widthValue * 0.65;
120
143
  }
121
144
 
122
- return Number(width) - sidebarWidth;
145
+ return widthValue - sidebarWidth;
123
146
  };
124
147
 
125
148
  const PlayerWrapperComponent = (props: Props) => {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { equals } from "ramda";
3
- import { StyleSheet, StatusBar } from "react-native";
3
+ import { StyleSheet, StatusBar, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
30
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
31
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { Spinner } from "../Spinner";
33
34
  import { OpaqueLayer } from "./OpaqueLayer";
34
35
 
35
36
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
36
37
 
38
+ const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
39
+
37
40
  const styles = StyleSheet.create({
38
41
  container: {
39
42
  top: 0,
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
42
45
  bottom: 0,
43
46
  position: "absolute",
44
47
  },
48
+ loaderContainer: {
49
+ top: 0,
50
+ left: 0,
51
+ right: 0,
52
+ bottom: 0,
53
+ position: "absolute",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ backgroundColor: LOADER_BACKGROUND_COLOR,
57
+ },
45
58
  });
46
59
 
47
60
  const VideoModalComponent = () => {
@@ -131,7 +144,7 @@ const VideoModalComponent = () => {
131
144
  {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
145
  {mode === "FULLSCREEN" && <OpaqueLayer />}
133
146
 
134
- {itemIdHooksFinished === item?.id && (
147
+ {itemIdHooksFinished === item?.id ? (
135
148
  <AnimatedPlayerModalWrapper
136
149
  style={[
137
150
  styles.container,
@@ -143,11 +156,13 @@ const VideoModalComponent = () => {
143
156
  <HandlePlayable
144
157
  item={item}
145
158
  isModal={mode !== "PIP"}
146
- modalHeight={modalSize.height}
147
- modalWidth={modalSize.width}
148
159
  mode={mode}
149
160
  />
150
161
  </AnimatedPlayerModalWrapper>
162
+ ) : (
163
+ <View style={styles.loaderContainer}>
164
+ <Spinner />
165
+ </View>
151
166
  )}
152
167
  </ScreenContextProvider>
153
168
  </PathnameContext.Provider>
@@ -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.7223526501",
3
+ "version": "13.0.0-alpha.7586259907",
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.7223526501",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.7223526501",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.7223526501",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.7223526501",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.7586259907",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.7586259907",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.7586259907",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.7586259907",
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
- });