@boneframework/native-components 1.0.22 → 1.0.23
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/hooks/useLocation.js +29 -0
- package/package.json +2 -1
- package/screens/UploadScreen.tsx +39 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {useEffect, useState} from "react";
|
|
2
|
+
import * as Location from "expo-location";
|
|
3
|
+
|
|
4
|
+
export default useLocation = () => {
|
|
5
|
+
const [location, setLocation] = useState();
|
|
6
|
+
|
|
7
|
+
const getLocation = async () => {
|
|
8
|
+
try {
|
|
9
|
+
const {granted} = await Location.requestForegroundPermissionsAsync();
|
|
10
|
+
|
|
11
|
+
if (!granted) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {coords: {longitude, latitude}} = await Location.getLastKnownPositionAsync();
|
|
16
|
+
setLocation({latitude, longitude})
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.log(e)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
getLocation();
|
|
25
|
+
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
return location;
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boneframework/native-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Expo Components for Bone Framework",
|
|
5
5
|
"main": "src/Bone.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"jwt-decode": "^4.0.0",
|
|
46
46
|
"lottie-react-native": "^6.7.2",
|
|
47
47
|
"react": "18.2.0",
|
|
48
|
+
"react-native-progress": "^5.0.1",
|
|
48
49
|
"yup": "^1.4.0"
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Modal, StyleSheet, View} from "react-native";
|
|
3
|
+
import * as Progress from 'react-native-progress';
|
|
4
|
+
|
|
5
|
+
import colors from '../../../../config/colors'
|
|
6
|
+
import Text from '../components/Text'
|
|
7
|
+
import Animation from "../components/Animation";
|
|
8
|
+
|
|
9
|
+
function UploadScreen({onDone, progress = 0, visible = false}) {
|
|
10
|
+
return (
|
|
11
|
+
<Modal visible={visible}>
|
|
12
|
+
<View style={styles.container}>
|
|
13
|
+
{ progress < 1
|
|
14
|
+
? <Progress.Bar color={colors.primary} progress={progress} width={200}/>
|
|
15
|
+
: <Animation
|
|
16
|
+
autoPlay={true}
|
|
17
|
+
loop={false}
|
|
18
|
+
onAnimationFinish={onDone}
|
|
19
|
+
source={require('../assets/animations/done.json')}
|
|
20
|
+
style={styles.animation}
|
|
21
|
+
/>
|
|
22
|
+
}
|
|
23
|
+
</View>
|
|
24
|
+
</Modal>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
flex: 1,
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
},
|
|
34
|
+
animation: {
|
|
35
|
+
width: 150,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export default UploadScreen;
|