@janiscommerce/ui-native 1.5.0 → 1.6.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.
@@ -0,0 +1,21 @@
1
+ import { FC, ReactElement } from 'react';
2
+ export declare enum animationTypes {
3
+ Slide = "slide",
4
+ Fade = "fade",
5
+ None = "none"
6
+ }
7
+ interface Props {
8
+ backgroundColor?: string;
9
+ isVisible?: boolean;
10
+ title?: string;
11
+ subtitle?: string;
12
+ iconName?: string;
13
+ textsColor?: string;
14
+ iconColor?: string;
15
+ animationType?: animationTypes;
16
+ duration?: number;
17
+ onEndDuration?: () => void;
18
+ children?: ReactElement | null;
19
+ }
20
+ declare const FullScreenMessage: FC<Props>;
21
+ export default FullScreenMessage;
@@ -0,0 +1,66 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Modal, StyleSheet, View } from 'react-native';
3
+ import { moderateScale, scaledForDevice } from '../../scale';
4
+ import { base, primary } from '../../theme/palette';
5
+ import Icon from '../Icon';
6
+ import Text from '../Text';
7
+ export var animationTypes;
8
+ (function (animationTypes) {
9
+ animationTypes["Slide"] = "slide";
10
+ animationTypes["Fade"] = "fade";
11
+ animationTypes["None"] = "none";
12
+ })(animationTypes || (animationTypes = {}));
13
+ const FullScreenMessage = ({ backgroundColor = primary.main, title = '', isVisible = false, subtitle = '', iconName = '', textsColor = base.white, iconColor = base.white, animationType = animationTypes.Slide, duration = 3000, onEndDuration = () => { }, children = null, ...props }) => {
14
+ const validTitle = !!title && typeof title === 'string';
15
+ const validSubtitle = !!subtitle && typeof subtitle === 'string';
16
+ const validIconName = !!iconName && typeof iconName === 'string';
17
+ const validPaddingHorizontal = scaledForDevice(50, moderateScale);
18
+ const validMarginBottomTitle = scaledForDevice(30, moderateScale);
19
+ const validMarginBottomSubtitle = scaledForDevice(50, moderateScale);
20
+ const validFontTitle = scaledForDevice(32, moderateScale);
21
+ const validFontSubtitle = scaledForDevice(16, moderateScale);
22
+ const validLineHeightTitle = scaledForDevice(40, moderateScale);
23
+ const styles = StyleSheet.create({
24
+ container: {
25
+ justifyContent: 'center',
26
+ alignItems: 'center',
27
+ width: '100%',
28
+ height: '100%',
29
+ backgroundColor: backgroundColor,
30
+ },
31
+ title: {
32
+ fontWeight: 'bold',
33
+ textAlign: 'center',
34
+ color: textsColor,
35
+ paddingHorizontal: validPaddingHorizontal,
36
+ marginBottom: validMarginBottomTitle,
37
+ fontSize: validFontTitle,
38
+ lineHeight: validLineHeightTitle,
39
+ },
40
+ subtitle: {
41
+ textAlign: 'center',
42
+ color: textsColor,
43
+ paddingHorizontal: validPaddingHorizontal,
44
+ marginBottom: validMarginBottomSubtitle,
45
+ fontSize: validFontSubtitle,
46
+ },
47
+ });
48
+ useEffect(() => {
49
+ if (isVisible) {
50
+ setTimeout(() => {
51
+ onEndDuration();
52
+ }, duration);
53
+ }
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55
+ }, [isVisible]);
56
+ return (<Modal visible={isVisible} animationType={animationType} transparent {...props}>
57
+ <View style={styles.container}>
58
+ {children ?? (<>
59
+ {validTitle && <Text style={styles.title}>{title}</Text>}
60
+ {validSubtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
61
+ {validIconName && <Icon color={iconColor} size={130} name={iconName}/>}
62
+ </>)}
63
+ </View>
64
+ </Modal>);
65
+ };
66
+ export default FullScreenMessage;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ import Carousel from './components/Carousel';
17
17
  import ProgressBar from './components/ProgressBar';
18
18
  import List from './components/List';
19
19
  import BaseButton from './components/BaseButton';
20
+ import FullScreenMessage from './components/FullScreenMessage';
20
21
  import LayoutWithBottomButtons from './components/LayoutWithBottomButtons';
21
22
  import * as getScale from './scale';
22
- export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, };
23
+ export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, FullScreenMessage, };
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ import Carousel from './components/Carousel';
17
17
  import ProgressBar from './components/ProgressBar';
18
18
  import List from './components/List';
19
19
  import BaseButton from './components/BaseButton';
20
+ import FullScreenMessage from './components/FullScreenMessage';
20
21
  import LayoutWithBottomButtons from './components/LayoutWithBottomButtons';
21
22
  import * as getScale from './scale';
22
- export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, };
23
+ export { Text, Avatar, CheckBox, Icon, Image, Loading, Svg, StatusChip, Input, palette, LoadingFullScreen, RadioButton, Select, SwipeUp, SwipeUpFlatList, SwipeUpScrollView, SwipeUpView, Carousel, ProgressBar, List, BaseButton, getScale, LayoutWithBottomButtons, FullScreenMessage, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janiscommerce/ui-native",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "components library for Janis app",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "homepage": "https://github.com/janis-commerce/ui-native#readme",
45
45
  "peerDependencies": {
46
- "react": ">=17.0.2 <=18.2.0",
47
- "react-native": ">=0.67.5 <=0.71.7",
48
- "react-native-gesture-handler": ">=2.9.0 <=2.13.4",
46
+ "react": ">=17.0.2",
47
+ "react-native": ">=0.67.5",
48
+ "react-native-gesture-handler": ">=2.9.0",
49
49
  "react-native-reanimated": "2.17.0"
50
50
  },
51
51
  "devDependencies": {