@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5033140607 → 13.0.0-alpha.5144285042
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/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
- package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +56 -113
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +39 -23
- package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
- package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
- package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/BaseFocusable/index.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +67 -31
- package/Components/Cell/Cell.tsx +15 -9
- package/Components/Cell/CellWithFocusable.tsx +44 -59
- package/Components/Cell/TvOSCellComponent.tsx +23 -30
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/index.js +3 -1
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
- package/Components/ErrorScreen/index.tsx +6 -6
- package/Components/Focusable/Focusable.tsx +1 -54
- package/Components/Focusable/FocusableTvOS.tsx +6 -2
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -83
- package/Components/FocusableGroup/index.tsx +1 -3
- package/Components/FocusableList/index.tsx +26 -10
- package/Components/FocusableScrollView/index.tsx +43 -13
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
- package/Components/Layout/TV/NavBarContainer.tsx +19 -23
- package/Components/Layout/TV/ScreenContainer.tsx +8 -1
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
- package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -12
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +133 -0
- package/Components/MasterCell/utils/index.ts +4 -130
- package/Components/ModalComponent/Button/index.tsx +6 -6
- package/Components/ModalComponent/Header/index.tsx +3 -3
- package/Components/NativeFocusables/{index.js → index.ts} +4 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
- package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
- package/Components/PlayerContainer/PlayerContainer.tsx +13 -19
- package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +23 -3
- package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RefreshControl.tsx +1 -1
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +37 -2
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
- package/Components/River/__tests__/componentsMap.test.js +64 -17
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +12 -5
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/Screen/__tests__/Screen.test.tsx +41 -27
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
- package/Components/Screen/hooks.ts +56 -0
- package/Components/Screen/index.tsx +16 -42
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
- package/Components/Tabs/Tab.tsx +12 -9
- package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
- package/Components/TextInputTv/index.tsx +6 -5
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/Scene.tsx +53 -24
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
- package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +16 -12
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +15 -14
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +6 -13
- package/Components/VideoModal/ModalAnimation/index.ts +2 -1
- package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +9 -6
- package/Components/VideoModal/PlayerWrapper.tsx +17 -36
- package/Components/VideoModal/VideoModal.tsx +14 -23
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +3 -5
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +3 -16
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
- package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +6 -12
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Analytics/{index.js → index.tsx} +11 -11
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
- package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
- package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
- package/Decorators/RiverFeedLoader/index.tsx +1 -1
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
- package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
- package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +5 -2
- package/package.json +13 -10
- package/tsconfig.json +2 -3
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverFeedLoader/utils.ts +0 -100
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
package/Components/Tabs/Tab.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react-native/no-unused-styles */
|
|
2
2
|
import React from "react";
|
|
3
3
|
import * as R from "ramda";
|
|
4
|
-
import {
|
|
4
|
+
import { StyleSheet, Text, TouchableWithoutFeedback, View } from "react-native";
|
|
5
5
|
import { useConfiguration } from "@applicaster/zapp-react-native-utils/reactHooks/configuration";
|
|
6
6
|
import {
|
|
7
|
-
getStyleForPlatform,
|
|
8
7
|
applyStringTransformation,
|
|
8
|
+
getStyleForPlatform,
|
|
9
9
|
} from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
@@ -69,8 +69,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
69
69
|
? tab_cell_background_color_selected_active
|
|
70
70
|
: tab_cell_background_color_selected_default
|
|
71
71
|
: focused
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
? tab_cell_background_color_active
|
|
73
|
+
: tab_cell_background_color_default,
|
|
74
74
|
justifyContent: "center",
|
|
75
75
|
alignItems: "center",
|
|
76
76
|
position: "relative",
|
|
@@ -85,8 +85,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
85
85
|
? tab_cell_border_color_active_focused
|
|
86
86
|
: tab_cell_border_color_active
|
|
87
87
|
: focused
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
? tab_cell_border_color_default_focused
|
|
89
|
+
: tab_cell_border_color_default,
|
|
90
90
|
},
|
|
91
91
|
label: {
|
|
92
92
|
fontFamily: text_label_font_family,
|
|
@@ -98,8 +98,8 @@ const getStyles = (configuration, selected, focused) => {
|
|
|
98
98
|
? text_label_selected_active_font_color
|
|
99
99
|
: text_label_selected_default_font_color
|
|
100
100
|
: focused
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
? text_label_active_font_color
|
|
102
|
+
: text_label_default_font_color,
|
|
103
103
|
},
|
|
104
104
|
underline: {
|
|
105
105
|
position: "absolute",
|
|
@@ -138,6 +138,7 @@ const Tab = ({ title, selected, handleOnPress }: Props, ref: any) => {
|
|
|
138
138
|
|
|
139
139
|
return (
|
|
140
140
|
<TouchableWithoutFeedback
|
|
141
|
+
testID="tab-touchable"
|
|
141
142
|
onPressIn={handleOnPressIn}
|
|
142
143
|
onPressOut={handleOnPressOut}
|
|
143
144
|
onPress={handleOnPress}
|
|
@@ -147,7 +148,9 @@ const Tab = ({ title, selected, handleOnPress }: Props, ref: any) => {
|
|
|
147
148
|
<Text numberOfLines={1} style={styles.label}>
|
|
148
149
|
{tabTitle}
|
|
149
150
|
</Text>
|
|
150
|
-
{selected
|
|
151
|
+
{selected ? (
|
|
152
|
+
<View testID="underline" style={styles.underline} />
|
|
153
|
+
) : null}
|
|
151
154
|
</View>
|
|
152
155
|
</View>
|
|
153
156
|
</TouchableWithoutFeedback>
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Platform: {
|
|
12
|
-
OS: "samsung_tv",
|
|
13
|
-
isTV: true,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
|
+
|
|
5
|
+
Platform.OS = "samsung_tv";
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(Platform, "isTV", {
|
|
8
|
+
get() {
|
|
9
|
+
return true;
|
|
10
|
+
},
|
|
16
11
|
});
|
|
17
12
|
|
|
18
13
|
jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
|
|
@@ -20,12 +15,12 @@ jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
|
|
|
20
15
|
}));
|
|
21
16
|
|
|
22
17
|
const { TextInputTv } = require("../");
|
|
23
|
-
const
|
|
18
|
+
const testIDToTest = "TextInput-tv";
|
|
24
19
|
|
|
25
20
|
describe("<TextInputTv />", () => {
|
|
26
21
|
it("renders", () => {
|
|
27
|
-
const
|
|
28
|
-
expect(
|
|
22
|
+
const { toJSON } = render(<TextInputTv />);
|
|
23
|
+
expect(toJSON()).toMatchSnapshot();
|
|
29
24
|
});
|
|
30
25
|
|
|
31
26
|
describe("on native", () => {
|
|
@@ -34,8 +29,8 @@ describe("<TextInputTv />", () => {
|
|
|
34
29
|
});
|
|
35
30
|
|
|
36
31
|
it("returns React-Native TextInput component if not on samsung", () => {
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
32
|
+
const { getByTestId } = render(<TextInputTv />);
|
|
33
|
+
expect(getByTestId(testIDToTest)).toBeTruthy();
|
|
39
34
|
});
|
|
40
35
|
});
|
|
41
36
|
|
|
@@ -45,29 +40,30 @@ describe("<TextInputTv />", () => {
|
|
|
45
40
|
});
|
|
46
41
|
|
|
47
42
|
it("returns React input component if on samsung", () => {
|
|
48
|
-
const
|
|
49
|
-
expect(
|
|
43
|
+
const { getByTestId } = render(<TextInputTv type="samsung" />);
|
|
44
|
+
expect(getByTestId(testIDToTest)).toBeTruthy();
|
|
50
45
|
});
|
|
51
46
|
|
|
52
47
|
it("flattens styles", () => {
|
|
53
48
|
Platform.OS = "samsung_tv";
|
|
54
49
|
const style = [{ width: 200 }, { height: 200 }];
|
|
55
|
-
const testInstance = TestRenderer.create(<TextInputTv style={style} />);
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
"
|
|
51
|
+
const { getByTestId } = render(
|
|
52
|
+
<TextInputTv type="samsung" style={style} />
|
|
59
53
|
);
|
|
54
|
+
|
|
55
|
+
expect(getByTestId(testIDToTest).props.style).toBeObject();
|
|
60
56
|
});
|
|
61
57
|
|
|
62
58
|
it("maps onChangeText to onChange", () => {
|
|
63
59
|
Platform.OS = "samsung_tv";
|
|
64
60
|
const onChangeText = jest.fn();
|
|
65
61
|
|
|
66
|
-
const
|
|
67
|
-
<TextInputTv onChangeText={onChangeText} />
|
|
62
|
+
const { getByTestId } = render(
|
|
63
|
+
<TextInputTv type="samsung" onChangeText={onChangeText} />
|
|
68
64
|
);
|
|
69
65
|
|
|
70
|
-
const inputInstance =
|
|
66
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
71
67
|
expect(inputInstance.props.onChange).toBeDefined();
|
|
72
68
|
expect(inputInstance.props.onChangeText).toBeUndefined();
|
|
73
69
|
});
|
|
@@ -76,11 +72,11 @@ describe("<TextInputTv />", () => {
|
|
|
76
72
|
Platform.OS = "samsung_tv";
|
|
77
73
|
const onChangeText = jest.fn();
|
|
78
74
|
|
|
79
|
-
const
|
|
80
|
-
<TextInputTv onChangeText={onChangeText} />
|
|
75
|
+
const { getByTestId } = render(
|
|
76
|
+
<TextInputTv type="samsung" onChangeText={onChangeText} />
|
|
81
77
|
);
|
|
82
78
|
|
|
83
|
-
const inputInstance =
|
|
79
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
84
80
|
const value = "foobar";
|
|
85
81
|
inputInstance.props.onChange({ target: { value: value } });
|
|
86
82
|
expect(onChangeText).toBeCalledWith(value);
|
|
@@ -89,11 +85,12 @@ describe("<TextInputTv />", () => {
|
|
|
89
85
|
it("maps onEndEditing to onBlur", () => {
|
|
90
86
|
Platform.OS = "samsung_tv";
|
|
91
87
|
|
|
92
|
-
const
|
|
93
|
-
<TextInputTv onEndEditing={() => null} />
|
|
88
|
+
const { getByTestId } = render(
|
|
89
|
+
<TextInputTv type="samsung" onEndEditing={() => null} />
|
|
94
90
|
);
|
|
95
91
|
|
|
96
|
-
const inputInstance =
|
|
92
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
93
|
+
|
|
97
94
|
expect(inputInstance.props.onBlur).toBeDefined();
|
|
98
95
|
expect(inputInstance.props.onEndEditing).toBeUndefined();
|
|
99
96
|
});
|
|
@@ -101,11 +98,12 @@ describe("<TextInputTv />", () => {
|
|
|
101
98
|
it("maps onPress to onClick", () => {
|
|
102
99
|
Platform.OS = "samsung_tv";
|
|
103
100
|
|
|
104
|
-
const
|
|
105
|
-
<TextInputTv onPress={() => null} />
|
|
101
|
+
const { getByTestId } = render(
|
|
102
|
+
<TextInputTv type="samsung" onPress={() => null} />
|
|
106
103
|
);
|
|
107
104
|
|
|
108
|
-
const inputInstance =
|
|
105
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
106
|
+
|
|
109
107
|
expect(inputInstance.props.onClick).toBeDefined();
|
|
110
108
|
expect(inputInstance.props.onPress).toBeUndefined();
|
|
111
109
|
});
|
|
@@ -113,22 +111,24 @@ describe("<TextInputTv />", () => {
|
|
|
113
111
|
it("replaces secureTextEntry with type:'password'", () => {
|
|
114
112
|
Platform.OS = "samsung_tv";
|
|
115
113
|
|
|
116
|
-
const
|
|
117
|
-
<TextInputTv
|
|
114
|
+
const { getByTestId } = render(
|
|
115
|
+
<TextInputTv type="samsung" secureTextEntry />
|
|
118
116
|
);
|
|
119
117
|
|
|
120
|
-
const inputInstance =
|
|
118
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
119
|
+
|
|
121
120
|
expect(inputInstance.props.type).toBe("password");
|
|
122
121
|
});
|
|
123
122
|
|
|
124
123
|
it("removes 'onChangeText', 'secureTextEntry', 'onEndEditing', 'onPress' props", () => {
|
|
125
124
|
Platform.OS = "samsung_tv";
|
|
126
125
|
|
|
127
|
-
const
|
|
128
|
-
<TextInputTv onChangeText secureTextEntry onEndEditing />
|
|
126
|
+
const { getByTestId } = render(
|
|
127
|
+
<TextInputTv type="samsung" onChangeText secureTextEntry onEndEditing />
|
|
129
128
|
);
|
|
130
129
|
|
|
131
|
-
const inputInstance =
|
|
130
|
+
const inputInstance = getByTestId(testIDToTest);
|
|
131
|
+
|
|
132
132
|
expect(inputInstance.props.onChangeText).toBeUndefined();
|
|
133
133
|
expect(inputInstance.props.secureTextEntry).toBeUndefined();
|
|
134
134
|
expect(inputInstance.props.onEndEditing).toBeUndefined();
|
|
@@ -94,8 +94,8 @@ function TextInputTV(props: Props, ref) {
|
|
|
94
94
|
styles.textAlign === "center"
|
|
95
95
|
? styles.textAlign
|
|
96
96
|
: styles.textAlign === "left"
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
? "right"
|
|
98
|
+
: "left";
|
|
99
99
|
|
|
100
100
|
return { style: { ...styles, textAlign } };
|
|
101
101
|
}
|
|
@@ -174,11 +174,12 @@ function TextInputTV(props: Props, ref) {
|
|
|
174
174
|
|
|
175
175
|
return isWebPlatform ? (
|
|
176
176
|
<>
|
|
177
|
-
{additional
|
|
178
|
-
|
|
177
|
+
{additional ? additional() : null}
|
|
178
|
+
{/* eslint-disable-next-line react/no-unknown-property */}
|
|
179
|
+
<input testID="TextInput-tv" ref={ref} {...inputProps} />
|
|
179
180
|
</>
|
|
180
181
|
) : (
|
|
181
|
-
<TextInput ref={ref} {...inputProps} />
|
|
182
|
+
<TextInput testID="TextInput-tv" ref={ref} {...inputProps} />
|
|
182
183
|
);
|
|
183
184
|
}
|
|
184
185
|
|
|
@@ -14,7 +14,7 @@ exports[`<Touchable /> when not running in automated tests environment renders c
|
|
|
14
14
|
onResponderTerminationRequest={[Function]}
|
|
15
15
|
onStartShouldSetResponder={[Function]}
|
|
16
16
|
style={
|
|
17
|
-
|
|
17
|
+
{
|
|
18
18
|
"opacity": 1,
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -40,7 +40,7 @@ exports[`<Touchable /> when running in automated tests environment has accessibl
|
|
|
40
40
|
onResponderTerminationRequest={[Function]}
|
|
41
41
|
onStartShouldSetResponder={[Function]}
|
|
42
42
|
style={
|
|
43
|
-
|
|
43
|
+
{
|
|
44
44
|
"opacity": 1,
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -12,6 +12,7 @@ type TrackedViewProps = {
|
|
|
12
12
|
onPositionUpdated: (props: { rect?: Record<string, number> }) => void;
|
|
13
13
|
testId?: string | undefined;
|
|
14
14
|
groupId?: string;
|
|
15
|
+
clipThreshold?: number;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export const TrackedView = memo(function TrackedView(props: TrackedViewProps) {
|
|
@@ -2,21 +2,21 @@ import { Animated } from "react-native";
|
|
|
2
2
|
|
|
3
3
|
import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
|
|
4
4
|
|
|
5
|
-
type TransitionConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
5
|
+
// type TransitionConfig = {
|
|
6
|
+
// duration: number;
|
|
7
|
+
// easing: any;
|
|
8
|
+
// from: {
|
|
9
|
+
// style: any;
|
|
10
|
+
// };
|
|
11
|
+
// to: {
|
|
12
|
+
// style: any;
|
|
13
|
+
// };
|
|
14
|
+
// };
|
|
15
15
|
|
|
16
|
-
type Props = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
16
|
+
// type Props = {
|
|
17
|
+
// transitionConfig: TransitionConfig;
|
|
18
|
+
// contentStyle: { [string]: any };
|
|
19
|
+
// };
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Manages animation for the Transitioner,
|
|
@@ -25,7 +25,7 @@ type Props = {
|
|
|
25
25
|
* which must have a proper structure, see types above ^.
|
|
26
26
|
*/
|
|
27
27
|
export class AnimationManager {
|
|
28
|
-
constructor(props
|
|
28
|
+
constructor(props) {
|
|
29
29
|
this.animatedValue = new Animated.Value(0.0);
|
|
30
30
|
|
|
31
31
|
this.config = props.transitionConfig(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { equals } from "ramda";
|
|
2
3
|
import { Animated, ViewProps, ViewStyle } from "react-native";
|
|
3
4
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
4
5
|
|
|
@@ -8,6 +9,11 @@ import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
|
8
9
|
import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
|
|
9
10
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
10
11
|
|
|
12
|
+
const fullWidthDimensions = {
|
|
13
|
+
height: "100%",
|
|
14
|
+
width: "100%",
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
type Props = {
|
|
12
18
|
children: any;
|
|
13
19
|
style: any;
|
|
@@ -20,6 +26,47 @@ type Props = {
|
|
|
20
26
|
screenData: NavigationScreenData;
|
|
21
27
|
};
|
|
22
28
|
|
|
29
|
+
export function CurrentScreenContextProvider({
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: {
|
|
33
|
+
children: any;
|
|
34
|
+
pathname: string;
|
|
35
|
+
isActive: boolean;
|
|
36
|
+
screenData: NavigationScreenData;
|
|
37
|
+
}) {
|
|
38
|
+
const { pathname, isActive = false, screenData } = props;
|
|
39
|
+
|
|
40
|
+
const [initialScreenData, setInitialScreenData] = React.useState(screenData);
|
|
41
|
+
|
|
42
|
+
React.useLayoutEffect(() => {
|
|
43
|
+
const screenDataChanged = !equals(initialScreenData, screenData);
|
|
44
|
+
|
|
45
|
+
if (isActive && screenDataChanged) {
|
|
46
|
+
setInitialScreenData(screenData);
|
|
47
|
+
}
|
|
48
|
+
}, [initialScreenData, screenData, isActive]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<ScreenDataContext.Provider value={initialScreenData}>
|
|
52
|
+
<PathnameContext.Provider value={pathname}>
|
|
53
|
+
<ScreenContextProvider pathname={pathname}>
|
|
54
|
+
{children}
|
|
55
|
+
</ScreenContextProvider>
|
|
56
|
+
</PathnameContext.Provider>
|
|
57
|
+
</ScreenDataContext.Provider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const withCurrentScreenContext = (Component) =>
|
|
62
|
+
function SceneComponent(props: Props) {
|
|
63
|
+
return (
|
|
64
|
+
<CurrentScreenContextProvider {...props}>
|
|
65
|
+
<Component {...props} />
|
|
66
|
+
</CurrentScreenContextProvider>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
23
70
|
/**
|
|
24
71
|
* Animated View container for any purpose.
|
|
25
72
|
* Renders given children with given style object.
|
|
@@ -32,53 +79,35 @@ type Props = {
|
|
|
32
79
|
* @param contentStyle
|
|
33
80
|
* @param screenUniqueId
|
|
34
81
|
*/
|
|
35
|
-
|
|
82
|
+
function SceneComponent({
|
|
36
83
|
children,
|
|
37
84
|
style,
|
|
38
85
|
pointerEvents = "auto",
|
|
39
86
|
overlayStyle,
|
|
40
87
|
animating,
|
|
41
88
|
contentStyle,
|
|
42
|
-
pathname,
|
|
43
89
|
isActive = false,
|
|
44
90
|
screenData,
|
|
45
91
|
}: Props) {
|
|
46
|
-
const [initialScreenData, setInitialScreenData] = React.useState(screenData);
|
|
47
|
-
|
|
48
92
|
useScreenOrientationHandler({
|
|
49
93
|
screenData,
|
|
50
94
|
isActive,
|
|
51
95
|
});
|
|
52
96
|
|
|
53
|
-
React.useLayoutEffect(() => {
|
|
54
|
-
if (isActive) {
|
|
55
|
-
setInitialScreenData(screenData);
|
|
56
|
-
}
|
|
57
|
-
}, [screenData, isActive]);
|
|
58
|
-
|
|
59
97
|
const frame = useSafeAreaFrame();
|
|
60
98
|
const isAnimating = animating && overlayStyle;
|
|
61
99
|
|
|
62
|
-
const dimensions = isAnimating
|
|
63
|
-
? {
|
|
64
|
-
width: "100%",
|
|
65
|
-
height: "100%",
|
|
66
|
-
}
|
|
67
|
-
: frame;
|
|
100
|
+
const dimensions = isAnimating ? fullWidthDimensions : frame;
|
|
68
101
|
|
|
69
102
|
return (
|
|
70
103
|
<Animated.View
|
|
71
104
|
pointerEvents={pointerEvents}
|
|
72
105
|
style={[style, contentStyle, dimensions]}
|
|
73
106
|
>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<ScreenContextProvider pathname={pathname}>
|
|
77
|
-
{children}
|
|
78
|
-
</ScreenContextProvider>
|
|
79
|
-
</PathnameContext.Provider>
|
|
80
|
-
</ScreenDataContext.Provider>
|
|
81
|
-
{isAnimating && <Animated.View style={overlayStyle} />}
|
|
107
|
+
{children}
|
|
108
|
+
{isAnimating ? <Animated.View style={overlayStyle} /> : null}
|
|
82
109
|
</Animated.View>
|
|
83
110
|
);
|
|
84
111
|
}
|
|
112
|
+
|
|
113
|
+
export const Scene = withCurrentScreenContext(SceneComponent);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { append, compose, identity, isNil, tail, take, update } from "ramda";
|
|
4
4
|
|
|
5
5
|
import { AnimationManager } from "./AnimationManager";
|
|
6
6
|
import { Scene } from "./Scene";
|
|
@@ -289,7 +289,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
289
289
|
|
|
290
290
|
return (
|
|
291
291
|
<View style={styles.container}>
|
|
292
|
-
{scenes[to.index]
|
|
292
|
+
{scenes[to.index] ? (
|
|
293
293
|
<Scene
|
|
294
294
|
{...{ style: to?.style || {} }}
|
|
295
295
|
pathname={pathname}
|
|
@@ -301,7 +301,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
301
301
|
>
|
|
302
302
|
{scenes[to.index].children}
|
|
303
303
|
</Scene>
|
|
304
|
-
)}
|
|
304
|
+
) : null}
|
|
305
305
|
</View>
|
|
306
306
|
);
|
|
307
307
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { Scene } from "../Scene";
|
|
4
5
|
|
|
5
6
|
const overlayStyle = { opacity: 1 };
|
|
6
7
|
const contentStyle = { paddingBottom: 49 };
|
|
@@ -23,28 +24,38 @@ jest.mock(
|
|
|
23
24
|
})
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
jest.mock("../../../Contexts/PathnameContext", () => ({
|
|
28
|
+
PathnameContext: jest.requireActual("react").createContext({ pathname: "" }),
|
|
29
|
+
}));
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
31
|
+
jest.mock("../../../Contexts/ScreenDataContext", () => ({
|
|
32
|
+
ScreenDataContext: jest.requireActual("react").createContext({}),
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
jest.mock("../../../Contexts/ScreenContext", () => ({
|
|
36
|
+
ScreenContextProvider: jest.requireActual("react-native").View,
|
|
37
|
+
}));
|
|
35
38
|
|
|
36
39
|
describe("<Scene />", () => {
|
|
40
|
+
const wrapper = render(
|
|
41
|
+
<Scene
|
|
42
|
+
style={style}
|
|
43
|
+
overlayStyle={overlayStyle}
|
|
44
|
+
contentStyle={contentStyle}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
|
|
37
48
|
it("renders correctly", () => {
|
|
38
|
-
expect(
|
|
49
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
39
50
|
});
|
|
40
51
|
|
|
41
52
|
// skipped - this isn't a very useful test, and it doesn't work as it used to on the new version of RN
|
|
42
53
|
it.skip("renders children surrounded by AnimatedComponent", () => {
|
|
43
|
-
expect(
|
|
54
|
+
expect(wrapper.toJSON()).toEqual("AnimatedComponent");
|
|
44
55
|
});
|
|
45
56
|
|
|
46
57
|
it("renders the overlay while animating", () => {
|
|
47
|
-
const wrapperWithOverlay =
|
|
58
|
+
const wrapperWithOverlay = render(
|
|
48
59
|
<Scene
|
|
49
60
|
style={style}
|
|
50
61
|
overlayStyle={overlayStyle}
|
|
@@ -53,6 +64,6 @@ describe("<Scene />", () => {
|
|
|
53
64
|
/>
|
|
54
65
|
);
|
|
55
66
|
|
|
56
|
-
expect(
|
|
67
|
+
expect(wrapperWithOverlay.toJSON).toMatchSnapshot();
|
|
57
68
|
});
|
|
58
69
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`AnimationManager initialState() returns a state composed from the initial configuration 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"animating": false,
|
|
6
6
|
"duration": 123,
|
|
7
7
|
"easing": [MockFunction],
|
|
8
|
-
"from":
|
|
8
|
+
"from": {
|
|
9
9
|
"index": 0,
|
|
10
10
|
},
|
|
11
|
-
"to":
|
|
11
|
+
"to": {
|
|
12
12
|
"index": 0,
|
|
13
|
-
"style":
|
|
13
|
+
"style": {},
|
|
14
14
|
},
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
@@ -18,25 +18,25 @@ Object {
|
|
|
18
18
|
exports[`AnimationManager returns the animation manager with the injected transition configuration 1`] = `
|
|
19
19
|
AnimationManager {
|
|
20
20
|
"animatedValue": 0,
|
|
21
|
-
"config":
|
|
22
|
-
"back":
|
|
21
|
+
"config": {
|
|
22
|
+
"back": {
|
|
23
23
|
"duration": 123,
|
|
24
24
|
"easing": [MockFunction],
|
|
25
|
-
"from":
|
|
26
|
-
"style":
|
|
25
|
+
"from": {
|
|
26
|
+
"style": {},
|
|
27
27
|
},
|
|
28
|
-
"to":
|
|
29
|
-
"style":
|
|
28
|
+
"to": {
|
|
29
|
+
"style": {},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
"push":
|
|
32
|
+
"push": {
|
|
33
33
|
"duration": 123,
|
|
34
34
|
"easing": [MockFunction],
|
|
35
|
-
"from":
|
|
36
|
-
"style":
|
|
35
|
+
"from": {
|
|
36
|
+
"style": {},
|
|
37
37
|
},
|
|
38
|
-
"to":
|
|
39
|
-
"style":
|
|
38
|
+
"to": {
|
|
39
|
+
"style": {},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
},
|
|
@@ -44,25 +44,25 @@ AnimationManager {
|
|
|
44
44
|
`;
|
|
45
45
|
|
|
46
46
|
exports[`AnimationManager returns the animation manager with the injected transition configuration 2`] = `
|
|
47
|
-
|
|
48
|
-
"back":
|
|
47
|
+
{
|
|
48
|
+
"back": {
|
|
49
49
|
"duration": 123,
|
|
50
50
|
"easing": [MockFunction],
|
|
51
|
-
"from":
|
|
52
|
-
"style":
|
|
51
|
+
"from": {
|
|
52
|
+
"style": {},
|
|
53
53
|
},
|
|
54
|
-
"to":
|
|
55
|
-
"style":
|
|
54
|
+
"to": {
|
|
55
|
+
"style": {},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
|
-
"push":
|
|
58
|
+
"push": {
|
|
59
59
|
"duration": 123,
|
|
60
60
|
"easing": [MockFunction],
|
|
61
|
-
"from":
|
|
62
|
-
"style":
|
|
61
|
+
"from": {
|
|
62
|
+
"style": {},
|
|
63
63
|
},
|
|
64
|
-
"to":
|
|
65
|
-
"style":
|
|
64
|
+
"to": {
|
|
65
|
+
"style": {},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
}
|