@boneframework/native-components 1.0.39 → 1.0.40

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.
@@ -2,18 +2,18 @@ import React from 'react';
2
2
  import { ImageBackground } from "react-native";
3
3
  import { LinearGradient } from 'expo-linear-gradient';
4
4
 
5
- function Background({children, imagePath = null, gradientColors = null, ...rest}) {
6
- if (imagePath === null && gradientColors === null) {
5
+ function Background({children, imageSource = null, gradientColors = null, blurRadius= 10, ...rest}) {
6
+ if (imageSource === null && gradientColors === null) {
7
7
  return;
8
8
  }
9
9
 
10
- if (imagePath !== null) {
11
- return <ImageBackground source={require(imagePath)} {...rest}>
10
+ if (imageSource !== null) {
11
+ return <ImageBackground source={imageSource} blurRadius={blurRadius} {...rest}>
12
12
  { children }
13
13
  </ImageBackground>
14
14
  }
15
15
 
16
- return <LinearGradient colors={gradientColors}>
16
+ return <LinearGradient colors={gradientColors} {...rest}>
17
17
  { children }
18
18
  </LinearGradient>
19
19
  }
@@ -35,7 +35,7 @@ function ListItemSwipable({title, subtitle, image, IconComponent, onPress, rende
35
35
  },
36
36
  title: {
37
37
  color: style.text.color,
38
- fontWeight: "500"
38
+ fontSize: 14
39
39
  },
40
40
  subtitle: {
41
41
  color: colors.medium
package/hooks/useApi.js CHANGED
@@ -8,9 +8,20 @@ export default useApi = (apiFunc) => {
8
8
 
9
9
  const request = async (...args) => {
10
10
  setLoading(true);
11
- const response = await apiFunc(...args);
11
+ const response = await apiFunc(...args)
12
+ .then(result => {
13
+ setError(!result.ok);
14
+
15
+ return result;
16
+ }, reason => {
17
+ setError(true);
18
+
19
+ return {headers: [], data: reason};
20
+ })
21
+ .catch(() => {
22
+ setError(true);
23
+ });
12
24
  setLoading(false);
13
- setError(!response.ok);
14
25
  setHeaders(response.headers);
15
26
  setData(response.data);
16
27
  return response;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@boneframework/native-components",
3
- "version": "1.0.39",
4
- "description": "Expo Components for Bone Framework",
3
+ "version": "1.0.40",
4
+ "description": "Expo React Native Components for Bone Framework",
5
5
  "main": "src/Bone.ts",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@react-native-async-storage/async-storage": "^1.24.0",
32
+ "@react-native-async-storage/async-storage": "^2.0.0",
33
33
  "@react-native-community/datetimepicker": "^8.2.0",
34
34
  "@react-native-community/netinfo": "^11.3.2",
35
35
  "apisauce": "^3.0.1",
@@ -39,18 +39,19 @@
39
39
  "expo-device": "^6.0.2",
40
40
  "expo-image": "^1.12.13",
41
41
  "expo-image-picker": "^15.0.7",
42
+ "expo-linear-gradient": "~13.0.2",
42
43
  "expo-location": "~17.0.1",
43
- "expo-notifications": "^0.28.11",
44
+ "expo-notifications": "^0.28.19",
44
45
  "expo-router": "^3.5.23",
45
46
  "expo-secure-store": "^13.0.2",
46
47
  "formik": "^2.4.6",
47
48
  "jwt-decode": "^4.0.0",
48
- "lottie-react-native": "^6.7.2",
49
- "react": "18.2.0",
50
- "react-native-maps": "^1.17.3",
49
+ "lottie-react-native": "^7.1.0",
50
+ "react": "18.3.1",
51
+ "react-native-gesture-handler": "^2.20.2",
52
+ "react-native-maps": "^1.20.0",
51
53
  "react-native-progress": "^5.0.1",
52
54
  "toggle-switch-react-native": "^3.3.0",
53
- "yup": "^1.4.0",
54
- "expo-linear-gradient": "~13.0.2"
55
+ "yup": "^1.4.0"
55
56
  }
56
57
  }
@@ -3,14 +3,17 @@ import {router, useGlobalSearchParams} from 'expo-router';
3
3
  import React, {useEffect, useState} from "react";
4
4
 
5
5
  import ActivityIndicator from "../components/ActivityIndicator";
6
+ import Background from "../components/Background";
6
7
  import {ErrorMessage, Form, FormField, SubmitButton} from "../components/forms";
7
8
  import ResendActivationScreen from "../screens/ResendActivationlScreen";
8
9
  import SetPasswordScreen from "../screens/SetPasswordScreen";
9
10
  import useApi from "../hooks/useApi";
10
11
  import useAuth from "../hooks/useAuth";
12
+
11
13
  import userApi from "../api/users";
14
+ import colors from '../../../../config/colors';
12
15
 
13
- function ActivateUserScreen({settings, loginRedirect, resendActivationEmailRedirect}) {
16
+ function ActivateUserScreen({settings, loginRedirect, resendActivationEmailRedirect, backgroundSource = null}) {
14
17
  const STATUS_BEGIN = 'start_validating';
15
18
  const STATUS_VALIDATE = 'validate_email_token';
16
19
  const STATUS_RESEND = 'resend_email_token';
@@ -106,10 +109,10 @@ function ActivateUserScreen({settings, loginRedirect, resendActivationEmailRedir
106
109
  return (
107
110
  <>
108
111
  <ActivityIndicator visible={activationApi.loading || resendActivationApi.loading || validateEmailTokenApi.loading} type={'overlay'}/>
109
- <ImageBackground blurRadius={10} style={styles.container} source={require('../../../../assets/background.png')} >
112
+ <Background blurRadius={10} style={styles.container} imageSource={backgroundSource} gradientColors={colors.bgGradient} >
110
113
  { (status === STATUS_SET_PASSWORD || status === STATUS_VALIDATE) && <SetPasswordScreen submitCallback={handleSubmit} error={error}/> }
111
114
  { status === STATUS_RESEND && <ResendActivationScreen email={email} tokenError={tokenError} submitCallback={resendActivationEmail}/> }
112
- </ImageBackground>
115
+ </Background>
113
116
  </>
114
117
  );
115
118
  }
@@ -1,15 +1,16 @@
1
- import {ImageBackground, StyleSheet, View} from "react-native";
1
+ import {StyleSheet, View} from "react-native";
2
2
  import React from "react";
3
3
 
4
- import Text from '../components/Text';
5
4
  import Animation from "../components/Animation";
5
+ import Background from "../components/Background";
6
+ import Text from '../components/Text';
6
7
 
7
8
  import colors from "../../../../config/colors";
8
9
 
9
- function CheckEmailScreen(props) {
10
+ function CheckEmailScreen({backgroundSource = null}) {
10
11
 
11
12
  return (
12
- <ImageBackground blurRadius={10} style={styles.container} source={require('../../../../assets/background.png')} >
13
+ <Background blurRadius={10} style={styles.container} imageSource={backgroundSource} gradientColors={colors.bgGradient} >
13
14
  <View style={styles.animationContainer}>
14
15
  <Animation
15
16
  autoPlay={true}
@@ -21,7 +22,7 @@ function CheckEmailScreen(props) {
21
22
  <Text style={styles.activate}>Activate your account</Text>
22
23
  <Text style={styles.info}>Check your email and click on the link to open the app and activate your account.</Text>
23
24
  </View>
24
- </ImageBackground>
25
+ </Background>
25
26
  );
26
27
  }
27
28
 
@@ -4,16 +4,19 @@ import {Image, ImageBackground, Keyboard, StyleSheet, TouchableOpacity, View} fr
4
4
  import * as Yup from 'yup'
5
5
 
6
6
  import ActivityIndicator from "../components/ActivityIndicator";
7
+ import Background from "../components/Background";
7
8
  import useApi from "../hooks/useApi";
8
9
  import usersApi from '../api/users';
9
10
  import {ErrorMessage, FormField, Form, SubmitButton} from '../components/forms'
10
11
  import Icon from "../components/Icon";
11
12
 
13
+ import colors from "../../../../config/colors";
14
+
12
15
  const validationSchema = Yup.object().shape({
13
16
  email: Yup.string().required().email().label('Email'),
14
17
  });
15
18
 
16
- function RegisterScreen({postRegisterUrl}) {
19
+ function RegisterScreen({postRegisterUrl, backgroundSource = null}) {
17
20
  const registerApi = useApi(usersApi.register);
18
21
  const [error, setError] = useState();
19
22
  const onClose = () => router.back();
@@ -39,7 +42,7 @@ function RegisterScreen({postRegisterUrl}) {
39
42
  return (
40
43
  <>
41
44
  <ActivityIndicator visible={registerApi.loading} type={'overlay'}/>
42
- <ImageBackground blurRadius={10} style={styles.background} source={require('../../../../assets/background.png')} >
45
+ <Background imageSource={backgroundSource} blurRadius={10} style={styles.background} gradientColors={colors.bgGradient} >
43
46
  <View style={styles.container}>
44
47
  <TouchableOpacity style={styles.cancelButton} onPress={onClose}>
45
48
  <Icon size={75} name={'chevron-left'} />
@@ -63,7 +66,7 @@ function RegisterScreen({postRegisterUrl}) {
63
66
  <SubmitButton color="primary" title="Register" />
64
67
  </Form>
65
68
  </View>
66
- </ImageBackground>
69
+ </Background>
67
70
  </>
68
71
  );
69
72
  }
@@ -2,9 +2,8 @@ import React from 'react';
2
2
  import {Modal, StyleSheet, View} from "react-native";
3
3
  import * as Progress from 'react-native-progress';
4
4
 
5
- import colors from '../../../../config/colors'
6
- import Text from '../components/Text'
7
5
  import Animation from "../components/Animation";
6
+ import colors from '../../../../config/colors';
8
7
 
9
8
  function UploadScreen({onDone, progress = 0, visible = false, animationSource = '../../../../assets/animations/done.json'}) {
10
9
  return (
@@ -1,8 +1,9 @@
1
- import ActivityIndicator from "@boneframework/native-components/components/ActivityIndicator";
2
1
  import {exchangeCodeAsync, makeRedirectUri, useAuthRequest} from "expo-auth-session";
3
2
  import React from 'react';
4
- import {Image, ImageBackground, StyleSheet, Text, View} from "react-native";
3
+ import {Image, StyleSheet, Text, View} from "react-native";
5
4
 
5
+ import ActivityIndicator from "../components/ActivityIndicator";
6
+ import Background from '../components/Background';
6
7
  import Button from '../components/Button';
7
8
 
8
9
  import colors from '../../../../config/colors';
@@ -14,7 +15,8 @@ function WelcomeScreen({
14
15
  isLoading = false,
15
16
  logoTopMargin = 70,
16
17
  logoWidth = 150,
17
- logoHeight = 105
18
+ logoHeight = 105,
19
+ backgroundSource = null
18
20
  }) {
19
21
  const styles = StyleSheet.create({
20
22
  background: {
@@ -45,7 +47,7 @@ function WelcomeScreen({
45
47
  });
46
48
 
47
49
  return (
48
- <ImageBackground blurRadius={10} style={styles.background} source={require('../../../../assets/background.png')} >
50
+ <Background imageSource={backgroundSource} blurRadius={10} style={styles.background} gradientColors={colors.bgGradient}>
49
51
  <ActivityIndicator visible={isLoading} type={'overlay'} />
50
52
  <View style={styles.logoContainer}>
51
53
  <Image style={styles.logo} source={require('../../../../assets/logo.png')} />
@@ -55,7 +57,7 @@ function WelcomeScreen({
55
57
  <Button title="login" color="primary" onPress={loginOnPress} ></Button>
56
58
  <Button title="register" color="secondary" onPress={registerOnPress}></Button>
57
59
  </View>
58
- </ImageBackground>
60
+ </Background>
59
61
  );
60
62
  }
61
63