@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4433422595 → 12.0.0-alpha.4757075613
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/BaseFocusable/index.tsx +1 -1
- package/Components/Cell/Cell.tsx +1 -5
- package/Components/FocusableGroup/index.tsx +0 -1
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/index.tsx +25 -116
- package/Components/MasterCell/utils/index.ts +1 -1
- package/package.json +5 -5
- package/Components/Screen/TV/index.web.tsx +0 -88
|
@@ -73,7 +73,7 @@ export class BaseFocusable<
|
|
|
73
73
|
getId(props?: { id: string; groupId: string }) {
|
|
74
74
|
const { id, groupId = null } = props || this.props;
|
|
75
75
|
|
|
76
|
-
return groupId ?
|
|
76
|
+
return groupId ? `${groupId}-${id}` : id;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
getRect() {
|
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -207,11 +207,7 @@ export class CellComponent extends React.Component<Props> {
|
|
|
207
207
|
|
|
208
208
|
const { id } = item;
|
|
209
209
|
|
|
210
|
-
const focusableId = R.join("-", [
|
|
211
|
-
`componentId:${component?.id}`,
|
|
212
|
-
`id:${id}`,
|
|
213
|
-
`index:${index}`,
|
|
214
|
-
]);
|
|
210
|
+
const focusableId = R.join("-", [component?.id, id, index]);
|
|
215
211
|
|
|
216
212
|
const handleFocus = (focusable, mouse) => {
|
|
217
213
|
const focusFn = onFocus || noop;
|
|
@@ -60,7 +60,7 @@ export function ScreenLayoutContextProvider(props: {
|
|
|
60
60
|
initialState
|
|
61
61
|
);
|
|
62
62
|
|
|
63
|
-
const
|
|
63
|
+
const screeenLayoutValue = React.useMemo(
|
|
64
64
|
() => ({
|
|
65
65
|
...screenLayout,
|
|
66
66
|
setScreenLayout,
|
|
@@ -69,7 +69,7 @@ export function ScreenLayoutContextProvider(props: {
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
|
-
<ScreenLayoutContext.Provider value={
|
|
72
|
+
<ScreenLayoutContext.Provider value={screeenLayoutValue}>
|
|
73
73
|
{props.children}
|
|
74
74
|
</ScreenLayoutContext.Provider>
|
|
75
75
|
);
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { View, StyleSheet } from "react-native";
|
|
4
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
6
5
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
|
-
import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
8
|
-
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
9
6
|
|
|
10
7
|
import {
|
|
11
8
|
getNavigationProps,
|
|
12
|
-
getPathAttributes,
|
|
13
9
|
resolveNavigationPlugin,
|
|
14
10
|
routeIsPlayerScreen,
|
|
15
11
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
@@ -21,23 +17,9 @@ import { ScreenContainer } from "./ScreenContainer";
|
|
|
21
17
|
import { TransitionOverlay } from "./TransitionOverlay";
|
|
22
18
|
|
|
23
19
|
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
20
|
+
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
24
21
|
import { PathnameContext } from "../../../Contexts/PathnameContext";
|
|
25
|
-
|
|
26
|
-
import { FocusableGroup } from "../../FocusableGroup";
|
|
27
|
-
import { Screen } from "../../Screen/TV/index.web";
|
|
28
|
-
|
|
29
|
-
const styles = StyleSheet.create({
|
|
30
|
-
container: {
|
|
31
|
-
position: "absolute",
|
|
32
|
-
width: 1920,
|
|
33
|
-
height: 1080,
|
|
34
|
-
backgroundColor: "black",
|
|
35
|
-
// opacity: 0.5,
|
|
36
|
-
|
|
37
|
-
borderWidth: 4,
|
|
38
|
-
borderColor: "magenta",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
22
|
+
import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
41
23
|
|
|
42
24
|
type Components = {
|
|
43
25
|
NavBar: React.ComponentType<any>;
|
|
@@ -45,65 +27,16 @@ type Components = {
|
|
|
45
27
|
};
|
|
46
28
|
|
|
47
29
|
type ComponentsExtraProps = {
|
|
48
|
-
NavBar?: Record<string, any>;
|
|
49
30
|
Background?: Record<string, any>;
|
|
31
|
+
NavBar?: Record<string, any>;
|
|
50
32
|
};
|
|
51
33
|
|
|
52
34
|
type Props = {
|
|
53
35
|
Components: Components;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const StackNavigator = ({ Components }: Props) => {
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
const { mainStack, currentRoute } = useNavigation();
|
|
60
|
-
|
|
61
|
-
console.log("DEBUG", { mainStack });
|
|
62
|
-
|
|
63
|
-
const renderScreen = ({ route, action, key, state }) => {
|
|
64
|
-
const pathAttributes = getPathAttributes({ pathname: route });
|
|
65
|
-
|
|
66
|
-
if (R.isEmpty(pathAttributes)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
console.log("SCENE:", { route, state, key, action });
|
|
71
|
-
|
|
72
|
-
const id = `${route}`;
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<FocusableGroup
|
|
76
|
-
id={id}
|
|
77
|
-
preferredFocus={route === currentRoute}
|
|
78
|
-
excludeFromFocusSearching
|
|
79
|
-
key={id}
|
|
80
|
-
>
|
|
81
|
-
<View style={styles.container}>
|
|
82
|
-
<PathnameContext.Provider value={route}>
|
|
83
|
-
<Screen route={route} Components={Components} />
|
|
84
|
-
</PathnameContext.Provider>
|
|
85
|
-
</View>
|
|
86
|
-
</FocusableGroup>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return mainStack.map(renderScreen);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const TransitionerTV = ({ componentsExtraProps, Components }: Props) => {
|
|
94
|
-
return (
|
|
95
|
-
<>
|
|
96
|
-
<ScreenLayoutContextProvider>
|
|
97
|
-
<StackNavigator
|
|
98
|
-
componentsExtraProps={componentsExtraProps}
|
|
99
|
-
Components={Components}
|
|
100
|
-
/>
|
|
101
|
-
</ScreenLayoutContextProvider>
|
|
102
|
-
</>
|
|
103
|
-
);
|
|
36
|
+
ComponentsExtraProps?: ComponentsExtraProps;
|
|
37
|
+
children: React.ReactNode;
|
|
104
38
|
};
|
|
105
39
|
|
|
106
|
-
// @ts-ignore
|
|
107
40
|
const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
108
41
|
const navigator = useNavigation();
|
|
109
42
|
const theme = useTheme();
|
|
@@ -164,57 +97,33 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
164
97
|
return null;
|
|
165
98
|
}
|
|
166
99
|
|
|
167
|
-
console.log("DEBUG", "TV Layout");
|
|
168
|
-
|
|
169
100
|
return (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
{...R.omit(["ref"])(ComponentsExtraProps?.Background)}
|
|
181
|
-
>
|
|
182
|
-
{!isTVOS ? navBarContainer : null}
|
|
183
|
-
{navBarReady ? (
|
|
184
|
-
/**
|
|
101
|
+
<LayoutContainer>
|
|
102
|
+
<ScreenLayoutContextProvider>
|
|
103
|
+
<Components.Background
|
|
104
|
+
backgroundColor={backgroundColor}
|
|
105
|
+
backgroundImageUrl={backgroundImageUrl}
|
|
106
|
+
{...R.omit(["ref"])(ComponentsExtraProps?.Background)}
|
|
107
|
+
>
|
|
108
|
+
{!isTVOS ? navBarContainer : null}
|
|
109
|
+
{navBarReady ? (
|
|
110
|
+
/**
|
|
185
111
|
Need to re-mount this component on each navigation event
|
|
186
112
|
It's a hack to work around the fact that we don't support
|
|
187
113
|
correct screen rendering in our navigator (shared currentRoute state)
|
|
188
114
|
**/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
115
|
+
<PathnameContext.Provider value={navigator.currentRoute}>
|
|
116
|
+
<ScreenContainer>{children}</ScreenContainer>
|
|
117
|
+
</PathnameContext.Provider>
|
|
118
|
+
) : null}
|
|
119
|
+
{/** Render NavBarContainer over ScreenContainer to let tvOS native
|
|
194
120
|
focus manager works correctly to focus nav bar items first **/}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
</TransitionerTV>
|
|
121
|
+
{isTVOS ? navBarContainer : null}
|
|
122
|
+
<TransitionOverlay />
|
|
123
|
+
</Components.Background>
|
|
124
|
+
</ScreenLayoutContextProvider>
|
|
125
|
+
</LayoutContainer>
|
|
201
126
|
);
|
|
202
127
|
};
|
|
203
128
|
|
|
204
129
|
export default Layout;
|
|
205
|
-
|
|
206
|
-
/// Transitioner:
|
|
207
|
-
/*
|
|
208
|
-
Component: Transitioner
|
|
209
|
-
Responsibilities:
|
|
210
|
-
- Transitione between screens.
|
|
211
|
-
Tehere is no transition on Tv so no need for transitioner.
|
|
212
|
-
|
|
213
|
-
Component: StackNavigator
|
|
214
|
-
Responsibilities:
|
|
215
|
-
- Render the screens in the stack.
|
|
216
|
-
- Render the NavBar? I guess navbar should be part of the screen
|
|
217
|
-
- Render the screen.
|
|
218
|
-
|
|
219
|
-
Q
|
|
220
|
-
*/
|
|
@@ -127,7 +127,7 @@ export const useFilterChildren = <
|
|
|
127
127
|
const item = child.props.item;
|
|
128
128
|
const action = actions.actions[child.props.pluginIdentifier];
|
|
129
129
|
// context value of specific plugin
|
|
130
|
-
const currentValue = action
|
|
130
|
+
const currentValue = action?.module?.context?._currentValue;
|
|
131
131
|
|
|
132
132
|
return currentValue?.isActionAvailable
|
|
133
133
|
? currentValue.isActionAvailable(item)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.4757075613",
|
|
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",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.4757075613",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4757075613",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.4757075613",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4757075613",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { last, pathOr } from "ramda";
|
|
3
|
-
import { ScreenResolver } from "../../ScreenResolver";
|
|
4
|
-
import {
|
|
5
|
-
getNavigationProps,
|
|
6
|
-
getPathAttributes,
|
|
7
|
-
resolveNavigationPlugin,
|
|
8
|
-
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
9
|
-
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
10
|
-
import { NavBarContainer } from "../../Layout/TV/NavBarContainer";
|
|
11
|
-
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
12
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
13
|
-
|
|
14
|
-
type Components = {
|
|
15
|
-
NavBar: React.ComponentType<any>;
|
|
16
|
-
Background: React.ComponentType<any>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type Props = {
|
|
20
|
-
route: string;
|
|
21
|
-
Components: Components;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const isPlayer = (routeState): boolean => {
|
|
25
|
-
const pluginType = pathOr(
|
|
26
|
-
"unknown_plugin_type",
|
|
27
|
-
["state", "screen", "plugin_type"],
|
|
28
|
-
routeState
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return pluginType === "player";
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Screen = (props: Props) => {
|
|
35
|
-
if (!props.route) {
|
|
36
|
-
throw new Error("Required props route is missing");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const { getStackForPathname } = useNavigation();
|
|
40
|
-
const { plugins = [] } = usePickFromState(["plugins"]);
|
|
41
|
-
|
|
42
|
-
const pathAttributes = getPathAttributes({ pathname: props.route });
|
|
43
|
-
const routeState = getStackForPathname(props.route);
|
|
44
|
-
|
|
45
|
-
console.log("debug_2", "Screen", { routeState, route: props.route });
|
|
46
|
-
|
|
47
|
-
const { screenType, screenId } = last(pathAttributes);
|
|
48
|
-
|
|
49
|
-
const navigationProps = getNavigationProps({
|
|
50
|
-
navigator: {
|
|
51
|
-
activeRiver: routeState.state.screen,
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
screenTitle: routeState.state.entry?.title || routeState.screen?.name,
|
|
54
|
-
},
|
|
55
|
-
category: "menu",
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const menuPlugin = resolveNavigationPlugin({
|
|
59
|
-
category: "menu",
|
|
60
|
-
navigations: routeState.state.screen?.navigations,
|
|
61
|
-
plugins,
|
|
62
|
-
}) as QuickBrickPlugin;
|
|
63
|
-
|
|
64
|
-
const NavBar = (props.Components.NavBar ||
|
|
65
|
-
menuPlugin.module) as React.ComponentType<any>;
|
|
66
|
-
|
|
67
|
-
const isNavBarVisible = !isPlayer(routeState);
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<>
|
|
71
|
-
<NavBarContainer isVisible={isNavBarVisible} onReady={noop}>
|
|
72
|
-
<NavBar
|
|
73
|
-
groupId={props.route}
|
|
74
|
-
isVisible={isNavBarVisible}
|
|
75
|
-
menuPlugin={menuPlugin}
|
|
76
|
-
navigationProps={navigationProps}
|
|
77
|
-
// Maybe activeRiver?
|
|
78
|
-
/>
|
|
79
|
-
</NavBarContainer>
|
|
80
|
-
<ScreenResolver
|
|
81
|
-
screenType={screenType}
|
|
82
|
-
screenId={screenId}
|
|
83
|
-
screenData={routeState?.state?.screen}
|
|
84
|
-
groupId={props.route}
|
|
85
|
-
/>
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
};
|