@applicaster/zapp-react-native-ui-components 12.0.5 → 13.0.0-alpha.1035032144
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__/__snapshots__/AppContainer.test.js.snap +1 -1
- 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 +6 -6
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +7 -7
- 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/Cell/Cell.tsx +4 -8
- package/Components/Cell/CellWithFocusable.tsx +60 -44
- package/Components/Cell/TvOSCellComponent.tsx +3 -8
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +6 -13
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +20 -20
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +5 -3
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +5 -5
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +11 -9
- package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
- package/Components/Focusable/FocusableTvOS.tsx +1 -1
- package/Components/FocusableList/index.tsx +0 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
- package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
- 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/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -11
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
- 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/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -34
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
- package/Components/NativeFocusables/{index.js → index.ts} +4 -2
- 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 +5 -11
- 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/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
- package/Components/River/__tests__/componentsMap.test.js +64 -17
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
- 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 +13 -39
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
- package/Components/Tabs/Tab.tsx +1 -0
- 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 +2 -2
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
- package/Components/Transitioner/Scene.tsx +52 -23
- package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +62 -46
- 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/index.js +8 -4
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +5 -2
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +14 -9
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -10
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
- package/Components/VideoModal/ModalAnimation/index.ts +2 -1
- package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -9
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -66
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +1 -1
- package/Components/VideoModal/utils.ts +2 -4
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
- package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -30
- package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
- 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__/__snapshots__/riverResolver.test.tsx.snap +5 -5
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
- package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
- package/README.md +1 -13
- package/package.json +12 -6
- package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
- package/Decorators/RiverFeedLoader/utils.ts +0 -100
- /package/Decorators/Analytics/{index.js → index.tsx} +0 -0
|
@@ -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();
|
|
@@ -175,10 +175,10 @@ function TextInputTV(props: Props, ref) {
|
|
|
175
175
|
return isWebPlatform ? (
|
|
176
176
|
<>
|
|
177
177
|
{additional && additional()}
|
|
178
|
-
<input ref={ref} {...inputProps} />
|
|
178
|
+
<input testID="TextInput-tv" ref={ref} {...inputProps} />
|
|
179
179
|
</>
|
|
180
180
|
) : (
|
|
181
|
-
<TextInput ref={ref} {...inputProps} />
|
|
181
|
+
<TextInput testID="TextInput-tv" ref={ref} {...inputProps} />
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
|
|
@@ -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
|
}
|
|
@@ -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
|
-
<PathnameContext.Provider value={pathname}>
|
|
76
|
-
<ScreenContextProvider pathname={pathname}>
|
|
77
|
-
{children}
|
|
78
|
-
</ScreenContextProvider>
|
|
79
|
-
</PathnameContext.Provider>
|
|
80
|
-
</ScreenDataContext.Provider>
|
|
107
|
+
{children}
|
|
81
108
|
{isAnimating && <Animated.View style={overlayStyle} />}
|
|
82
109
|
</Animated.View>
|
|
83
110
|
);
|
|
84
111
|
}
|
|
112
|
+
|
|
113
|
+
export const Scene = withCurrentScreenContext(SceneComponent);
|
|
@@ -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
|
}
|
|
@@ -1,63 +1,79 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Scene /> renders correctly 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
4
|
+
<CurrentScreenContextProvider
|
|
5
|
+
contentStyle={
|
|
6
|
+
{
|
|
7
|
+
"paddingBottom": 49,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
overlayStyle={
|
|
11
|
+
{
|
|
12
|
+
"opacity": 1,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
6
15
|
style={
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
Object {
|
|
12
|
-
"paddingBottom": 49,
|
|
13
|
-
},
|
|
14
|
-
Object {
|
|
15
|
-
"fontScale": 2,
|
|
16
|
-
"height": 1334,
|
|
17
|
-
"scale": 2,
|
|
18
|
-
"statusBarHeight": null,
|
|
19
|
-
"width": 750,
|
|
20
|
-
},
|
|
21
|
-
]
|
|
16
|
+
{
|
|
17
|
+
"flex": 1,
|
|
18
|
+
}
|
|
22
19
|
}
|
|
23
20
|
>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
<SceneComponent
|
|
22
|
+
contentStyle={
|
|
23
|
+
{
|
|
24
|
+
"paddingBottom": 49,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
overlayStyle={
|
|
28
|
+
{
|
|
29
|
+
"opacity": 1,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
style={
|
|
33
|
+
{
|
|
34
|
+
"flex": 1,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/>
|
|
38
|
+
</CurrentScreenContextProvider>
|
|
30
39
|
`;
|
|
31
40
|
|
|
32
41
|
exports[`<Scene /> renders the overlay while animating 1`] = `
|
|
33
|
-
<
|
|
34
|
-
|
|
42
|
+
<CurrentScreenContextProvider
|
|
43
|
+
animating={true}
|
|
44
|
+
contentStyle={
|
|
45
|
+
{
|
|
46
|
+
"paddingBottom": 49,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
overlayStyle={
|
|
50
|
+
{
|
|
51
|
+
"opacity": 1,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
35
54
|
style={
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
Object {
|
|
41
|
-
"paddingBottom": 49,
|
|
42
|
-
},
|
|
43
|
-
Object {
|
|
44
|
-
"height": "100%",
|
|
45
|
-
"width": "100%",
|
|
46
|
-
},
|
|
47
|
-
]
|
|
55
|
+
{
|
|
56
|
+
"flex": 1,
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
>
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
<SceneComponent
|
|
61
|
+
animating={true}
|
|
62
|
+
contentStyle={
|
|
63
|
+
{
|
|
64
|
+
"paddingBottom": 49,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
overlayStyle={
|
|
68
|
+
{
|
|
58
69
|
"opacity": 1,
|
|
59
70
|
}
|
|
60
71
|
}
|
|
72
|
+
style={
|
|
73
|
+
{
|
|
74
|
+
"flex": 1,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
61
77
|
/>
|
|
62
|
-
</
|
|
78
|
+
</CurrentScreenContextProvider>
|
|
63
79
|
`;
|
|
@@ -5,34 +5,34 @@ exports[`transitionConfig accepts an Animated.Value as a parameter 1`] = `"Canno
|
|
|
5
5
|
exports[`transitionConfig accepts an Animated.Value as a parameter 2`] = `[Function]`;
|
|
6
6
|
|
|
7
7
|
exports[`transitionConfig returns a back object is valid 1`] = `
|
|
8
|
-
|
|
8
|
+
{
|
|
9
9
|
"duration": 350,
|
|
10
10
|
"easing": [Function],
|
|
11
|
-
"from":
|
|
12
|
-
"style":
|
|
11
|
+
"from": {
|
|
12
|
+
"style": {
|
|
13
13
|
"height": 1334,
|
|
14
14
|
"position": "absolute",
|
|
15
|
-
"transform":
|
|
16
|
-
|
|
15
|
+
"transform": [
|
|
16
|
+
{
|
|
17
17
|
"translateX": 0,
|
|
18
18
|
},
|
|
19
19
|
],
|
|
20
20
|
"width": 750,
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
-
"to":
|
|
24
|
-
"overlayStyle":
|
|
23
|
+
"to": {
|
|
24
|
+
"overlayStyle": {
|
|
25
25
|
"backgroundColor": "black",
|
|
26
26
|
"height": 1334,
|
|
27
27
|
"opacity": 0.35,
|
|
28
28
|
"position": "absolute",
|
|
29
29
|
"width": 750,
|
|
30
30
|
},
|
|
31
|
-
"style":
|
|
31
|
+
"style": {
|
|
32
32
|
"height": 1334,
|
|
33
33
|
"position": "absolute",
|
|
34
|
-
"transform":
|
|
35
|
-
|
|
34
|
+
"transform": [
|
|
35
|
+
{
|
|
36
36
|
"translateX": -1,
|
|
37
37
|
},
|
|
38
38
|
],
|
|
@@ -43,34 +43,34 @@ Object {
|
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
45
|
exports[`transitionConfig returns a push object is valid 1`] = `
|
|
46
|
-
|
|
46
|
+
{
|
|
47
47
|
"duration": 350,
|
|
48
48
|
"easing": [Function],
|
|
49
|
-
"from":
|
|
50
|
-
"overlayStyle":
|
|
49
|
+
"from": {
|
|
50
|
+
"overlayStyle": {
|
|
51
51
|
"backgroundColor": "black",
|
|
52
52
|
"height": 1334,
|
|
53
53
|
"opacity": 0,
|
|
54
54
|
"position": "absolute",
|
|
55
55
|
"width": 750,
|
|
56
56
|
},
|
|
57
|
-
"style":
|
|
57
|
+
"style": {
|
|
58
58
|
"height": 1334,
|
|
59
59
|
"position": "absolute",
|
|
60
|
-
"transform":
|
|
61
|
-
|
|
60
|
+
"transform": [
|
|
61
|
+
{
|
|
62
62
|
"translateX": 0,
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
65
|
"width": 750,
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
|
-
"to":
|
|
69
|
-
"style":
|
|
68
|
+
"to": {
|
|
69
|
+
"style": {
|
|
70
70
|
"height": 1334,
|
|
71
71
|
"position": "absolute",
|
|
72
|
-
"transform":
|
|
73
|
-
|
|
72
|
+
"transform": [
|
|
73
|
+
{
|
|
74
74
|
"translateX": 750,
|
|
75
75
|
},
|
|
76
76
|
],
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"flex": 1,
|
|
8
8
|
"overflow": "hidden",
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<SceneComponent
|
|
13
13
|
isActive={true}
|
|
14
14
|
screenUniqueId="mocked-uuid"
|
|
15
|
-
style={
|
|
15
|
+
style={{}}
|
|
16
16
|
>
|
|
17
17
|
<View
|
|
18
18
|
foo="bar"
|
|
@@ -23,6 +23,6 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
|
|
|
23
23
|
children
|
|
24
24
|
</Text>
|
|
25
25
|
</View>
|
|
26
|
-
</
|
|
26
|
+
</SceneComponent>
|
|
27
27
|
</View>
|
|
28
28
|
`;
|