@applicaster/zapp-react-native-ui-components 13.0.2-rc.0 → 14.0.0-alpha.1174678179

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.
@@ -110,22 +110,24 @@ export function AudioPlayerTVLayout({
110
110
  ...style,
111
111
  },
112
112
  samsung_tv: {
113
+ position: "absolute",
113
114
  margin: "auto",
114
115
  display: "flex",
115
116
  flexWrap: "wrap",
117
+ height: "100vh",
116
118
  width: "100vw",
117
- flex: 1,
118
119
  alignItems: "center",
119
120
  justifyContent: "center",
120
121
  flexDirection: directionStyles(isRTL).flexDirection,
121
122
  backgroundColor: backgroundColorStyle,
122
123
  },
123
124
  lg_tv: {
125
+ position: "absolute",
124
126
  margin: "auto",
125
127
  display: "flex",
126
128
  flexWrap: "wrap",
129
+ height: "100vh",
127
130
  width: "100vw",
128
- flex: 1,
129
131
  alignItems: "center",
130
132
  justifyContent: "center",
131
133
  flexDirection: directionStyles(isRTL).flexDirection,
@@ -30,7 +30,6 @@ export const GeneralContentScreen = ({
30
30
  isScreenWrappedInContainer,
31
31
  componentsMapExtraProps = {},
32
32
  focused,
33
- extraOffset,
34
33
  parentFocus,
35
34
  containerHeight,
36
35
  preferredFocus = false,
@@ -122,7 +121,6 @@ export const GeneralContentScreen = ({
122
121
  isScreenWrappedInContainer={isScreenWrappedInContainer}
123
122
  parentFocus={parentFocus}
124
123
  focused={focused}
125
- extraOffset={extraOffset}
126
124
  containerHeight={containerHeight}
127
125
  preferredFocus={preferredFocus}
128
126
  {...componentsMapExtraProps}
@@ -52,6 +52,7 @@ const _Text = ({
52
52
  withScaledLineHeight(withFocusedStyles({ style, otherProps })),
53
53
  { height },
54
54
  ]}
55
+ allowFontScaling={false}
55
56
  {...withoutLabel(otherProps)}
56
57
  >
57
58
  {dateTransformEnabled
@@ -86,7 +86,7 @@ export function masterCellBuilder({
86
86
  entry: item,
87
87
  state: getEntryState(state, entryIsSelected),
88
88
  }),
89
- [state, item?.id, entryIsSelected] // Assuming that item won't mutate
89
+ [state, item, entryIsSelected] // Assuming that item won't mutate
90
90
  );
91
91
 
92
92
  const wrapperRef = React.useRef(null);
@@ -105,11 +105,6 @@ const isTvOS = isTvOSPlatform();
105
105
  // height for container with additional content below player
106
106
  const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
107
107
 
108
- // Default Y offset for anchor points on non-Android TV platforms
109
- const DEFAULT_OFFSET_Y = -600;
110
-
111
- const EXTRA_ANCHOR_POINT_Y_OFFSET = isAndroidTV ? 0 : DEFAULT_OFFSET_Y;
112
-
113
108
  const withBorderHack = () => {
114
109
  if (isAndroidTV) {
115
110
  /* @HACK: see GH#7269 */
@@ -721,13 +716,11 @@ const PlayerContainerComponent = (props: Props) => {
721
716
  key={item.id}
722
717
  groupId={FocusableGroupMainContainerId}
723
718
  cellTapAction={onCellTap}
724
- extraAnchorPointYOffset={
725
- EXTRA_ANCHOR_POINT_Y_OFFSET
726
- }
719
+ extraAnchorPointYOffset={0}
727
720
  isScreenWrappedInContainer={true}
728
721
  containerHeight={styles.inlineRiver.height}
729
722
  componentsMapExtraProps={{
730
- isNestedComponentsMap: R.T,
723
+ isNestedComponentsMap: true,
731
724
  }}
732
725
  />
733
726
  )}
@@ -26,7 +26,6 @@ type Props = {
26
26
  componentsMapExtraProps?: any;
27
27
  isInsideContainer?: boolean;
28
28
  extraAnchorPointYOffset: number;
29
- extraOffset: number;
30
29
  river?: ZappRiver | ZappEntry;
31
30
  };
32
31
 
@@ -39,7 +38,6 @@ export const River = (props: Props) => {
39
38
  componentsMapExtraProps,
40
39
  isInsideContainer,
41
40
  extraAnchorPointYOffset,
42
- extraOffset,
43
41
  } = props;
44
42
 
45
43
  const { title: screenTitle, summary: screenSummary } = useNavbarState();
@@ -120,7 +118,6 @@ export const River = (props: Props) => {
120
118
  <GeneralContentScreen
121
119
  feed={feedData}
122
120
  screenId={screenId}
123
- extraOffset={extraOffset}
124
121
  isScreenWrappedInContainer={isInsideContainer}
125
122
  extraAnchorPointYOffset={extraAnchorPointYOffset}
126
123
  componentsMapExtraProps={componentsMapExtraProps}
@@ -1,17 +1,17 @@
1
1
  import React from "react";
2
- import { View, ViewProps, ViewStyle } from "react-native";
2
+ import { View, ViewStyle } from "react-native";
3
3
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
4
4
  import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
6
+ import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
6
7
 
7
8
  interface IProps {
8
9
  targetScreenId?: string;
9
10
  children?: React.ReactNode;
10
11
  style?: ViewStyle;
11
- extraOffset?: number;
12
+ extraVerticalOffset: Option<number>;
12
13
  }
13
14
 
14
- type CombinedProps = IProps & ViewProps;
15
15
  /**
16
16
  * The MarginTop is essentially a feature used for managing the visibility of components on your screen.
17
17
  * A more accurate term for this might be something like a 'component visibility threshold' or 'cut-off point'.
@@ -47,7 +47,7 @@ export const useMarginTop = (targetScreenId: string): number => {
47
47
 
48
48
  // Empty string means that value is blank in the CMS. Fallback to theme
49
49
  if (String(screenData?.styles?.screen_margin_top) === "") {
50
- return Number(theme.screen_margin_top);
50
+ return toNumberWithDefault(0, theme.screen_margin_top);
51
51
  }
52
52
 
53
53
  /**
@@ -58,28 +58,29 @@ export const useMarginTop = (targetScreenId: string): number => {
58
58
  */
59
59
  if (screenData?.styles?.screen_margin_top === undefined) {
60
60
  if (isGeneralContentScreen || supportsUiComponents) {
61
- return Number(theme.screen_margin_top);
61
+ return toNumberWithDefault(0, theme.screen_margin_top);
62
62
  }
63
63
 
64
64
  return 0;
65
65
  }
66
66
 
67
- return Number(screenData?.styles?.screen_margin_top);
67
+ return toNumberWithDefault(0, screenData?.styles?.screen_margin_top);
68
68
  };
69
69
 
70
- export const TopMarginApplicator: React.FC<CombinedProps> = (
71
- props: CombinedProps
72
- ) => {
73
- const extraOffset = props?.extraOffset ?? 0;
70
+ export const TopMarginApplicator: React.FC<IProps> = ({
71
+ targetScreenId,
72
+ style,
73
+ children,
74
+ extraVerticalOffset,
75
+ }: IProps) => {
76
+ const extraOffset = toNumberWithDefault(0, extraVerticalOffset);
74
77
 
75
78
  // HACK: Remove extraOffset when focusIssue with absolute elements is fixed on tvos
76
- const marginTop = useMarginTop(props.targetScreenId) + extraOffset;
77
- const style = { ...((props.style as {}) || {}), marginTop };
79
+ const marginTop = useMarginTop(targetScreenId);
78
80
 
79
- // Then, spread the rest of the props on your returned JSX.
80
81
  return (
81
- <View {...props} style={style}>
82
- {props.children}
82
+ <View style={[style, { marginTop: marginTop + extraOffset }]}>
83
+ {children}
83
84
  </View>
84
85
  );
85
86
  };
package/index.d.ts CHANGED
@@ -24,7 +24,6 @@ type GeneralContentScreenProps = {
24
24
  } & Record<string, any>;
25
25
  focused?: boolean;
26
26
  parentFocus?: ParentFocus;
27
- extraOffset?: number;
28
27
  containerHeight?: number;
29
28
  };
30
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.2-rc.0",
3
+ "version": "14.0.0-alpha.1174678179",
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",
@@ -31,12 +31,11 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.2-rc.0",
35
- "@applicaster/zapp-react-native-bridge": "13.0.2-rc.0",
36
- "@applicaster/zapp-react-native-redux": "13.0.2-rc.0",
37
- "@applicaster/zapp-react-native-utils": "13.0.2-rc.0",
34
+ "@applicaster/applicaster-types": "14.0.0-alpha.1174678179",
35
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.1174678179",
36
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.1174678179",
37
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.1174678179",
38
38
  "promise": "^8.3.0",
39
- "react-router-native": "^5.1.2",
40
39
  "url": "^0.11.0",
41
40
  "uuid": "^3.3.2"
42
41
  },
@@ -1,11 +0,0 @@
1
- import React from "react";
2
-
3
- const reactRouter = jest.genMockFromModule("react-router-native");
4
-
5
- function withRouter(Component) {
6
- return (props) => <Component {...props} />; // eslint-disable-line react/display-name
7
- }
8
-
9
- reactRouter.withRouter = withRouter;
10
-
11
- module.exports = reactRouter;