@boneframework/native-components 1.0.37 → 1.0.39

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,21 @@
1
+ import React from 'react';
2
+ import { ImageBackground } from "react-native";
3
+ import { LinearGradient } from 'expo-linear-gradient';
4
+
5
+ function Background({children, imagePath = null, gradientColors = null, ...rest}) {
6
+ if (imagePath === null && gradientColors === null) {
7
+ return;
8
+ }
9
+
10
+ if (imagePath !== null) {
11
+ return <ImageBackground source={require(imagePath)} {...rest}>
12
+ { children }
13
+ </ImageBackground>
14
+ }
15
+
16
+ return <LinearGradient colors={gradientColors}>
17
+ { children }
18
+ </LinearGradient>
19
+ }
20
+
21
+ export default Background;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boneframework/native-components",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Expo Components for Bone Framework",
5
5
  "main": "src/Bone.ts",
6
6
  "scripts": {
@@ -50,6 +50,7 @@
50
50
  "react-native-maps": "^1.17.3",
51
51
  "react-native-progress": "^5.0.1",
52
52
  "toggle-switch-react-native": "^3.3.0",
53
- "yup": "^1.4.0"
53
+ "yup": "^1.4.0",
54
+ "expo-linear-gradient": "~13.0.2"
54
55
  }
55
56
  }
@@ -10,10 +10,7 @@ import useApi from "../hooks/useApi";
10
10
  import useAuth from "../hooks/useAuth";
11
11
  import userApi from "../api/users";
12
12
 
13
- import settings from "../../../../config/settings";
14
- import routes from "../../../../config/routes";
15
-
16
- function ActivateUserScreen() {
13
+ function ActivateUserScreen({settings, loginRedirect, resendActivationEmailRedirect}) {
17
14
  const STATUS_BEGIN = 'start_validating';
18
15
  const STATUS_VALIDATE = 'validate_email_token';
19
16
  const STATUS_RESEND = 'resend_email_token';
@@ -83,7 +80,7 @@ function ActivateUserScreen() {
83
80
  return;
84
81
  }
85
82
 
86
- login(convertResponse(result.data)).then(router.navigate(routes.HOME));
83
+ login(convertResponse(result.data)).then(router.navigate(loginRedirect));
87
84
  } catch (error) {
88
85
  setError(error);
89
86
  console.error(error);
@@ -96,7 +93,7 @@ function ActivateUserScreen() {
96
93
  .request(email)
97
94
  .then(setStatus(STATUS_VALIDATE))
98
95
  .then(router.back())
99
- .then(router.navigate(routes.USER_ACTIVATION_CHECK_EMAIL))
96
+ .then(router.navigate(resendActivationEmailRedirect))
100
97
  .catch(console.error);
101
98
  }
102
99
 
@@ -1,7 +1,6 @@
1
1
  import React, {useEffect, useState} from 'react';
2
2
  import {
3
3
  Alert,
4
- Button,
5
4
  KeyboardAvoidingView,
6
5
  Platform,
7
6
  ScrollView,
@@ -9,27 +8,21 @@ import {
9
8
  TouchableWithoutFeedback,
10
9
  View
11
10
  } from "react-native"
12
- import {Field} from "formik";
13
- import * as FileSystem from 'expo-file-system';
14
- import {useAsyncStorage} from "@react-native-async-storage/async-storage";
15
11
  import * as Yup from "yup";
16
12
 
17
- import colors from '../../../../config/colors';
18
- import ImageInput from '../components/ImageInput';
19
13
  import Image from '../components/Image';
20
- import Screen from '../components/Screen';
21
- import Text from '../components/Text';
22
14
  import {Form, FormDateTimePicker, FormField, SubmitButton} from "../components/forms";
23
15
  import ActivityIndicator from "../components/ActivityIndicator";
24
16
  import UploadScreen from "./UploadScreen";
25
17
  import useApi from "../hooks/useApi";
26
18
  import userApi from "../api/users";
27
19
  import useAuth from "../hooks/useAuth";
28
- import useCache from "../hooks/useCache";
29
20
  import useCamera from "../hooks/useCamera";
30
21
  import usePhotos from "../hooks/usePhotos";
31
22
  import useStyle from "../hooks/useStyle";
32
23
 
24
+ import colors from '../../../../config/colors';
25
+
33
26
  const validationSchema = Yup.object().shape({
34
27
  firstname: Yup.string().required().min(2).max(60).label('First name'),
35
28
  middlename: Yup.string().min(1).max(60).label('Middle name'),
@@ -42,7 +42,7 @@ function RegisterScreen({postRegisterUrl}) {
42
42
  <ImageBackground blurRadius={10} style={styles.background} source={require('../../../../assets/background.png')} >
43
43
  <View style={styles.container}>
44
44
  <TouchableOpacity style={styles.cancelButton} onPress={onClose}>
45
- <Icon size={75} name={'close'} />
45
+ <Icon size={75} name={'chevron-left'} />
46
46
  </TouchableOpacity>
47
47
  <Image style={styles.logo} source={require('../../../../assets/logo.png')} />
48
48
 
@@ -81,6 +81,10 @@ const styles = StyleSheet.create({
81
81
  },
82
82
  background: {
83
83
  height: '100%'
84
+ },
85
+ cancelButton: {
86
+ top:10,
87
+ left:-20
84
88
  }
85
89
  })
86
90
 
@@ -1,12 +1,10 @@
1
- import React, {useState} from 'react';
1
+ import React from 'react';
2
2
  import {StyleSheet, View} from "react-native";
3
3
  import * as Yup from "yup";
4
4
 
5
5
  import {ErrorMessage, Form, FormField, SubmitButton} from "../components/forms";
6
6
  import Image from "../components/Image";
7
7
 
8
- import settings from "../../../../config/settings";
9
-
10
8
  const validationSchema = Yup.object().shape({
11
9
  password: Yup.string().required().min(4).label('Password'),
12
10
  confirm: Yup.string().required().oneOf([Yup.ref('password'), null], 'Passwords must match').label('Confirm')
@@ -3,10 +3,47 @@ import {exchangeCodeAsync, makeRedirectUri, useAuthRequest} from "expo-auth-sess
3
3
  import React from 'react';
4
4
  import {Image, ImageBackground, StyleSheet, Text, View} from "react-native";
5
5
 
6
- import Button from '../components/Button'
7
- import colors from '../../../../config/colors'
6
+ import Button from '../components/Button';
7
+
8
+ import colors from '../../../../config/colors';
9
+
10
+ function WelcomeScreen({
11
+ loginOnPress = () => {},
12
+ registerOnPress = () => {},
13
+ title = 'BONE FRAMEWORK',
14
+ isLoading = false,
15
+ logoTopMargin = 70,
16
+ logoWidth = 150,
17
+ logoHeight = 105
18
+ }) {
19
+ const styles = StyleSheet.create({
20
+ background: {
21
+ flex: 1,
22
+ justifyContent: 'flex-end',
23
+ alignItems: 'center',
24
+ },
25
+ logo: {
26
+ width: logoWidth,
27
+ height: logoHeight
28
+ },
29
+ logoContainer: {
30
+ position: 'absolute',
31
+ top: logoTopMargin,
32
+ alignItems: "center"
33
+ },
34
+ buttonContainer: {
35
+ width: "100%",
36
+ padding: 20
37
+ },
38
+ tagline: {
39
+ fontSize: 50,
40
+ fontWeight: 'bold',
41
+ paddingTop: 10,
42
+ color: colors.white,
43
+ textAlign: 'center'
44
+ },
45
+ });
8
46
 
9
- function WelcomeScreen({loginOnPress = () => {}, registerOnPress = () => {}, title = 'BONE FRAMEWORK', isLoading = false}) {
10
47
  return (
11
48
  <ImageBackground blurRadius={10} style={styles.background} source={require('../../../../assets/background.png')} >
12
49
  <ActivityIndicator visible={isLoading} type={'overlay'} />
@@ -21,32 +58,6 @@ function WelcomeScreen({loginOnPress = () => {}, registerOnPress = () => {}, tit
21
58
  </ImageBackground>
22
59
  );
23
60
  }
24
- const styles = StyleSheet.create({
25
- background: {
26
- flex: 1,
27
- justifyContent: 'flex-end',
28
- alignItems: 'center',
29
- },
30
- logo: {
31
- width: 150,
32
- height: 105
33
- },
34
- logoContainer: {
35
- position: 'absolute',
36
- top: 70,
37
- alignItems: "center"
38
- },
39
- buttonContainer: {
40
- width: "100%",
41
- padding: 20
42
- },
43
- tagline: {
44
- fontSize: 50,
45
- fontWeight: 'bold',
46
- paddingTop: 10,
47
- color: colors.white,
48
- textAlign: 'center'
49
- },
50
- });
61
+
51
62
 
52
63
  export default WelcomeScreen;