@applicaster/zapp-react-native-ui-components 12.0.0-alpha.3021004521 → 12.0.0-alpha.4534459584
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/AnimatedInOut/index.tsx +10 -18
- package/Components/Image/Image.android.tsx +30 -2
- package/Components/VideoModal/PlayerWrapper.tsx +8 -6
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +6 -10
- package/Components/VideoModal/hooks/useModalSize.ts +4 -13
- package/package.json +5 -5
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Animated, EasingFunction, StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
3
|
+
|
|
5
4
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
6
5
|
|
|
7
6
|
type AnimatedInterpolatedStyle =
|
|
@@ -36,16 +35,11 @@ function getAnimation(config: AnimatedInConfig, phase: "in" | "out") {
|
|
|
36
35
|
return config[phase] || config;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
export function AnimatedInOut({
|
|
40
|
-
visible,
|
|
41
|
-
animationConfig,
|
|
42
|
-
staticStyles = {},
|
|
43
|
-
children,
|
|
44
|
-
}: Props) {
|
|
45
|
-
const [animatedValue] = React.useState(new Animated.Value(visible ? 1 : 0));
|
|
46
|
-
const [animating, setAnimating] = React.useState(undefined);
|
|
38
|
+
export function AnimatedInOut(props: Props) {
|
|
39
|
+
const { visible, animationConfig, children } = props;
|
|
47
40
|
|
|
48
|
-
const
|
|
41
|
+
const [animatedValue] = React.useState(new Animated.Value(visible ? 1 : 0));
|
|
42
|
+
const [animating, setAnimating] = React.useState(null);
|
|
49
43
|
|
|
50
44
|
function startAnimation(toValue, config) {
|
|
51
45
|
if (animating) {
|
|
@@ -61,7 +55,7 @@ export function AnimatedInOut({
|
|
|
61
55
|
delay,
|
|
62
56
|
useNativeDriver: true,
|
|
63
57
|
}).start(() => {
|
|
64
|
-
setAnimating(
|
|
58
|
+
setAnimating(null);
|
|
65
59
|
onAnimationEnd();
|
|
66
60
|
});
|
|
67
61
|
|
|
@@ -69,14 +63,12 @@ export function AnimatedInOut({
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
React.useEffect(() => {
|
|
72
|
-
if (
|
|
66
|
+
if (visible) {
|
|
73
67
|
startAnimation(1.0, getAnimation(animationConfig, "in"));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (previousVisible && !visible) {
|
|
68
|
+
} else {
|
|
77
69
|
startAnimation(0.0, getAnimation(animationConfig, "out"));
|
|
78
70
|
}
|
|
79
|
-
}, [visible,
|
|
71
|
+
}, [visible, animating]);
|
|
80
72
|
|
|
81
73
|
const styles = visible
|
|
82
74
|
? getAnimation(animationConfig, "in").styles
|
|
@@ -85,7 +77,7 @@ export function AnimatedInOut({
|
|
|
85
77
|
return (
|
|
86
78
|
<Animated.View
|
|
87
79
|
renderToHardwareTextureAndroid={animating}
|
|
88
|
-
style={[styles(animatedValue), staticStyles]}
|
|
80
|
+
style={[styles(animatedValue), props?.staticStyles || {}]}
|
|
89
81
|
>
|
|
90
82
|
{children}
|
|
91
83
|
</Animated.View>
|
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import FastImage, {
|
|
4
|
+
FastImageProps,
|
|
5
|
+
} from "@applicaster/react-native-fast-image";
|
|
6
|
+
|
|
7
|
+
export const QBImage = (props: FastImageProps) => {
|
|
8
|
+
const source = React.useMemo(() => {
|
|
9
|
+
if (typeof props.source === "number") {
|
|
10
|
+
return props.source;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
uri: props.source.uri,
|
|
15
|
+
headers: props.source.headers,
|
|
16
|
+
priority: props.source.priority,
|
|
17
|
+
cache: props.source.cache,
|
|
18
|
+
};
|
|
19
|
+
}, [
|
|
20
|
+
...(typeof props.source === "object"
|
|
21
|
+
? [
|
|
22
|
+
props.source?.uri,
|
|
23
|
+
props.source?.priority,
|
|
24
|
+
props.source?.cache,
|
|
25
|
+
props.source?.headers,
|
|
26
|
+
]
|
|
27
|
+
: []),
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
return <FastImage {...props} source={source} />;
|
|
31
|
+
};
|
|
@@ -37,6 +37,11 @@ type Props = {
|
|
|
37
37
|
const defaultStyles = StyleSheet.create({
|
|
38
38
|
playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
|
|
39
39
|
playerDetails: { flex: 1, paddingTop: 20 },
|
|
40
|
+
inlinePlayerContainerDimensions: {
|
|
41
|
+
aspectRatio: 16 / 9,
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: undefined,
|
|
44
|
+
},
|
|
40
45
|
});
|
|
41
46
|
|
|
42
47
|
const orientationStyles = StyleSheet.create({
|
|
@@ -190,12 +195,9 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
190
195
|
defaultStyles.playerContainer,
|
|
191
196
|
containerDimensions,
|
|
192
197
|
containerStyle,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
? containerDimensions.height + 10
|
|
197
|
-
: containerDimensions.height,
|
|
198
|
-
},
|
|
198
|
+
isInlineModal && !docked && !isTabletLandscape
|
|
199
|
+
? defaultStyles.inlinePlayerContainerDimensions
|
|
200
|
+
: {},
|
|
199
201
|
playerDimesionsHack,
|
|
200
202
|
]}
|
|
201
203
|
>
|
|
@@ -40,7 +40,9 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
40
40
|
},
|
|
41
41
|
Object {},
|
|
42
42
|
Object {
|
|
43
|
-
"
|
|
43
|
+
"aspectRatio": 1.7777777777777777,
|
|
44
|
+
"height": undefined,
|
|
45
|
+
"width": "100%",
|
|
44
46
|
},
|
|
45
47
|
Object {},
|
|
46
48
|
]
|
|
@@ -109,9 +111,7 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
109
111
|
"width": 300,
|
|
110
112
|
},
|
|
111
113
|
Object {},
|
|
112
|
-
Object {
|
|
113
|
-
"height": 50,
|
|
114
|
-
},
|
|
114
|
+
Object {},
|
|
115
115
|
Object {},
|
|
116
116
|
]
|
|
117
117
|
}
|
|
@@ -167,9 +167,7 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
167
167
|
"width": 195,
|
|
168
168
|
},
|
|
169
169
|
Object {},
|
|
170
|
-
Object {
|
|
171
|
-
"height": 119.6875,
|
|
172
|
-
},
|
|
170
|
+
Object {},
|
|
173
171
|
Object {},
|
|
174
172
|
]
|
|
175
173
|
}
|
|
@@ -237,9 +235,7 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
237
235
|
"width": 300,
|
|
238
236
|
},
|
|
239
237
|
Object {},
|
|
240
|
-
Object {
|
|
241
|
-
"height": 800,
|
|
242
|
-
},
|
|
238
|
+
Object {},
|
|
243
239
|
Object {},
|
|
244
240
|
]
|
|
245
241
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Dimensions } from "react-native";
|
|
3
3
|
import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
|
|
4
4
|
import {
|
|
@@ -39,22 +39,13 @@ export const useModalSize = (): Size => {
|
|
|
39
39
|
MODAL_SIZE_FOR_PORTRAIT
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const setNewModalSize =
|
|
43
|
-
setModalSize(
|
|
44
|
-
if (
|
|
45
|
-
oldSize.height === newSize.height &&
|
|
46
|
-
oldSize.width === newSize.width
|
|
47
|
-
) {
|
|
48
|
-
return oldSize;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return newSize;
|
|
52
|
-
});
|
|
42
|
+
const setNewModalSize = (size, log) => {
|
|
43
|
+
setModalSize(size);
|
|
53
44
|
|
|
54
45
|
logger.debug({
|
|
55
46
|
message: log,
|
|
56
47
|
});
|
|
57
|
-
}
|
|
48
|
+
};
|
|
58
49
|
|
|
59
50
|
const isTabletLandscape = useIsTabletLandscape();
|
|
60
51
|
|
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.4534459584",
|
|
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",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"redux-mock-store": "^1.5.3"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
41
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
38
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.4534459584",
|
|
39
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4534459584",
|
|
40
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.4534459584",
|
|
41
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4534459584",
|
|
42
42
|
"promise": "^8.3.0",
|
|
43
43
|
"react-router-native": "^5.1.2",
|
|
44
44
|
"url": "^0.11.0",
|