@boneframework/native-components 1.0.9 → 1.0.11
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/components/ActivityIndicator.js +1 -1
- package/components/ApiInterceptor.js +1 -1
- package/components/Card.js +1 -1
- package/components/Image.js +1 -1
- package/components/ImageInput.tsx +1 -1
- package/components/ListItemDeleteAction.tsx +1 -1
- package/components/ListItemFlipswitch.tsx +1 -1
- package/components/ListItemSeparator.tsx +1 -1
- package/components/ListItemSwipable.tsx +1 -1
- package/components/OfflineNotice.tsx +1 -1
- package/components/RoundIconButton.tsx +1 -1
- package/components/Text.tsx +2 -2
- package/components/forms/FormDateTimePicker.js +2 -1
- package/hooks/useCamera.js +29 -0
- package/hooks/usePhotos.js +28 -0
- package/hooks/useStyle.js +2 -2
- package/package.json +3 -1
- package/screens/RegisterScreen.tsx +2 -2
- package/screens/WelcomeScreen.tsx +2 -2
- package/utilities/logger.ts +26 -0
|
@@ -35,7 +35,7 @@ function ActivityIndicator({ visible = false , type="default"}) {
|
|
|
35
35
|
return (
|
|
36
36
|
<View style={style}>
|
|
37
37
|
<Animation
|
|
38
|
-
source={require('
|
|
38
|
+
source={require.main.require('assets/animations/loader.json')}
|
|
39
39
|
autoPlay={true}
|
|
40
40
|
loop={true}
|
|
41
41
|
style={{height: 100, width: 100, opacity: 1}}
|
|
@@ -2,7 +2,7 @@ import React, {useEffect} from 'react';
|
|
|
2
2
|
|
|
3
3
|
import apiClient from "../api/client";
|
|
4
4
|
import authStorage from "../auth/storage";
|
|
5
|
-
import settings from "
|
|
5
|
+
import settings from "../../../../config/settings";
|
|
6
6
|
import useAuth from '../hooks/useAuth';
|
|
7
7
|
|
|
8
8
|
// call to refresh an access token using our refresh token
|
package/components/Card.js
CHANGED
|
@@ -3,7 +3,7 @@ import {StyleSheet, TouchableWithoutFeedback, View} from "react-native";
|
|
|
3
3
|
import {Image} from 'react-native-expo-image-cache';
|
|
4
4
|
|
|
5
5
|
import Text from './Text'
|
|
6
|
-
import colors from '
|
|
6
|
+
import colors from '../../../../config/colors'
|
|
7
7
|
import useStyle from "../hooks/useStyle";
|
|
8
8
|
|
|
9
9
|
function Card({title, subtitle, imageUrl, onPress, thumbnaiilUrl}) {
|
package/components/Image.js
CHANGED
|
@@ -5,7 +5,7 @@ import storage from '../auth/storage';
|
|
|
5
5
|
import * as Notifications from "expo-notifications";
|
|
6
6
|
import useAuth from "../hooks/useAuth";
|
|
7
7
|
import authStorage from "../auth/storage";
|
|
8
|
-
import settings from '
|
|
8
|
+
import settings from '../../../../config/api';
|
|
9
9
|
import AuthContext from "../auth/context";
|
|
10
10
|
|
|
11
11
|
function Image({style, uri, onPress, handleError, source}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useEffect} from 'react';
|
|
2
2
|
import {Alert, Image, StyleSheet, TouchableWithoutFeedback, View} from "react-native";
|
|
3
3
|
|
|
4
|
-
import colors from '
|
|
4
|
+
import colors from '../../../../config/colors'
|
|
5
5
|
import Icon from './Icon';
|
|
6
6
|
import useCamera from '../hooks/useCamera';
|
|
7
7
|
import usePhotos from '../hooks/usePhotos';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {StyleSheet, TouchableWithoutFeedback, View} from "react-native";
|
|
3
3
|
import {MaterialCommunityIcons} from '@expo/vector-icons';
|
|
4
4
|
|
|
5
|
-
import colors from '
|
|
5
|
+
import colors from '../../../../config/colors'
|
|
6
6
|
|
|
7
7
|
function ListItemDeleteAction({onPress}) {
|
|
8
8
|
return (
|
|
@@ -5,7 +5,7 @@ import Image from "./Image";
|
|
|
5
5
|
import {MaterialCommunityIcons} from "@expo/vector-icons";
|
|
6
6
|
|
|
7
7
|
import Text from '../components/Text'
|
|
8
|
-
import colors from
|
|
8
|
+
import colors from '../../../../config/colors';
|
|
9
9
|
import useStyle from "../hooks/useStyle";
|
|
10
10
|
|
|
11
11
|
function ListItemFlipswitch({title, subtitle, IconComponent, isOn, onColor, offColor, onToggle = () => {}}) {
|
|
@@ -4,7 +4,7 @@ import Swipeable from 'react-native-gesture-handler/Swipeable';
|
|
|
4
4
|
|
|
5
5
|
import Image from '../components/Image'
|
|
6
6
|
import Text from '../components/Text'
|
|
7
|
-
import colors from '
|
|
7
|
+
import colors from '../../../../config/colors'
|
|
8
8
|
import {MaterialCommunityIcons} from "@expo/vector-icons";
|
|
9
9
|
import useStyle from "../hooks/useStyle";
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {StyleSheet, View} from "react-native";
|
|
3
3
|
import {useNetInfo} from "@react-native-community/netinfo";
|
|
4
4
|
|
|
5
|
-
import colors from
|
|
5
|
+
import colors from '../../../../config/colors';
|
|
6
6
|
import Text from "./Text";
|
|
7
7
|
|
|
8
8
|
function OfflineNotice(props) {
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {StyleSheet, TouchableOpacity, View} from "react-native";
|
|
3
3
|
import {MaterialCommunityIcons} from "@expo/vector-icons";
|
|
4
4
|
|
|
5
|
-
import colors from '
|
|
5
|
+
import colors from '../../../../config/colors'
|
|
6
6
|
|
|
7
7
|
function RoundIconButton({ icon, onPress = () => {}, style }) {
|
|
8
8
|
const combinedStyle = { ...styles.container, ...style };
|
package/components/Text.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Text as NativeText, StyleSheet} from "react-native";
|
|
3
3
|
|
|
4
|
-
import defaultStyles from '
|
|
5
|
-
import colors from "
|
|
4
|
+
import defaultStyles from '../../../../config/styles'
|
|
5
|
+
import colors from "../../../../config/colors";
|
|
6
6
|
|
|
7
7
|
function Text({children, style, ...otherProps}) {
|
|
8
8
|
return (
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import RNDateTimePicker from '@react-native-community/datetimepicker';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import {StyleSheet} from "react-native";
|
|
3
4
|
import {Field, useFormikContext} from "formik";
|
|
5
|
+
|
|
4
6
|
import DateTimePicker from "../DateTimePicker";
|
|
5
|
-
import {StyleSheet} from "react-native";
|
|
6
7
|
import useStyle from "../../hooks/useStyle";
|
|
7
8
|
|
|
8
9
|
function FormDateTimePicker ({...props}) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {useEffect} from "react";
|
|
2
|
+
import { Camera } from 'expo-camera';
|
|
3
|
+
import * as ImagePicker from "expo-image-picker";
|
|
4
|
+
|
|
5
|
+
export default useCamera = () => {
|
|
6
|
+
|
|
7
|
+
const requestPermission = async () => {
|
|
8
|
+
const { granted } = await Camera.requestCameraPermissionsAsync();
|
|
9
|
+
|
|
10
|
+
if (!granted) {
|
|
11
|
+
Alert.alert(
|
|
12
|
+
'Device settings alert',
|
|
13
|
+
'You need to allow camera permissions for this to work'
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const takePhoto = async (options) => {
|
|
19
|
+
options = {mediaTypes: ImagePicker.MediaTypeOptions.Images, ...options };
|
|
20
|
+
|
|
21
|
+
return await ImagePicker.launchCameraAsync(options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
requestPermission();
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
return {takePhoto};
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {useEffect} from "react";
|
|
2
|
+
import * as ImagePicker from "expo-image-picker";
|
|
3
|
+
|
|
4
|
+
export default usePhotos = () => {
|
|
5
|
+
|
|
6
|
+
const requestPermission = async () => {
|
|
7
|
+
const { granted} = await ImagePicker.requestMediaLibraryPermissionsAsync();
|
|
8
|
+
|
|
9
|
+
if (!granted) {
|
|
10
|
+
Alert.alert(
|
|
11
|
+
'Device settings alert',
|
|
12
|
+
'You need to allow media library permissions for this to work'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const selectImage = async (options) => {
|
|
18
|
+
options = {mediaTypes: ImagePicker.MediaTypeOptions.Images, ...options };
|
|
19
|
+
|
|
20
|
+
return await ImagePicker.launchImageLibraryAsync(options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
requestPermission();
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
return {selectImage};
|
|
28
|
+
};
|
package/hooks/useStyle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {useEffect, useState} from "react";
|
|
2
2
|
import {Platform, useColorScheme} from "react-native";
|
|
3
3
|
|
|
4
|
-
import colors from "
|
|
5
|
-
import logger from "
|
|
4
|
+
import colors from "../../../../config/colors";
|
|
5
|
+
import logger from "../utilities/logger";
|
|
6
6
|
|
|
7
7
|
export default useStyle = () => {
|
|
8
8
|
const colorScheme = useColorScheme();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boneframework/native-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Expo Components for Bone Framework",
|
|
5
5
|
"main": "src/Bone.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@react-native-async-storage/async-storage": "^1.24.0",
|
|
33
|
+
"@react-native-community/datetimepicker": "^8.2.0",
|
|
33
34
|
"apisauce": "^3.0.1",
|
|
34
35
|
"expo-auth-session": "^5.5.2",
|
|
36
|
+
"expo-image-picker": "^15.0.7",
|
|
35
37
|
"expo-secure-store": "^13.0.2",
|
|
36
38
|
"formik": "^2.4.6",
|
|
37
39
|
"jwt-decode": "^4.0.0",
|
|
@@ -39,12 +39,12 @@ function RegisterScreen({postRegisterUrl}) {
|
|
|
39
39
|
return (
|
|
40
40
|
<>
|
|
41
41
|
<ActivityIndicator visible={registerApi.loading} type={'overlay'}/>
|
|
42
|
-
<ImageBackground blurRadius={10} style={styles.background} source={require('
|
|
42
|
+
<ImageBackground blurRadius={10} style={styles.background} source={require.main.require('assets/background.png')} >
|
|
43
43
|
<View style={styles.container}>
|
|
44
44
|
<TouchableOpacity style={styles.cancelButton} onPress={onClose}>
|
|
45
45
|
<Icon size={75} name={'close'} />
|
|
46
46
|
</TouchableOpacity>
|
|
47
|
-
<Image style={styles.logo} source={require('
|
|
47
|
+
<Image style={styles.logo} source={require.main.require('assets/logo.png')} />
|
|
48
48
|
|
|
49
49
|
<Form
|
|
50
50
|
initialValues={{ email: ''}}
|
|
@@ -7,9 +7,9 @@ import colors from '../../../../config/colors'
|
|
|
7
7
|
|
|
8
8
|
function WelcomeScreen({loginOnPress = () => {}, registerOnPress = () => {}, title = 'BONE FRAMEWORK'}) {
|
|
9
9
|
return (
|
|
10
|
-
<ImageBackground blurRadius={10} style={styles.background} source={require('
|
|
10
|
+
<ImageBackground blurRadius={10} style={styles.background} source={require.main.require('assets/background.png')} >
|
|
11
11
|
<View style={styles.logoContainer}>
|
|
12
|
-
<Image style={styles.logo} source={require('
|
|
12
|
+
<Image style={styles.logo} source={require.main.require('assets/logo.png')} />
|
|
13
13
|
<Text style={styles.tagline}>{ title }</Text>
|
|
14
14
|
</View>
|
|
15
15
|
<View style={styles.buttonContainer}>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// import Bugsnag from '@bugsnag/expo';
|
|
2
|
+
// or sentry, whatever
|
|
3
|
+
|
|
4
|
+
import {object} from "prop-types";
|
|
5
|
+
|
|
6
|
+
const log = (message: any) => {
|
|
7
|
+
console.log(message);
|
|
8
|
+
// Bugsnag.notify(error);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const logObject = (json: object)=> {
|
|
12
|
+
console.log(JSON.stringify(json, undefined, 4));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const logJson = (json: string)=> {
|
|
16
|
+
const jsonObject = JSON.parse(json);
|
|
17
|
+
console.log(JSON.stringify(jsonObject, undefined, 4));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const start = () => {
|
|
21
|
+
// Bugsnag.start();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
log, start, logJson
|
|
26
|
+
}
|