@widergy/mobile-ui 1.11.6 → 1.12.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.12.0](https://github.com/widergy/mobile-ui/compare/v1.11.6...v1.12.0) (2024-06-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * utloading prevent unmount ([#302](https://github.com/widergy/mobile-ui/issues/302)) ([00511a9](https://github.com/widergy/mobile-ui/commit/00511a91833ff5f8ba73c74a54eb0ba612d5c3b4))
7
+
1
8
  ## [1.11.6](https://github.com/widergy/mobile-ui/compare/v1.11.5...v1.11.6) (2024-06-25)
2
9
 
3
10
 
@@ -1,35 +1,50 @@
1
- import React from 'react';
1
+ import React, { Fragment } from 'react';
2
2
  import { number, string, bool } from 'prop-types';
3
+ import { View } from 'react-native';
3
4
  import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
 
5
6
  import Loading from '../Loading';
6
7
 
7
8
  import styles from './styles';
8
9
 
9
- const UTLoading = ({ style, thickness, size, message, messageStyle, color, loading, children }) =>
10
- // eslint-disable-next-line
11
- !!loading ? (
12
- <Loading
13
- style={[styles.spinner, style]}
14
- message={message}
15
- color={color}
16
- size={size}
17
- thickness={thickness}
18
- messageStyle={messageStyle}
19
- />
20
- ) : (
21
- children
10
+ const UTLoading = ({
11
+ children,
12
+ color,
13
+ loading,
14
+ message,
15
+ messageStyle,
16
+ preventUnmount,
17
+ size,
18
+ style,
19
+ thickness
20
+ }) => {
21
+ return (
22
+ <Fragment>
23
+ {!!loading && (
24
+ <Loading
25
+ style={[styles.spinner, style]}
26
+ message={message}
27
+ color={color}
28
+ size={size}
29
+ thickness={thickness}
30
+ messageStyle={messageStyle}
31
+ />
32
+ )}
33
+ {preventUnmount ? <View style={{ display: loading && 'none' }}>{children}</View> : !loading && children}
34
+ </Fragment>
22
35
  );
36
+ };
23
37
 
24
38
  UTLoading.displayName = 'UTLoading';
25
39
 
26
40
  UTLoading.propTypes = {
27
- style: ViewPropTypes.style,
28
- messageStyle: ViewPropTypes.style,
41
+ color: string,
29
42
  loading: bool,
30
43
  message: string,
31
- color: string,
44
+ messageStyle: ViewPropTypes.style,
45
+ preventUnmount: bool,
32
46
  size: number,
47
+ style: ViewPropTypes.style,
33
48
  thickness: number
34
49
  };
35
50
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.11.6",
5
+ "version": "1.12.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [