@rpcbase/ui 0.5.0
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fullyTracked":true,"platform":"linux","arch":"x64","nodeVersion":"v18.19.0","command":"node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME","extraArgs":[],"clean":true,"files":{"/home/runner/work/rpcbase/rpcbase/pkg/ui/package.json":"196c030bb35a111fe63385f1450d242da1868720f3e192758a4b16e442a8e12b","/home/runner/work/rpcbase/rpcbase/pkg/ui/yarn.lock":"38df2378ed26e20124d8c38a945af1b4a058656aab3b3b1f71a9d8a629cc0d81","/home/runner/work/rpcbase/rpcbase/yarn.lock":"6418e6930bf35b3c31e73c88c6bf21b0f4033a3a8a4e6470477cdf77088e96f1"},"output":[],"dependencies":{},"env":{"BRANCH_NAME":"master"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
File without changes
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
import assert from "assert"
|
|
3
|
+
import {useEffect, useRef} from "react"
|
|
4
|
+
import {Animated, StyleSheet, View, ViewStyle} from "react-native"
|
|
5
|
+
|
|
6
|
+
import {withStyles} from "@ui-kitten/components"
|
|
7
|
+
import {SpinnerAnimation} from "@ui-kitten/components/ui/spinner/animation"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type SizeType = {width: number, height: number}
|
|
11
|
+
|
|
12
|
+
type ArcElementStyle = {
|
|
13
|
+
container: ViewStyle,
|
|
14
|
+
arc: ViewStyle,
|
|
15
|
+
overflow?: ViewStyle,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
noOverflow: {
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const ActivityIndicator = ({
|
|
25
|
+
animating = true,
|
|
26
|
+
size = 24,
|
|
27
|
+
strokeWidth = 2.6,
|
|
28
|
+
duration = 1600,
|
|
29
|
+
color = "#007BFF",
|
|
30
|
+
testID = "activity-indicator",
|
|
31
|
+
style = {},
|
|
32
|
+
}) => {
|
|
33
|
+
const animationRef = useRef(new SpinnerAnimation(size, {duration}))
|
|
34
|
+
|
|
35
|
+
assert(typeof size === "number")
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!animationRef.current) {
|
|
39
|
+
animationRef.current = new SpinnerAnimation(size, {duration})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
animationRef.current?.stop()
|
|
44
|
+
animationRef.current?.release()
|
|
45
|
+
}
|
|
46
|
+
}, [size])
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (animating) {
|
|
50
|
+
animationRef.current?.start()
|
|
51
|
+
} else {
|
|
52
|
+
animationRef.current?.stop()
|
|
53
|
+
}
|
|
54
|
+
}, [animating])
|
|
55
|
+
|
|
56
|
+
const getComponentStyle = (
|
|
57
|
+
source: SpinnerAnimation,
|
|
58
|
+
): {start: ArcElementStyle, end: ArcElementStyle} => {
|
|
59
|
+
const start: ArcElementStyle = {
|
|
60
|
+
container: source.container,
|
|
61
|
+
arc: source.start,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const end: ArcElementStyle = {
|
|
65
|
+
container: source.container,
|
|
66
|
+
arc: source.end,
|
|
67
|
+
overflow: {top: size / 2},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {start, end}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const renderArcElement = (arcStyle: ArcElementStyle): React.Element<typeof View> => {
|
|
74
|
+
const arcSize: SizeType = {width: size, height: size / 2}
|
|
75
|
+
|
|
76
|
+
const spinnerStyle = {
|
|
77
|
+
borderColor: color,
|
|
78
|
+
borderRadius: size,
|
|
79
|
+
borderWidth: strokeWidth,
|
|
80
|
+
height: size,
|
|
81
|
+
width: size,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Animated.View
|
|
86
|
+
style={[StyleSheet.absoluteFill, arcStyle.container, {width: size, height: size}]}
|
|
87
|
+
>
|
|
88
|
+
<View style={[styles.noOverflow, arcStyle.overflow, arcSize]}>
|
|
89
|
+
<Animated.View style={[arcStyle.arc, {width: size, height: size}]}>
|
|
90
|
+
<View style={[styles.noOverflow, arcSize]}>
|
|
91
|
+
<View style={[spinnerStyle]} />
|
|
92
|
+
</View>
|
|
93
|
+
</Animated.View>
|
|
94
|
+
</View>
|
|
95
|
+
</Animated.View>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!animationRef.current) {
|
|
100
|
+
return null
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const evaStyle = getComponentStyle(animationRef.current?.toProps())
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<View testID={testID} style={{width: size, height: size, ...style}}>
|
|
107
|
+
{renderArcElement(evaStyle.start)}
|
|
108
|
+
{renderArcElement(evaStyle.end)}
|
|
109
|
+
</View>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default withStyles(ActivityIndicator, () => ({}))
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rpcbase/ui",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"license": "SSPL-1.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 0"
|
|
10
|
+
},
|
|
11
|
+
"wireit": {
|
|
12
|
+
"install": {
|
|
13
|
+
"command": "NODE_ENV=development yarn install --mutex network --frozen-lockfile",
|
|
14
|
+
"files": [
|
|
15
|
+
"yarn.lock"
|
|
16
|
+
],
|
|
17
|
+
"output": [
|
|
18
|
+
"node_modules/"
|
|
19
|
+
],
|
|
20
|
+
"allowUsuallyExcludedPaths": true
|
|
21
|
+
},
|
|
22
|
+
"apply-version": {
|
|
23
|
+
"command": "node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME",
|
|
24
|
+
"files": [
|
|
25
|
+
"package.json"
|
|
26
|
+
],
|
|
27
|
+
"output": [],
|
|
28
|
+
"env": {
|
|
29
|
+
"BRANCH_NAME": {
|
|
30
|
+
"external": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"release": {
|
|
35
|
+
"command": "npm publish --access public --tag $NPM_RELEASE_CHANNEL | tee publish-output.txt",
|
|
36
|
+
"dependencies": [
|
|
37
|
+
"apply-version"
|
|
38
|
+
],
|
|
39
|
+
"files": [
|
|
40
|
+
"package.json"
|
|
41
|
+
],
|
|
42
|
+
"output": [
|
|
43
|
+
"publish-output.txt"
|
|
44
|
+
],
|
|
45
|
+
"env": {
|
|
46
|
+
"NPM_RELEASE_CHANNEL": {
|
|
47
|
+
"external": true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
File without changes
|