Skip to content

Commit a93a56a

Browse files
committed
fix: bump deps
1 parent d621f1a commit a93a56a

File tree

4 files changed

+111
-9126
lines changed

4 files changed

+111
-9126
lines changed

package.json

+20-21
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,25 @@
3030
"Matt Labrum"
3131
],
3232
"devDependencies": {
33-
"@commitlint/cli": "^7.2.1",
34-
"@commitlint/config-conventional": "^7.1.2",
35-
"@types/jest": "^25.2.3",
36-
"@types/react-native": "^0.63.50",
37-
"@typescript-eslint/parser": "^4.15.2",
38-
"babel-eslint": "^10.0.1",
39-
"eslint": "^4.19.1",
40-
"eslint-config-xo-lass": "^1.0.3",
41-
"eslint-plugin-react": "^7.11.1",
42-
"eslint-plugin-react-native": "^3.4.0",
43-
"fixpack": "^2.3.1",
44-
"husky": "^1.3.1",
45-
"lint-staged": "^7.3.0",
46-
"prettier": "^1.14.3",
47-
"react": "16.6.0-alpha.8af6728",
48-
"react-native": "^0.57.3",
49-
"remark-cli": "^5.0.0",
50-
"remark-preset-github": "^0.0.9",
51-
"typescript": "^4.2.2",
52-
"xo": "^0.23.0"
33+
"@commitlint/cli": "^17.0.3",
34+
"@commitlint/config-conventional": "^17.0.3",
35+
"@types/jest": "^28.1.6",
36+
"@types/react-native": "^0.69.3",
37+
"@typescript-eslint/parser": "^5.31.0",
38+
"eslint": "^8.20.0",
39+
"eslint-config-xo-lass": "^2.0.1",
40+
"eslint-plugin-react": "^7.30.1",
41+
"eslint-plugin-react-native": "^4.0.0",
42+
"fixpack": "^4.0.0",
43+
"husky": "^8.0.1",
44+
"lint-staged": "^13.0.3",
45+
"prettier": "^2.7.1",
46+
"react": "18.0.0",
47+
"react-native": "^0.69.3",
48+
"remark-cli": "^11.0.0",
49+
"remark-preset-github": "^4.0.4",
50+
"typescript": "^4.7.4",
51+
"xo": "^0.51.0"
5352
},
5453
"homepage": "https://github.com/joinspontaneous/react-native-loading-spinner-overlay",
5554
"husky": {
@@ -142,7 +141,7 @@
142141
],
143142
"settings": {
144143
"react": {
145-
"version": "16.x"
144+
"version": "18.x"
146145
}
147146
}
148147
}

src/index.tsx

+89-88
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,103 @@
1-
import * as React from 'react'
2-
import { View, Text, Modal, ActivityIndicator, TextStyle, ViewStyle } from 'react-native';
3-
import styles from './style'
1+
import * as React from 'react';
2+
import {
3+
View,
4+
Text,
5+
Modal,
6+
ActivityIndicator,
7+
TextStyle,
8+
ViewStyle
9+
} from 'react-native';
10+
import styles from './style';
411

512
const transparent = 'transparent';
613

7-
8-
9-
1014
export interface SpinnerPropTypes {
11-
cancelable?: boolean,
12-
color?: string,
13-
animation?: 'none' | 'slide'| 'fade',
14-
overlayColor?: string,
15-
size?: 'small'| 'large' | number //size props does not support value normal
16-
textContent?: string,
17-
textStyle?: TextStyle,
18-
visible?: boolean,
19-
indicatorStyle?: ViewStyle,
20-
customIndicator?: React.ReactNode,
21-
children?: React.ReactNode,
22-
spinnerKey?: string
15+
cancelable?: boolean;
16+
color?: string;
17+
animation?: 'none' | 'slide' | 'fade';
18+
overlayColor?: string;
19+
size?: 'small' | 'large' | number; // size props does not support value normal
20+
textContent?: string;
21+
textStyle?: TextStyle;
22+
visible?: boolean;
23+
indicatorStyle?: ViewStyle;
24+
customIndicator?: React.ReactNode;
25+
children?: React.ReactNode;
26+
spinnerKey?: string;
2327
}
2428

25-
26-
2729
const Spinner = ({
28-
cancelable=false,
29-
color='white',
30-
animation='none',
31-
overlayColor='rgba(0, 0, 0, 0.25)',
32-
size='large',
33-
textContent='',
34-
textStyle,
35-
visible=false,
36-
indicatorStyle,
37-
customIndicator,
38-
children,
39-
spinnerKey
40-
}:SpinnerPropTypes) => {
30+
cancelable = false,
31+
color = 'white',
32+
animation = 'none',
33+
overlayColor = 'rgba(0, 0, 0, 0.25)',
34+
size = 'large',
35+
textContent = '',
36+
textStyle,
37+
visible = false,
38+
indicatorStyle,
39+
customIndicator,
40+
children,
41+
spinnerKey
42+
}: SpinnerPropTypes) => {
43+
const [spinnerVisible, setSpinnerVisibility] = React.useState(visible);
44+
const close = () => {
45+
setSpinnerVisibility(false);
46+
};
4147

42-
const [spinnerVisible, setSpinnerVisibility] = React.useState(visible)
43-
const close = () => {
44-
setSpinnerVisibility(false)
48+
const _handleOnRequestClose = () => {
49+
if (cancelable) {
50+
close();
4551
}
52+
};
4653

47-
const _handleOnRequestClose = () => {
48-
if (cancelable) {
49-
close();
50-
}
51-
}
52-
53-
React.useEffect(() => {
54-
setSpinnerVisibility(visible)
55-
}, [visible])
56-
const _renderDefaultContent = () => {
57-
return (
58-
<View style={styles.background}>
59-
{customIndicator || (
60-
<ActivityIndicator
61-
color={color}
62-
size={size}
63-
style={[styles.activityIndicator, { ...indicatorStyle }]}
64-
/>
65-
)}
66-
<View style={[styles.textContainer, { ...indicatorStyle }]}>
67-
<Text style={[styles.textContent, textStyle]}>
68-
{textContent}
69-
</Text>
70-
</View>
71-
</View>
72-
);
73-
}
54+
React.useEffect(() => {
55+
setSpinnerVisibility(visible);
56+
}, [visible]);
57+
const _renderDefaultContent = () => {
58+
return (
59+
<View style={styles.background}>
60+
{customIndicator || (
61+
<ActivityIndicator
62+
color={color}
63+
size={size}
64+
style={[styles.activityIndicator, { ...indicatorStyle }]}
65+
/>
66+
)}
67+
<View style={[styles.textContainer, { ...indicatorStyle }]}>
68+
<Text style={[styles.textContent, textStyle]}>{textContent}</Text>
69+
</View>
70+
</View>
71+
);
72+
};
7473

75-
const _renderSpinner = () => {
76-
const spinner = (
77-
<View
78-
style={[styles.container, { backgroundColor: overlayColor }]}
79-
key={spinnerKey || `spinner_${Date.now()}`}>
80-
{children || _renderDefaultContent()}
81-
</View>
82-
);
83-
84-
return (
85-
<Modal
86-
animationType={animation}
87-
onRequestClose={() => _handleOnRequestClose()}
88-
supportedOrientations={['landscape', 'portrait']}
89-
transparent
90-
visible={spinnerVisible}
91-
statusBarTranslucent={true}
92-
>
93-
{spinner}
94-
</Modal>
95-
);
96-
}
74+
const _renderSpinner = () => {
75+
const spinner = (
76+
<View
77+
style={[styles.container, { backgroundColor: overlayColor }]}
78+
key={spinnerKey || `spinner_${Date.now()}`}
79+
>
80+
{children || _renderDefaultContent()}
81+
</View>
82+
);
9783

98-
return _renderSpinner()
84+
return (
85+
<Modal
86+
animationType={animation}
87+
onRequestClose={() => {
88+
_handleOnRequestClose();
89+
}}
90+
supportedOrientations={['landscape', 'portrait']}
91+
transparent
92+
visible={spinnerVisible}
93+
statusBarTranslucent={true}
94+
>
95+
{spinner}
96+
</Modal>
97+
);
98+
};
9999

100-
}
100+
return _renderSpinner();
101+
};
101102

102-
export default Spinner
103+
export default Spinner;

src/style.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { StyleSheet } from 'react-native'
2-
1+
import { StyleSheet } from 'react-native';
32

43
const transparent = 'transparent';
54
const styles = StyleSheet.create({
@@ -42,4 +41,4 @@ const styles = StyleSheet.create({
4241
}
4342
});
4443

45-
export default styles
44+
export default styles;

0 commit comments

Comments
 (0)