@applicaster/zapp-react-native-ui-components 15.0.0-alpha.1283350001 → 15.0.0-alpha.1305114721
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.
- package/Components/Cell/TvOSCellComponent.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/model.test.ts +80 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +187 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/selectors.test.ts +45 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/style.test.ts +49 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/model.ts +47 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +170 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/selectors.ts +26 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/style.ts +29 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/types.ts +37 -0
- package/Components/MasterCell/DefaultComponents/Button.tsx +0 -15
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +196 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +2 -6
- package/Components/MasterCell/DefaultComponents/index.ts +2 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Asset.ts +46 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +126 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ButtonContainerView.ts +23 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +16 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabel.ts +67 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +32 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +191 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/builders.test.ts +140 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +222 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/helpers.ts +105 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +104 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +118 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +73 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/index.test.ts +86 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +35 -52
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +35 -171
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +36 -145
- package/Components/MasterCell/elementMapper.tsx +1 -0
- package/Components/River/RefreshControl.tsx +30 -13
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +60 -4
- package/Components/default-cell-renderer/viewTrees/mobile/index.ts +0 -3
- package/package.json +5 -5
- package/Components/MasterCell/DefaultComponents/Text/utils/__tests__/withAdjustedLineHeight.test.ts +0 -46
- package/Components/MasterCell/DefaultComponents/Text/utils/index.ts +0 -21
- package/Components/TopMarginApplicator/TopMarginApplicator.ios.tsx +0 -52
- package/Components/TopMarginApplicator/index.tsx +0 -68
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DefaultCell } from "./DefaultCell";
|
|
2
2
|
import { GridCell } from "./GridCell";
|
|
3
3
|
import { HeroCell } from "./HeroCell";
|
|
4
|
-
// import { ScreenSelectorLabel } from "./ScreenSelectorLabel";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Return a view tree ready to be injected with styles etc. Mapping is done
|
|
@@ -15,8 +14,6 @@ export function viewTreeResolver({ component_type }) {
|
|
|
15
14
|
switch (component_type) {
|
|
16
15
|
case "hero":
|
|
17
16
|
return HeroCell;
|
|
18
|
-
// case "screen_picker":
|
|
19
|
-
// return ScreenSelectorLabel;
|
|
20
17
|
case "grid":
|
|
21
18
|
return GridCell;
|
|
22
19
|
case "horizontal_list":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.1305114721",
|
|
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",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.1305114721",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.1305114721",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.1305114721",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.1305114721",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|
package/Components/MasterCell/DefaultComponents/Text/utils/__tests__/withAdjustedLineHeight.test.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { PixelRatio } from "react-native";
|
|
2
|
-
import { withAdjustedLineHeight } from "..";
|
|
3
|
-
|
|
4
|
-
const FONT_SCALE = 1.118;
|
|
5
|
-
jest.spyOn(PixelRatio, "getFontScale").mockReturnValue(FONT_SCALE);
|
|
6
|
-
|
|
7
|
-
describe("withAdjustedLineHeight", () => {
|
|
8
|
-
it("with provided fontScale and styles", () => {
|
|
9
|
-
// setup
|
|
10
|
-
const styles = {
|
|
11
|
-
lineHeight: 10,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// run
|
|
15
|
-
const result = withAdjustedLineHeight(styles);
|
|
16
|
-
|
|
17
|
-
// verify
|
|
18
|
-
expect(result).toEqual({
|
|
19
|
-
lineHeight: styles.lineHeight * FONT_SCALE,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("with provided fontScale and empty styles", () => {
|
|
24
|
-
// setup
|
|
25
|
-
const styles = {};
|
|
26
|
-
|
|
27
|
-
// run
|
|
28
|
-
const result = withAdjustedLineHeight(styles);
|
|
29
|
-
|
|
30
|
-
// verify
|
|
31
|
-
expect(result).toEqual(styles);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("with non-number lineHeight", () => {
|
|
35
|
-
// setup
|
|
36
|
-
const styles = {
|
|
37
|
-
lineHeight: NaN,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// run
|
|
41
|
-
const result = withAdjustedLineHeight(styles);
|
|
42
|
-
|
|
43
|
-
// verify
|
|
44
|
-
expect(result).toEqual(styles);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PixelRatio } from "react-native";
|
|
2
|
-
import { isNil, identity } from "ramda";
|
|
3
|
-
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
-
|
|
6
|
-
// HACK - to prevent text flickering
|
|
7
|
-
export const withAdjustedLineHeight = (styles) => {
|
|
8
|
-
const fontScale = PixelRatio.getFontScale();
|
|
9
|
-
const lineHeight = toNumber(styles.lineHeight);
|
|
10
|
-
|
|
11
|
-
if (isNil(lineHeight)) {
|
|
12
|
-
return styles;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return { ...styles, lineHeight: lineHeight * fontScale };
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const withScaledLineHeight = platformSelect({
|
|
19
|
-
ios: withAdjustedLineHeight,
|
|
20
|
-
default: identity,
|
|
21
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
4
|
-
|
|
5
|
-
import { useMarginTop } from "./index";
|
|
6
|
-
|
|
7
|
-
interface IProps {
|
|
8
|
-
targetScreenId?: string;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
applyTopCuttoff?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const styles = StyleSheet.create({
|
|
14
|
-
container: {
|
|
15
|
-
flex: 1,
|
|
16
|
-
minHeight: 1,
|
|
17
|
-
minWidth: "100%",
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const TopMarginApplicator: React.FC<IProps> = ({
|
|
22
|
-
targetScreenId,
|
|
23
|
-
children,
|
|
24
|
-
applyTopCuttoff = true,
|
|
25
|
-
}: IProps) => {
|
|
26
|
-
const cutoffHeight = useMarginTop(targetScreenId);
|
|
27
|
-
|
|
28
|
-
const theme = useTheme();
|
|
29
|
-
const backgroundColor = theme.app_background_color;
|
|
30
|
-
|
|
31
|
-
if (!applyTopCuttoff) {
|
|
32
|
-
return children;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<View style={styles.container}>
|
|
37
|
-
{children}
|
|
38
|
-
|
|
39
|
-
<View
|
|
40
|
-
style={{
|
|
41
|
-
position: "absolute",
|
|
42
|
-
top: 0,
|
|
43
|
-
left: 0,
|
|
44
|
-
right: 0,
|
|
45
|
-
height: cutoffHeight,
|
|
46
|
-
|
|
47
|
-
backgroundColor,
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
2
|
-
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
3
|
-
import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
4
|
-
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
5
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
6
|
-
|
|
7
|
-
import { TopMarginApplicator as TopMarginApplicator_tvos } from "./TopMarginApplicator.ios";
|
|
8
|
-
import { TopMarginApplicator as TopMarginApplicator_default } from "./TopMarginApplicator";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The MarginTop is essentially a feature used for managing the visibility of components on your screen.
|
|
12
|
-
* A more accurate term for this might be something like a 'component visibility threshold' or 'cut-off point'.
|
|
13
|
-
* In practical terms, MarginTop determines a specific vertical position (given in the 'y' coordinate)
|
|
14
|
-
* on your screen above which components aren't shown.
|
|
15
|
-
* You might visualize this as a horizontal line across your screen, and any component crossing this line becomes invisible.
|
|
16
|
-
*
|
|
17
|
-
* Classic use case for this feature is making sure that component aren't displayed underneath the navigation bar.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export const useMarginTop = (targetScreenId: string): number => {
|
|
21
|
-
const theme = useTheme<BaseThemePropertiesTV>();
|
|
22
|
-
const screenData = useCurrentScreenData(targetScreenId);
|
|
23
|
-
const isGeneralContentScreen = screenData?.plugin_type === "general_content";
|
|
24
|
-
const supportsUiComponents = screenData?.ui_components;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* ScreenPicker is a component but should really be a screen.
|
|
28
|
-
* We need to skip margin top for it as it's already applied to the target screen
|
|
29
|
-
**/
|
|
30
|
-
|
|
31
|
-
// ignore margin on screenPicker
|
|
32
|
-
if (isFirstComponentScreenPicker(screenData?.ui_components)) {
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const isPlayer = screenData?.plugin_type === "player";
|
|
37
|
-
|
|
38
|
-
// ignore margin on inlinePlayer (remove if better way of identifying cases for plugins that don't have marginTop)
|
|
39
|
-
if (isPlayer) {
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Empty string means that value is blank in the CMS. Fallback to theme
|
|
44
|
-
if (String(screenData?.styles?.screen_margin_top) === "") {
|
|
45
|
-
return toNumberWithDefaultZero(theme.screen_margin_top);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* If value is undefined it means one of three things
|
|
50
|
-
* 1. Screen is not a general content screen and it doesn't handle ui components (return 0)
|
|
51
|
-
* 2. Screen is a general content screen but it doesn't have a margin top value (return theme value)
|
|
52
|
-
* 3. Screen isn't general content screen but it handles the ui components (return theme value)
|
|
53
|
-
*/
|
|
54
|
-
if (screenData?.styles?.screen_margin_top === undefined) {
|
|
55
|
-
if (isGeneralContentScreen || supportsUiComponents) {
|
|
56
|
-
return toNumberWithDefaultZero(theme.screen_margin_top);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return toNumberWithDefaultZero(screenData?.styles?.screen_margin_top);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const TopMarginApplicator = platformSelect({
|
|
66
|
-
tvos: TopMarginApplicator_tvos,
|
|
67
|
-
default: TopMarginApplicator_default,
|
|
68
|
-
});
|