@applicaster/zapp-react-native-ui-components 11.0.0-rc.99 → 12.0.0-alpha.5035843303
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.ios.ts +1 -1
- package/Components/Cell/Cell.tsx +5 -13
- package/Components/Cell/{CellWithFocusable.js → CellWithFocusable.tsx} +32 -18
- package/Components/Cell/TvOSCellComponent.tsx +9 -12
- package/Components/FastImage/index.ios.js +3 -0
- package/Components/Focusable/FocusableTvOS.tsx +4 -1
- package/Components/FocusableCell/{index.js → index.tsx} +8 -5
- package/Components/FocusableGroup/FocusableTvOS.tsx +2 -2
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +13 -8
- package/Components/HandlePlayable/HandlePlayable.tsx +2 -2
- package/Components/HookRenderer/HookRenderer.tsx +9 -6
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/Layout/TV/index.tsx +9 -13
- package/Components/Layout/index.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +3 -1
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +22 -19
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +1 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +2 -0
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/CollapsibleTextContainer.tsx +9 -3
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +7 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +12 -4
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +23 -9
- package/Components/MasterCell/hoc/withAsyncRender.tsx +8 -4
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +12 -6
- package/Components/MasterCell/hooks/useAsyncRendering/__tests__/MasterCellAsyncRenderManager.test.ts +21 -0
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +15 -13
- package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
- package/Components/MasterCell/utils/index.ts +143 -19
- package/Components/PlayerContainer/PlayerContainer.tsx +10 -6
- package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
- package/Components/River/River.tsx +3 -4
- package/Components/River/TV/River.tsx +9 -4
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -0
- package/Components/River/index.tsx +3 -1
- package/Components/Screen/__tests__/Screen.test.tsx +6 -3
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -0
- package/Components/Screen/index.tsx +12 -44
- package/Components/Screen/navigationHandler.ts +1 -1
- package/Components/Spinner/SpinnerComponent.tsx +6 -2
- package/Components/VideoLive/LiveImageManager.ts +62 -3
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +23 -1
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +74 -0
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +47 -0
- package/Components/VideoLive/__tests__/utils.test.ts +109 -0
- package/Components/VideoLive/utils.ts +40 -0
- package/Components/VideoModal/PlayerDetails.tsx +42 -6
- package/Components/VideoModal/PlayerWrapper.tsx +32 -29
- package/Components/VideoModal/VideoModal.tsx +20 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +21 -9
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +14 -24
- package/Contexts/InteractionManagerContext/index.ts +0 -2
- package/Contexts/ScreenContext/index.tsx +118 -0
- package/package.json +5 -5
|
@@ -9,7 +9,7 @@ import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
|
9
9
|
type Props = {
|
|
10
10
|
initialFocus?: boolean;
|
|
11
11
|
id: string;
|
|
12
|
-
groupId
|
|
12
|
+
groupId: string;
|
|
13
13
|
preferredFocus?: boolean;
|
|
14
14
|
onRegister?: (focusable: FocusManager.TouchableRef) => void;
|
|
15
15
|
onUnregister?: (focusable: FocusManager.TouchableRef) => void;
|
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -11,7 +11,6 @@ import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
|
11
11
|
|
|
12
12
|
import { CellWithFocusable } from "./CellWithFocusable";
|
|
13
13
|
import { BaseFocusable } from "../BaseFocusable";
|
|
14
|
-
import { getCellState } from "./utils";
|
|
15
14
|
|
|
16
15
|
type Props = {
|
|
17
16
|
item: {
|
|
@@ -32,7 +31,7 @@ type Props = {
|
|
|
32
31
|
component: {
|
|
33
32
|
id: string;
|
|
34
33
|
};
|
|
35
|
-
selected
|
|
34
|
+
selected?: boolean;
|
|
36
35
|
CellRenderer: React.ComponentType<{
|
|
37
36
|
item: any;
|
|
38
37
|
state: string;
|
|
@@ -64,6 +63,7 @@ type Props = {
|
|
|
64
63
|
isFocusable: boolean;
|
|
65
64
|
skipFocusManagerRegistration?: boolean;
|
|
66
65
|
shouldUpdate: boolean;
|
|
66
|
+
behavior: Behavior;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const baseCellStyles = {
|
|
@@ -80,7 +80,6 @@ const touchableStyles = {
|
|
|
80
80
|
export class CellComponent extends React.Component<Props> {
|
|
81
81
|
constructor(props) {
|
|
82
82
|
super(props);
|
|
83
|
-
|
|
84
83
|
this.onPress = this.onPress.bind(this);
|
|
85
84
|
this.onFocus = this.onFocus.bind(this);
|
|
86
85
|
this.onBlur = this.onBlur.bind(this);
|
|
@@ -182,14 +181,6 @@ export class CellComponent extends React.Component<Props> {
|
|
|
182
181
|
};
|
|
183
182
|
}
|
|
184
183
|
|
|
185
|
-
getCellState(_focused) {
|
|
186
|
-
const { selected } = this.props;
|
|
187
|
-
|
|
188
|
-
const focused = this.props.focused || _focused;
|
|
189
|
-
|
|
190
|
-
return getCellState({ focused, selected });
|
|
191
|
-
}
|
|
192
|
-
|
|
193
184
|
isCellFocused(focusableFocused) {
|
|
194
185
|
const { focused, isFocusable = true } = this.props;
|
|
195
186
|
|
|
@@ -211,6 +202,7 @@ export class CellComponent extends React.Component<Props> {
|
|
|
211
202
|
groupId,
|
|
212
203
|
isFocusable = true,
|
|
213
204
|
skipFocusManagerRegistration,
|
|
205
|
+
behavior
|
|
214
206
|
} = this.props;
|
|
215
207
|
|
|
216
208
|
const { id } = item;
|
|
@@ -220,7 +212,6 @@ export class CellComponent extends React.Component<Props> {
|
|
|
220
212
|
const handleFocus = (focusable, mouse) => {
|
|
221
213
|
const focusFn = onFocus || noop;
|
|
222
214
|
focusFn(focusable, mouse);
|
|
223
|
-
|
|
224
215
|
this.onFocus(focusable, mouse);
|
|
225
216
|
};
|
|
226
217
|
|
|
@@ -238,6 +229,7 @@ export class CellComponent extends React.Component<Props> {
|
|
|
238
229
|
scrollTo={this.scrollToIndex()}
|
|
239
230
|
isFocusable={isFocusable}
|
|
240
231
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
232
|
+
behavior={behavior}
|
|
241
233
|
/>
|
|
242
234
|
);
|
|
243
235
|
}
|
|
@@ -271,7 +263,7 @@ export class CellComponent extends React.Component<Props> {
|
|
|
271
263
|
item,
|
|
272
264
|
focused: this.isCellFocused(focused),
|
|
273
265
|
scrollTo: this.scrollToIndex(event),
|
|
274
|
-
|
|
266
|
+
behavior
|
|
275
267
|
}}
|
|
276
268
|
/>
|
|
277
269
|
);
|
|
@@ -3,10 +3,12 @@ import * as React from "react";
|
|
|
3
3
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
4
4
|
import * as FOCUS_EVENTS from "@applicaster/zapp-react-native-utils/appUtils/focusManager/events";
|
|
5
5
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
6
|
-
import {
|
|
6
|
+
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
7
|
+
|
|
7
8
|
import { isAppleTV } from "../../Helpers/Platform";
|
|
9
|
+
import { useCellState } from "../MasterCell/utils";
|
|
8
10
|
|
|
9
|
-
const
|
|
11
|
+
const useCellFocusedState = (groupId: string, id: string) => {
|
|
10
12
|
const [currentCellFocused, setCurrentCellFocused] = React.useState(false);
|
|
11
13
|
|
|
12
14
|
React.useEffect(() => {
|
|
@@ -26,24 +28,28 @@ const useCellState = (groupId: string, id: string) => {
|
|
|
26
28
|
|
|
27
29
|
focusManager.on(FOCUS_EVENTS.FOCUS, handler);
|
|
28
30
|
|
|
29
|
-
return () =>
|
|
31
|
+
return () => {
|
|
32
|
+
focusManager.removeHandler(FOCUS_EVENTS.FOCUS, handler);
|
|
33
|
+
};
|
|
30
34
|
}, [groupId]);
|
|
31
35
|
|
|
32
36
|
return currentCellFocused;
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
type Props = {
|
|
36
|
-
item:
|
|
37
|
-
CellRenderer: React.
|
|
38
|
-
id: string
|
|
39
|
-
groupId: string
|
|
40
|
-
onFocus: Function
|
|
41
|
-
index: number
|
|
42
|
-
scrollTo: Function
|
|
43
|
-
preferredFocus?: boolean
|
|
44
|
-
skipFocusManagerRegistration?: boolean
|
|
45
|
-
isFocusable?: boolean
|
|
46
|
-
|
|
40
|
+
item: ZappEntry;
|
|
41
|
+
CellRenderer: React.ComponentType<{ item: Object; state: string }>;
|
|
42
|
+
id: string;
|
|
43
|
+
groupId: string;
|
|
44
|
+
onFocus: Function;
|
|
45
|
+
index: number;
|
|
46
|
+
scrollTo: Function;
|
|
47
|
+
preferredFocus?: boolean;
|
|
48
|
+
skipFocusManagerRegistration?: boolean;
|
|
49
|
+
isFocusable?: boolean;
|
|
50
|
+
behavior: Behavior;
|
|
51
|
+
selected?: boolean;
|
|
52
|
+
focused?: boolean;
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
export function CellWithFocusable(props: Props) {
|
|
@@ -58,9 +64,20 @@ export function CellWithFocusable(props: Props) {
|
|
|
58
64
|
preferredFocus,
|
|
59
65
|
skipFocusManagerRegistration,
|
|
60
66
|
isFocusable,
|
|
67
|
+
behavior,
|
|
61
68
|
selected,
|
|
69
|
+
focused,
|
|
62
70
|
} = props;
|
|
63
71
|
|
|
72
|
+
const isFocused = useCellFocusedState(groupId, id);
|
|
73
|
+
|
|
74
|
+
const state = useCellState({
|
|
75
|
+
id: item.id,
|
|
76
|
+
behavior,
|
|
77
|
+
focused: isFocused || toBooleanWithDefaultFalse(focused),
|
|
78
|
+
selected,
|
|
79
|
+
});
|
|
80
|
+
|
|
64
81
|
const [focusedButtonId, setFocusedButtonId] = React.useState(undefined);
|
|
65
82
|
|
|
66
83
|
// for horizontal scrolling
|
|
@@ -78,10 +95,6 @@ export function CellWithFocusable(props: Props) {
|
|
|
78
95
|
}
|
|
79
96
|
};
|
|
80
97
|
|
|
81
|
-
const isFocused = useCellState(groupId, id);
|
|
82
|
-
|
|
83
|
-
const state = getCellState({ focused: isFocused, selected });
|
|
84
|
-
|
|
85
98
|
return (
|
|
86
99
|
<CellRenderer
|
|
87
100
|
item={item}
|
|
@@ -93,6 +106,7 @@ export function CellWithFocusable(props: Props) {
|
|
|
93
106
|
preferredFocus={preferredFocus}
|
|
94
107
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
95
108
|
isFocusable={isFocusable}
|
|
109
|
+
focused={focused}
|
|
96
110
|
/>
|
|
97
111
|
);
|
|
98
112
|
}
|
|
@@ -16,10 +16,7 @@ const _getCellState = (focused, selected) =>
|
|
|
16
16
|
getCellState({ focused, selected });
|
|
17
17
|
|
|
18
18
|
type Props = {
|
|
19
|
-
item:
|
|
20
|
-
id: string;
|
|
21
|
-
title: string;
|
|
22
|
-
};
|
|
19
|
+
item: ZappEntry;
|
|
23
20
|
index: number;
|
|
24
21
|
shouldScrollHorizontally: (
|
|
25
22
|
focusable: any,
|
|
@@ -36,6 +33,7 @@ type Props = {
|
|
|
36
33
|
componentId: string;
|
|
37
34
|
component: {
|
|
38
35
|
id: number | string;
|
|
36
|
+
component_type: string;
|
|
39
37
|
};
|
|
40
38
|
selected: boolean;
|
|
41
39
|
CellRenderer: React.ComponentType<{
|
|
@@ -71,6 +69,7 @@ type Props = {
|
|
|
71
69
|
mainOffsetUpdater: (...args: any[]) => void | null | undefined;
|
|
72
70
|
isFocusable: boolean;
|
|
73
71
|
shouldUpdate: boolean;
|
|
72
|
+
behavior: Behavior;
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
type State = {
|
|
@@ -192,7 +191,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
|
|
|
192
191
|
|
|
193
192
|
if (
|
|
194
193
|
this.props.shouldUpdate &&
|
|
195
|
-
shouldScrollVertically?.(focusable, id, title)
|
|
194
|
+
shouldScrollVertically?.(focusable, String(id), String(title))
|
|
196
195
|
) {
|
|
197
196
|
const { headerOffset } = getHeaderOffset();
|
|
198
197
|
|
|
@@ -227,9 +226,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
|
|
|
227
226
|
|
|
228
227
|
hasReceivedFocus() {}
|
|
229
228
|
|
|
230
|
-
scrollTo(index) {
|
|
231
|
-
this.props?.scrollToIndex?.(index);
|
|
232
|
-
}
|
|
229
|
+
scrollTo(index) {}
|
|
233
230
|
|
|
234
231
|
render() {
|
|
235
232
|
const {
|
|
@@ -246,6 +243,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
|
|
|
246
243
|
hasReceivedFocus,
|
|
247
244
|
groupId,
|
|
248
245
|
isFocusable,
|
|
246
|
+
behavior,
|
|
249
247
|
} = this.props;
|
|
250
248
|
|
|
251
249
|
const { id } = item;
|
|
@@ -275,6 +273,8 @@ export class TvOSCellComponent extends React.Component<Props, State> {
|
|
|
275
273
|
index={index}
|
|
276
274
|
scrollTo={this.scrollTo}
|
|
277
275
|
preferredFocus={preferredFocus}
|
|
276
|
+
focused={this.props.focused}
|
|
277
|
+
behavior={behavior}
|
|
278
278
|
/>
|
|
279
279
|
</View>
|
|
280
280
|
);
|
|
@@ -305,10 +305,7 @@ export class TvOSCellComponent extends React.Component<Props, State> {
|
|
|
305
305
|
item,
|
|
306
306
|
focused: this.props.focused || selectedCell || focused,
|
|
307
307
|
scrollTo: this.scrollTo,
|
|
308
|
-
|
|
309
|
-
focused: this.props.focused || focused,
|
|
310
|
-
selected,
|
|
311
|
-
}),
|
|
308
|
+
behavior,
|
|
312
309
|
}}
|
|
313
310
|
/>
|
|
314
311
|
);
|
|
@@ -19,7 +19,7 @@ type Props = {
|
|
|
19
19
|
onPress?: (nativeEvent: React.SyntheticEvent) => void;
|
|
20
20
|
onFocus?: (nativeEvent: React.SyntheticEvent) => void;
|
|
21
21
|
onBlur?: (nativeEvent: React.SyntheticEvent) => void;
|
|
22
|
-
children: (focused
|
|
22
|
+
children: (focused?: boolean) => React.ReactNode;
|
|
23
23
|
isParallaxDisabled: boolean;
|
|
24
24
|
preferredFocus?: boolean;
|
|
25
25
|
selected?: boolean;
|
|
@@ -32,6 +32,9 @@ type Props = {
|
|
|
32
32
|
nextTvosFocusRight?: import("react").RefObject<any>;
|
|
33
33
|
nextTvosFocusUp?: import("react").RefObject<any>;
|
|
34
34
|
nextTvosFocusDown?: import("react").RefObject<any>;
|
|
35
|
+
forceFocus?: boolean;
|
|
36
|
+
initialFocus?: boolean;
|
|
37
|
+
onLayout?: (e: any) => void;
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
export class Focusable extends BaseFocusable<Props> {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { useCellState } from "../MasterCell/utils";
|
|
3
4
|
|
|
4
5
|
type Props = {
|
|
5
6
|
index: number,
|
|
6
|
-
item:
|
|
7
|
+
item: ZappEntry,
|
|
7
8
|
focused: boolean,
|
|
8
9
|
scrollTo?: (index: number) => void,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
CellRenderer: React.ComponentType<{ item: Object, state: string }>,
|
|
11
|
+
behavior: Behavior
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const isAndroid = Platform.OS === "android";
|
|
@@ -19,14 +20,16 @@ export function FocusableCell(props: Props) {
|
|
|
19
20
|
CellRenderer,
|
|
20
21
|
focused,
|
|
21
22
|
scrollTo = null,
|
|
22
|
-
|
|
23
|
+
behavior
|
|
23
24
|
} = props;
|
|
24
25
|
|
|
26
|
+
const state = useCellState({ id: item.id, behavior, focused });
|
|
27
|
+
|
|
25
28
|
React.useEffect(() => {
|
|
26
29
|
if (focused && scrollTo && !isAndroid) {
|
|
27
30
|
scrollTo(index);
|
|
28
31
|
}
|
|
29
32
|
}, [focused]);
|
|
30
33
|
|
|
31
|
-
return <CellRenderer item={item} state={
|
|
34
|
+
return <CellRenderer item={item} state={state} />;
|
|
32
35
|
}
|
|
@@ -76,8 +76,8 @@ export class FocusableGroup extends BaseFocusable<Props> {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
onDidUpdateFocus({ nativeEvent }) {
|
|
79
|
-
const {
|
|
80
|
-
|
|
79
|
+
const { onDidUpdateFocus = noop } = this.props;
|
|
80
|
+
onDidUpdateFocus(nativeEvent);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
setFocusDisabled(isFocusDisabled) {
|
|
@@ -9,6 +9,7 @@ import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
|
9
9
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
10
10
|
import { Categories } from "./logger";
|
|
11
11
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
12
|
+
import { produce } from "immer";
|
|
12
13
|
// types reference
|
|
13
14
|
|
|
14
15
|
declare type CurationEntry = { preset_name: string; feed_url: string };
|
|
@@ -39,14 +40,18 @@ export const getTransformedPreset = (
|
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
const updatedPresetComponent = produce(presetComponent, (draft) => {
|
|
44
|
+
draft.id = `${componentId}${index}`;
|
|
45
|
+
draft.data.source = preset?.feed_url;
|
|
46
|
+
|
|
47
|
+
if (draft.ui_components) {
|
|
48
|
+
draft.ui_components.forEach((comp, uiIndex) => {
|
|
49
|
+
comp.id = `${draft.id}-${uiIndex}`;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return updatedPresetComponent;
|
|
50
55
|
};
|
|
51
56
|
|
|
52
57
|
export const enrichComponent = (
|
|
@@ -93,7 +93,7 @@ export function HandlePlayable({
|
|
|
93
93
|
modalHeight,
|
|
94
94
|
modalWidth,
|
|
95
95
|
mode,
|
|
96
|
-
}: Props) {
|
|
96
|
+
}: Props): React.ReactElement | null {
|
|
97
97
|
const state = usePickFromState();
|
|
98
98
|
|
|
99
99
|
const { width: screenWidth, height: screenHeight } =
|
|
@@ -171,5 +171,5 @@ export function HandlePlayable({
|
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
return !isModal
|
|
174
|
+
return !isModal ? <BufferAnimation videoStyle={style as ViewStyle} /> : null;
|
|
175
175
|
}
|
|
@@ -2,9 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
3
|
import {
|
|
4
4
|
useBackHandler,
|
|
5
|
-
|
|
5
|
+
useIsNavBarVisible,
|
|
6
6
|
} from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
7
7
|
import { useHookAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
|
|
8
|
+
import { useSetNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
10
11
|
focused?: boolean;
|
|
@@ -18,6 +19,8 @@ export const HookRenderer = (props: Props) => {
|
|
|
18
19
|
screenData: { callback, payload, hookPlugin },
|
|
19
20
|
} = props;
|
|
20
21
|
|
|
22
|
+
const { setVisible: showNavBar } = useSetNavbarState();
|
|
23
|
+
|
|
21
24
|
const {
|
|
22
25
|
module: { Component: HookComponent, presentFullScreen },
|
|
23
26
|
configuration,
|
|
@@ -25,7 +28,7 @@ export const HookRenderer = (props: Props) => {
|
|
|
25
28
|
|
|
26
29
|
useHookAnalytics(props);
|
|
27
30
|
|
|
28
|
-
const
|
|
31
|
+
const isNavBarVisible = useIsNavBarVisible();
|
|
29
32
|
|
|
30
33
|
useBackHandler(() => {
|
|
31
34
|
callback({ success: false, payload, cancelled: true });
|
|
@@ -35,18 +38,18 @@ export const HookRenderer = (props: Props) => {
|
|
|
35
38
|
|
|
36
39
|
React.useEffect(() => {
|
|
37
40
|
if (presentFullScreen && isTV()) {
|
|
38
|
-
|
|
41
|
+
showNavBar(false);
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
return () => {
|
|
42
45
|
if (isTV()) {
|
|
43
|
-
|
|
46
|
+
showNavBar(true);
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
|
-
}, []);
|
|
49
|
+
}, [showNavBar]);
|
|
47
50
|
|
|
48
51
|
// Passing empty parentFocus if navbar is not visible (fullScreen hook)
|
|
49
|
-
const parentFocus =
|
|
52
|
+
const parentFocus = isNavBarVisible ? props.parentFocus : {};
|
|
50
53
|
|
|
51
54
|
return (
|
|
52
55
|
<HookComponent
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useIsNavBarVisible,
|
|
6
|
+
useNavigation,
|
|
7
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
5
8
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
6
|
-
import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
getNavigationProps,
|
|
@@ -18,9 +20,9 @@ import { ScreenContainer } from "./ScreenContainer";
|
|
|
18
20
|
import { TransitionOverlay } from "./TransitionOverlay";
|
|
19
21
|
|
|
20
22
|
import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
|
|
21
|
-
import { isNavBarVisible as shouldShowNavBar } from "../../Screen/navigationHandler";
|
|
22
23
|
import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
23
24
|
import { PathnameContext } from "../../../Contexts/PathnameContext";
|
|
25
|
+
import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
24
26
|
|
|
25
27
|
type Components = {
|
|
26
28
|
NavBar: React.ComponentType<any>;
|
|
@@ -41,8 +43,8 @@ type Props = {
|
|
|
41
43
|
const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
42
44
|
const navigator = useNavigation();
|
|
43
45
|
const theme = useTheme();
|
|
44
|
-
const {
|
|
45
|
-
const
|
|
46
|
+
const { title } = useNavbarState();
|
|
47
|
+
const { activeRiver, currentRoute } = navigator;
|
|
46
48
|
|
|
47
49
|
const {
|
|
48
50
|
appState: { appReady = false } = {},
|
|
@@ -52,6 +54,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
52
54
|
|
|
53
55
|
const navigationProps = getNavigationProps({
|
|
54
56
|
navigator,
|
|
57
|
+
title,
|
|
55
58
|
category: "menu",
|
|
56
59
|
});
|
|
57
60
|
|
|
@@ -77,14 +80,7 @@ const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
|
|
|
77
80
|
[]
|
|
78
81
|
);
|
|
79
82
|
|
|
80
|
-
const navBarVisible =
|
|
81
|
-
return shouldShowNavBar(
|
|
82
|
-
currentRoute,
|
|
83
|
-
screenData,
|
|
84
|
-
isNavBarVisible && !routeIsPlayerScreen(currentRoute),
|
|
85
|
-
navigator.canGoBack()
|
|
86
|
-
);
|
|
87
|
-
}, [isNavBarVisible, currentRoute, screenData?.id, navigator.key]);
|
|
83
|
+
const navBarVisible = useIsNavBarVisible();
|
|
88
84
|
|
|
89
85
|
const [navBarReady, setNavBarReady] = React.useState(false);
|
|
90
86
|
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
+
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
4
|
+
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
3
5
|
|
|
4
6
|
import Mobile from "./Mobile";
|
|
5
7
|
import TV from "./TV";
|
|
6
8
|
|
|
7
9
|
export default function Layout(props) {
|
|
10
|
+
const { currentRoute: pathname } = useNavigation();
|
|
11
|
+
|
|
8
12
|
if (isTV()) {
|
|
9
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<ScreenContextProvider pathname={pathname}>
|
|
15
|
+
<TV {...props} />
|
|
16
|
+
</ScreenContextProvider>
|
|
17
|
+
);
|
|
10
18
|
} else {
|
|
11
19
|
return <Mobile {...props} />;
|
|
12
20
|
}
|
|
@@ -103,7 +103,9 @@ const InsideBorder = ({
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
export const BorderContainerView = (props: Props) => {
|
|
106
|
-
const {
|
|
106
|
+
const { style, children } = props;
|
|
107
|
+
// Return border position prop after re-implementing
|
|
108
|
+
const borderPosition = "outside";
|
|
107
109
|
|
|
108
110
|
const borderWidth = toNumberWithDefaultZero(style.borderWidth);
|
|
109
111
|
const spacing = getContainerPadding(borderPosition, borderWidth);
|
|
@@ -4,6 +4,7 @@ import { Focusable } from "@applicaster/zapp-react-native-ui-components/Componen
|
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
|
+
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
7
8
|
|
|
8
9
|
const { Logger } = getXray();
|
|
9
10
|
|
|
@@ -35,7 +36,9 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
35
36
|
|
|
36
37
|
const focusableId = getFocusableId(prefixId, suffixId);
|
|
37
38
|
|
|
38
|
-
const focused =
|
|
39
|
+
const focused =
|
|
40
|
+
focusableId === focusedButtonId ||
|
|
41
|
+
toBooleanWithDefaultFalse(otherProps.focused);
|
|
39
42
|
|
|
40
43
|
const additionalStyles = focused ? focusedStyles : normalStyles;
|
|
41
44
|
|
|
@@ -31,6 +31,10 @@ function Image({
|
|
|
31
31
|
|
|
32
32
|
const source = useImageSource({ uri, entry, otherProps });
|
|
33
33
|
|
|
34
|
+
// const source = {
|
|
35
|
+
// uri: `https://placehold.co/392x221/blue/FFFFFF.png?text=${otherProps?.item?.index}`,
|
|
36
|
+
// };
|
|
37
|
+
|
|
34
38
|
React.useEffect(() => {
|
|
35
39
|
// reset error state on URI change as the error is referencing previous uri
|
|
36
40
|
setErrorState(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { Platform, View } from "react-native";
|
|
3
|
+
import { Platform, View, ViewStyle } from "react-native";
|
|
4
4
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
5
5
|
import { isTV, isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
6
6
|
import { PlayerLiveImage } from "../../../VideoLive/PlayerLiveImageComponent";
|
|
@@ -173,6 +173,8 @@ const getPlayerConfig = (player_screen_id, actionIdentifier) => {
|
|
|
173
173
|
return { playerPluginId: actionIdentifier };
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
+
const positionAbsolute: ViewStyle = { position: "absolute" };
|
|
177
|
+
|
|
176
178
|
const LiveImageComponent = (props: LiveImageProps) => {
|
|
177
179
|
const { item, style, cellUUID, imageKey, actionIdentifier, state } = props;
|
|
178
180
|
|
|
@@ -185,7 +187,7 @@ const LiveImageComponent = (props: LiveImageProps) => {
|
|
|
185
187
|
|
|
186
188
|
const {
|
|
187
189
|
id: componentId,
|
|
188
|
-
rules: { player_screen_id, audio_muted_by_default },
|
|
190
|
+
rules: { player_screen_id, audio_muted_by_default = false },
|
|
189
191
|
} = component;
|
|
190
192
|
|
|
191
193
|
const isCurrentlyFocused = useTrackCurrentAutoScrollingElement(componentId);
|
|
@@ -205,23 +207,24 @@ const LiveImageComponent = (props: LiveImageProps) => {
|
|
|
205
207
|
cellUUID &&
|
|
206
208
|
isSupportedTVForLiveImage();
|
|
207
209
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
210
|
+
return (
|
|
211
|
+
<>
|
|
212
|
+
<Image {...props} />
|
|
213
|
+
{isShouldRender && (
|
|
214
|
+
<View style={[style, positionAbsolute]}>
|
|
215
|
+
<PlayerLiveImage
|
|
216
|
+
playerId={cellUUID}
|
|
217
|
+
playerPluginId={playerPluginId}
|
|
218
|
+
screenConfig={screenConfig}
|
|
219
|
+
style={style}
|
|
220
|
+
imageKey={imageKey}
|
|
221
|
+
item={playableEntry}
|
|
222
|
+
audioMutedByDefault={audio_muted_by_default}
|
|
223
|
+
/>
|
|
224
|
+
</View>
|
|
225
|
+
)}
|
|
226
|
+
</>
|
|
227
|
+
);
|
|
225
228
|
};
|
|
226
229
|
|
|
227
230
|
export const LiveImage = React.memo<LiveImageProps>(LiveImageComponent);
|
|
@@ -15,7 +15,10 @@ describe("SecondaryImage - Image", () => {
|
|
|
15
15
|
|
|
16
16
|
it("SecondaryImage should render if known dimensions", async () => {
|
|
17
17
|
const wrapper = await render(
|
|
18
|
-
<SecondaryImage
|
|
18
|
+
<SecondaryImage
|
|
19
|
+
uri=""
|
|
20
|
+
style={{ width: 100, height: 100, borderRadius: 10 }}
|
|
21
|
+
/>
|
|
19
22
|
);
|
|
20
23
|
|
|
21
24
|
expect(wrapper.toJSON()).not.toEqual(null);
|