@planningcenter/chat-react-native 3.13.0-rc.1 → 3.13.0-rc.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAoBrE,UAAU,YAAY;IACpB;;SAEK;IACL,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAED,wBAAgB,OAAO,CAAC,EACtB,IAAS,EACT,qBAA+C,EAC/C,KAAK,GACN,EAAE,YAAY,qBAkCd"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withTiming, Easing, } from 'react-native-reanimated';
|
|
3
4
|
import { useFontScale, useTheme } from '../../hooks';
|
|
4
5
|
// =================================
|
|
5
6
|
// ====== Constants ================
|
|
6
7
|
// =================================
|
|
7
8
|
const PREVENT_SCALING_DEFAULT = 1;
|
|
8
9
|
export function Spinner({ size = 20, maxFontSizeMultiplier = PREVENT_SCALING_DEFAULT, style, }) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}));
|
|
16
|
-
const rotateValue = rotation.interpolate({
|
|
17
|
-
inputRange: [0, 1],
|
|
18
|
-
outputRange: ['0deg', '360deg'],
|
|
10
|
+
const styles = useStyles({ maxFontSizeMultiplier, size });
|
|
11
|
+
const rotation = useSharedValue(0);
|
|
12
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
13
|
+
return {
|
|
14
|
+
transform: [{ rotate: `${rotation.value}deg` }],
|
|
15
|
+
};
|
|
19
16
|
});
|
|
20
|
-
const styles = useStyles({ maxFontSizeMultiplier, rotateValue, size });
|
|
21
17
|
useEffect(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
rotation.value = withRepeat(withTiming(360, {
|
|
19
|
+
duration: 1000,
|
|
20
|
+
easing: Easing.linear,
|
|
21
|
+
}), -1 // loops animation infinitely
|
|
22
|
+
);
|
|
23
|
+
return () => {
|
|
24
|
+
rotation.value = 0; // Reset rotation when Spinner unmounts
|
|
25
|
+
};
|
|
26
|
+
}, [rotation]);
|
|
26
27
|
return (<View style={[styles.container, style]}>
|
|
27
|
-
<Animated.View style={styles.animatedContainer}>
|
|
28
|
+
<Animated.View style={[styles.animatedContainer, animatedStyle]}>
|
|
28
29
|
<View style={styles.clipping}>
|
|
29
30
|
<View style={[styles.circle, styles.spinner]}/>
|
|
30
31
|
</View>
|
|
@@ -32,7 +33,7 @@ export function Spinner({ size = 20, maxFontSizeMultiplier = PREVENT_SCALING_DEF
|
|
|
32
33
|
</Animated.View>
|
|
33
34
|
</View>);
|
|
34
35
|
}
|
|
35
|
-
const useStyles = ({ maxFontSizeMultiplier,
|
|
36
|
+
const useStyles = ({ maxFontSizeMultiplier, size }) => {
|
|
36
37
|
const { colors } = useTheme();
|
|
37
38
|
const fontScale = useFontScale({ maxFontSizeMultiplier });
|
|
38
39
|
const scalableSize = size * fontScale;
|
|
@@ -44,7 +45,6 @@ const useStyles = ({ maxFontSizeMultiplier, rotateValue, size }) => {
|
|
|
44
45
|
width: scalableSize,
|
|
45
46
|
height: scalableSize,
|
|
46
47
|
borderRadius: scalableSize / 2,
|
|
47
|
-
transform: [{ rotate: rotateValue }],
|
|
48
48
|
},
|
|
49
49
|
circle: {
|
|
50
50
|
width: scalableSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAa,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AACrE,OAAO,QAAQ,EAAE,EACf,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,MAAM,GACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEpD,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAqBjC,MAAM,UAAU,OAAO,CAAC,EACtB,IAAI,GAAG,EAAE,EACT,qBAAqB,GAAG,uBAAuB,EAC/C,KAAK,GACQ;IACb,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAA;IAEzD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;IAClC,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,EAAE;QAC1C,OAAO;YACL,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,KAAK,EAAE,CAAC;SAChD,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,C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AAE;YACT,OAAO,EAAE,GAAG;SACb;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,YAAY;YACpB,YAAY,EAAE,YAAY,GAAG,CAAC;SAC/B;QACD,MAAM,EAAE;YACN,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,YAAY;YACpB,YAAY,EAAE,YAAY,GAAG,CAAC;YAC9B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,CAAC;SACf;QACD,OAAO,EAAE;YACP,WAAW,EAAE,MAAM,CAAC,mBAAmB;SACxC;QACD,KAAK,EAAE;YACL,WAAW,EAAE,MAAM,CAAC,uBAAuB;SAC5C;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,YAAY,GAAG,CAAC;YACvB,MAAM,EAAE,YAAY,GAAG,CAAC;YACxB,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,GAAG;SACZ;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useEffect } from 'react'\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withRepeat,\n withTiming,\n Easing,\n} from 'react-native-reanimated'\nimport { useFontScale, useTheme } from '../../hooks'\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst PREVENT_SCALING_DEFAULT = 1\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface SpinnerProps {\n /**\n * Size of the spinner in px\n * */\n size?: number\n /**\n * Specifies the maximum size spinner can scale to if the device's font-size is increased.\n */\n maxFontSizeMultiplier?: number\n /**\n * Style to apply to the spinner\n */\n style?: StyleProp<ViewStyle>\n}\n\nexport function Spinner({\n size = 20,\n maxFontSizeMultiplier = PREVENT_SCALING_DEFAULT,\n style,\n}: SpinnerProps) {\n const styles = useStyles({ maxFontSizeMultiplier, size })\n\n const rotation = useSharedValue(0)\n const animatedStyle = useAnimatedStyle(() => {\n return {\n transform: [{ rotate: `${rotation.value}deg` }],\n }\n })\n\n useEffect(() => {\n rotation.value = withRepeat(\n withTiming(360, {\n duration: 1000,\n easing: Easing.linear,\n }),\n -1 // loops animation infinitely\n )\n\n return () => {\n rotation.value = 0 // Reset rotation when Spinner unmounts\n }\n }, [rotation])\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedContainer, animatedStyle]}>\n <View style={styles.clipping}>\n <View style={[styles.circle, styles.spinner]} />\n </View>\n <View style={[styles.circle, styles.track]} />\n </Animated.View>\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\ninterface Styles {\n maxFontSizeMultiplier: number | undefined\n size: number\n}\n\nconst useStyles = ({ maxFontSizeMultiplier, size }: Styles) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n const scalableSize = size * fontScale\n\n return StyleSheet.create({\n container: {\n opacity: 0.7,\n },\n animatedContainer: {\n width: scalableSize,\n height: scalableSize,\n borderRadius: scalableSize / 2,\n },\n circle: {\n width: scalableSize,\n height: scalableSize,\n borderRadius: scalableSize / 2,\n borderStyle: 'solid',\n borderWidth: 3,\n },\n spinner: {\n borderColor: colors.fillColorNeutral020,\n },\n track: {\n borderColor: colors.fillColorNeutral050Base,\n },\n clipping: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: scalableSize / 2,\n height: scalableSize / 2,\n overflow: 'hidden',\n zIndex: 200,\n },\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.13.0-rc.
|
|
3
|
+
"version": "3.13.0-rc.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react-native-url-polyfill": "^2.0.0",
|
|
56
56
|
"typescript": "<5.6.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a2339286dfdae60c06d84e7b1387f4159510bf86"
|
|
59
59
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
+
import Animated, {
|
|
4
|
+
useSharedValue,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
withRepeat,
|
|
7
|
+
withTiming,
|
|
8
|
+
Easing,
|
|
9
|
+
} from 'react-native-reanimated'
|
|
3
10
|
import { useFontScale, useTheme } from '../../hooks'
|
|
4
11
|
|
|
5
12
|
// =================================
|
|
@@ -32,34 +39,32 @@ export function Spinner({
|
|
|
32
39
|
maxFontSizeMultiplier = PREVENT_SCALING_DEFAULT,
|
|
33
40
|
style,
|
|
34
41
|
}: SpinnerProps) {
|
|
35
|
-
const
|
|
42
|
+
const styles = useStyles({ maxFontSizeMultiplier, size })
|
|
36
43
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
useNativeDriver: true,
|
|
43
|
-
})
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const rotateValue = rotation.interpolate({
|
|
47
|
-
inputRange: [0, 1],
|
|
48
|
-
outputRange: ['0deg', '360deg'],
|
|
44
|
+
const rotation = useSharedValue(0)
|
|
45
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
46
|
+
return {
|
|
47
|
+
transform: [{ rotate: `${rotation.value}deg` }],
|
|
48
|
+
}
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
const styles = useStyles({ maxFontSizeMultiplier, rotateValue, size })
|
|
52
|
-
|
|
53
51
|
useEffect(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
rotation.value = withRepeat(
|
|
53
|
+
withTiming(360, {
|
|
54
|
+
duration: 1000,
|
|
55
|
+
easing: Easing.linear,
|
|
56
|
+
}),
|
|
57
|
+
-1 // loops animation infinitely
|
|
58
|
+
)
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
return () => {
|
|
61
|
+
rotation.value = 0 // Reset rotation when Spinner unmounts
|
|
62
|
+
}
|
|
63
|
+
}, [rotation])
|
|
59
64
|
|
|
60
65
|
return (
|
|
61
66
|
<View style={[styles.container, style]}>
|
|
62
|
-
<Animated.View style={styles.animatedContainer}>
|
|
67
|
+
<Animated.View style={[styles.animatedContainer, animatedStyle]}>
|
|
63
68
|
<View style={styles.clipping}>
|
|
64
69
|
<View style={[styles.circle, styles.spinner]} />
|
|
65
70
|
</View>
|
|
@@ -75,11 +80,10 @@ export function Spinner({
|
|
|
75
80
|
|
|
76
81
|
interface Styles {
|
|
77
82
|
maxFontSizeMultiplier: number | undefined
|
|
78
|
-
rotateValue: Animated.AnimatedInterpolation<string | number>
|
|
79
83
|
size: number
|
|
80
84
|
}
|
|
81
85
|
|
|
82
|
-
const useStyles = ({ maxFontSizeMultiplier,
|
|
86
|
+
const useStyles = ({ maxFontSizeMultiplier, size }: Styles) => {
|
|
83
87
|
const { colors } = useTheme()
|
|
84
88
|
const fontScale = useFontScale({ maxFontSizeMultiplier })
|
|
85
89
|
const scalableSize = size * fontScale
|
|
@@ -92,7 +96,6 @@ const useStyles = ({ maxFontSizeMultiplier, rotateValue, size }: Styles) => {
|
|
|
92
96
|
width: scalableSize,
|
|
93
97
|
height: scalableSize,
|
|
94
98
|
borderRadius: scalableSize / 2,
|
|
95
|
-
transform: [{ rotate: rotateValue }],
|
|
96
99
|
},
|
|
97
100
|
circle: {
|
|
98
101
|
width: scalableSize,
|