@onairos/react-native 1.0.0 → 1.0.1
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/lib/commonjs/components/OnairosButton.js +6 -415
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +0 -549
- package/lib/commonjs/components/PinInput.js +160 -0
- package/lib/commonjs/components/PinInput.js.map +1 -0
- package/lib/commonjs/components/PlatformList.js +137 -0
- package/lib/commonjs/components/PlatformList.js.map +1 -0
- package/lib/commonjs/components/TrainingModal.js +130 -0
- package/lib/commonjs/components/TrainingModal.js.map +1 -0
- package/lib/commonjs/index.js +12 -276
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/OnairosButton.js +121 -514
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +0 -565
- package/lib/module/components/PinInput.js +151 -0
- package/lib/module/components/PinInput.js.map +1 -0
- package/lib/module/components/PlatformList.js +129 -0
- package/lib/module/components/PlatformList.js.map +1 -0
- package/lib/module/components/TrainingModal.js +122 -0
- package/lib/module/components/TrainingModal.js.map +1 -0
- package/package.json +5 -4
- package/src/components/OnairosButton.tsx +5 -5
- package/src/components/PinInput.tsx +189 -0
- package/src/components/PlatformList.tsx +145 -0
- package/src/components/TrainingModal.tsx +132 -0
- package/lib/commonjs/components/Notification.js +0 -106
- package/lib/commonjs/components/Notification.js.map +0 -1
- package/lib/module/components/Notification.js +0 -99
- package/lib/module/components/Notification.js.map +0 -1
- package/src/components/Notification.js +0 -101
- package/src/components/OnairosButton.js +0 -604
- package/src/components/Overlay.js +0 -854
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
import { COLORS, PLATFORMS } from '../constants';
|
|
5
|
+
import type { PlatformListProps } from '../types';
|
|
6
|
+
|
|
7
|
+
export const PlatformList: React.FC<PlatformListProps> = ({
|
|
8
|
+
connections,
|
|
9
|
+
onToggle,
|
|
10
|
+
isLoading,
|
|
11
|
+
canProceed,
|
|
12
|
+
onProceed,
|
|
13
|
+
}) => {
|
|
14
|
+
const renderPlatformItem = (platform: string, isConnected: boolean) => {
|
|
15
|
+
const platformConfig = PLATFORMS[platform];
|
|
16
|
+
if (!platformConfig) return null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View key={platform} style={styles.platformContainer}>
|
|
20
|
+
<View style={styles.platformHeader}>
|
|
21
|
+
<Icon name={platformConfig.icon} size={24} color={platformConfig.color} />
|
|
22
|
+
<Text style={styles.platformName}>{platformConfig.name}</Text>
|
|
23
|
+
</View>
|
|
24
|
+
{platformConfig.description && (
|
|
25
|
+
<Text style={styles.platformDescription}>{platformConfig.description}</Text>
|
|
26
|
+
)}
|
|
27
|
+
<TouchableOpacity
|
|
28
|
+
style={[
|
|
29
|
+
styles.connectButton,
|
|
30
|
+
isConnected ? styles.connectedButton : styles.disconnectedButton,
|
|
31
|
+
]}
|
|
32
|
+
onPress={() => onToggle(platform, !isConnected)}
|
|
33
|
+
disabled={isLoading}
|
|
34
|
+
>
|
|
35
|
+
{isLoading ? (
|
|
36
|
+
<ActivityIndicator color="#fff" />
|
|
37
|
+
) : (
|
|
38
|
+
<Text style={styles.buttonText}>
|
|
39
|
+
{isConnected ? 'Disconnect' : 'Connect'}
|
|
40
|
+
</Text>
|
|
41
|
+
)}
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={styles.container}>
|
|
49
|
+
<Text style={styles.title}>Connect your platforms</Text>
|
|
50
|
+
<Text style={styles.subtitle}>
|
|
51
|
+
Connect at least 2 platforms to proceed
|
|
52
|
+
</Text>
|
|
53
|
+
|
|
54
|
+
<View style={styles.platformsList}>
|
|
55
|
+
{Object.entries(connections).map(([platform, status]) =>
|
|
56
|
+
renderPlatformItem(platform, !!status)
|
|
57
|
+
)}
|
|
58
|
+
</View>
|
|
59
|
+
|
|
60
|
+
<TouchableOpacity
|
|
61
|
+
style={[styles.proceedButton, !canProceed && styles.disabledButton]}
|
|
62
|
+
onPress={onProceed}
|
|
63
|
+
disabled={!canProceed || isLoading}
|
|
64
|
+
>
|
|
65
|
+
<Text style={styles.proceedButtonText}>Proceed</Text>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
container: {
|
|
73
|
+
flex: 1,
|
|
74
|
+
padding: 16,
|
|
75
|
+
},
|
|
76
|
+
title: {
|
|
77
|
+
fontSize: 20,
|
|
78
|
+
fontWeight: '600',
|
|
79
|
+
marginBottom: 8,
|
|
80
|
+
color: COLORS.text.primary,
|
|
81
|
+
},
|
|
82
|
+
subtitle: {
|
|
83
|
+
fontSize: 14,
|
|
84
|
+
color: COLORS.text.secondary,
|
|
85
|
+
marginBottom: 24,
|
|
86
|
+
},
|
|
87
|
+
platformsList: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
platformContainer: {
|
|
91
|
+
backgroundColor: '#fff',
|
|
92
|
+
borderRadius: 12,
|
|
93
|
+
padding: 16,
|
|
94
|
+
marginBottom: 16,
|
|
95
|
+
borderWidth: 1,
|
|
96
|
+
borderColor: COLORS.border,
|
|
97
|
+
},
|
|
98
|
+
platformHeader: {
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
marginBottom: 8,
|
|
102
|
+
},
|
|
103
|
+
platformName: {
|
|
104
|
+
fontSize: 16,
|
|
105
|
+
fontWeight: '600',
|
|
106
|
+
marginLeft: 12,
|
|
107
|
+
color: COLORS.text.primary,
|
|
108
|
+
},
|
|
109
|
+
platformDescription: {
|
|
110
|
+
fontSize: 14,
|
|
111
|
+
color: COLORS.text.secondary,
|
|
112
|
+
marginBottom: 16,
|
|
113
|
+
},
|
|
114
|
+
connectButton: {
|
|
115
|
+
paddingVertical: 8,
|
|
116
|
+
paddingHorizontal: 16,
|
|
117
|
+
borderRadius: 8,
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
},
|
|
120
|
+
connectedButton: {
|
|
121
|
+
backgroundColor: COLORS.success,
|
|
122
|
+
},
|
|
123
|
+
disconnectedButton: {
|
|
124
|
+
backgroundColor: COLORS.primary,
|
|
125
|
+
},
|
|
126
|
+
buttonText: {
|
|
127
|
+
color: '#fff',
|
|
128
|
+
fontWeight: '600',
|
|
129
|
+
},
|
|
130
|
+
proceedButton: {
|
|
131
|
+
backgroundColor: COLORS.primary,
|
|
132
|
+
paddingVertical: 16,
|
|
133
|
+
borderRadius: 12,
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
marginTop: 16,
|
|
136
|
+
},
|
|
137
|
+
disabledButton: {
|
|
138
|
+
opacity: 0.5,
|
|
139
|
+
},
|
|
140
|
+
proceedButtonText: {
|
|
141
|
+
color: '#fff',
|
|
142
|
+
fontSize: 16,
|
|
143
|
+
fontWeight: '600',
|
|
144
|
+
},
|
|
145
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
ActivityIndicator,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
10
|
+
import { COLORS } from '../constants';
|
|
11
|
+
import type { TrainingModalProps } from '../types';
|
|
12
|
+
|
|
13
|
+
export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
14
|
+
progress,
|
|
15
|
+
eta,
|
|
16
|
+
onCancel,
|
|
17
|
+
}) => {
|
|
18
|
+
const progressPercentage = Math.round(progress * 100);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<View style={styles.container}>
|
|
22
|
+
<View style={styles.content}>
|
|
23
|
+
<Icon name="auto_awesome" size={48} color={COLORS.primary} />
|
|
24
|
+
|
|
25
|
+
<Text style={styles.title}>Training Your AI Model</Text>
|
|
26
|
+
<Text style={styles.subtitle}>
|
|
27
|
+
We're analyzing your social media data to create your personalized AI model
|
|
28
|
+
</Text>
|
|
29
|
+
|
|
30
|
+
<View style={styles.progressContainer}>
|
|
31
|
+
<View style={styles.progressBar}>
|
|
32
|
+
<View
|
|
33
|
+
style={[
|
|
34
|
+
styles.progressFill,
|
|
35
|
+
{ width: `${progressPercentage}%` },
|
|
36
|
+
]}
|
|
37
|
+
/>
|
|
38
|
+
</View>
|
|
39
|
+
<Text style={styles.progressText}>{progressPercentage}%</Text>
|
|
40
|
+
</View>
|
|
41
|
+
|
|
42
|
+
<Text style={styles.etaText}>Estimated time remaining: {eta}</Text>
|
|
43
|
+
|
|
44
|
+
<View style={styles.loadingContainer}>
|
|
45
|
+
<ActivityIndicator size="small" color={COLORS.primary} />
|
|
46
|
+
<Text style={styles.loadingText}>Processing your data...</Text>
|
|
47
|
+
</View>
|
|
48
|
+
|
|
49
|
+
<TouchableOpacity
|
|
50
|
+
style={styles.cancelButton}
|
|
51
|
+
onPress={onCancel}
|
|
52
|
+
>
|
|
53
|
+
<Text style={styles.cancelButtonText}>Cancel</Text>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
padding: 24,
|
|
66
|
+
},
|
|
67
|
+
content: {
|
|
68
|
+
width: '100%',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
},
|
|
71
|
+
title: {
|
|
72
|
+
fontSize: 24,
|
|
73
|
+
fontWeight: '600',
|
|
74
|
+
marginTop: 24,
|
|
75
|
+
marginBottom: 8,
|
|
76
|
+
color: COLORS.text.primary,
|
|
77
|
+
textAlign: 'center',
|
|
78
|
+
},
|
|
79
|
+
subtitle: {
|
|
80
|
+
fontSize: 16,
|
|
81
|
+
color: COLORS.text.secondary,
|
|
82
|
+
textAlign: 'center',
|
|
83
|
+
marginBottom: 32,
|
|
84
|
+
},
|
|
85
|
+
progressContainer: {
|
|
86
|
+
width: '100%',
|
|
87
|
+
marginBottom: 16,
|
|
88
|
+
},
|
|
89
|
+
progressBar: {
|
|
90
|
+
height: 8,
|
|
91
|
+
backgroundColor: COLORS.border,
|
|
92
|
+
borderRadius: 4,
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
},
|
|
95
|
+
progressFill: {
|
|
96
|
+
height: '100%',
|
|
97
|
+
backgroundColor: COLORS.primary,
|
|
98
|
+
borderRadius: 4,
|
|
99
|
+
},
|
|
100
|
+
progressText: {
|
|
101
|
+
fontSize: 14,
|
|
102
|
+
color: COLORS.text.secondary,
|
|
103
|
+
textAlign: 'center',
|
|
104
|
+
marginTop: 8,
|
|
105
|
+
},
|
|
106
|
+
etaText: {
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
color: COLORS.text.secondary,
|
|
109
|
+
marginBottom: 24,
|
|
110
|
+
},
|
|
111
|
+
loadingContainer: {
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
marginBottom: 32,
|
|
115
|
+
},
|
|
116
|
+
loadingText: {
|
|
117
|
+
fontSize: 14,
|
|
118
|
+
color: COLORS.text.secondary,
|
|
119
|
+
marginLeft: 8,
|
|
120
|
+
},
|
|
121
|
+
cancelButton: {
|
|
122
|
+
paddingVertical: 12,
|
|
123
|
+
paddingHorizontal: 24,
|
|
124
|
+
borderRadius: 8,
|
|
125
|
+
borderWidth: 1,
|
|
126
|
+
borderColor: COLORS.border,
|
|
127
|
+
},
|
|
128
|
+
cancelButtonText: {
|
|
129
|
+
fontSize: 16,
|
|
130
|
+
color: COLORS.text.secondary,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
-
const Notification = ({
|
|
11
|
-
message,
|
|
12
|
-
color = 'blue',
|
|
13
|
-
duration = 3000,
|
|
14
|
-
onClose
|
|
15
|
-
}) => {
|
|
16
|
-
const [fadeAnim] = (0, _react.useState)(new _reactNative.Animated.Value(0));
|
|
17
|
-
(0, _react.useEffect)(() => {
|
|
18
|
-
// Fade in
|
|
19
|
-
_reactNative.Animated.timing(fadeAnim, {
|
|
20
|
-
toValue: 1,
|
|
21
|
-
duration: 300,
|
|
22
|
-
useNativeDriver: true
|
|
23
|
-
}).start();
|
|
24
|
-
|
|
25
|
-
// Set timeout to fade out
|
|
26
|
-
const timer = setTimeout(() => {
|
|
27
|
-
_reactNative.Animated.timing(fadeAnim, {
|
|
28
|
-
toValue: 0,
|
|
29
|
-
duration: 300,
|
|
30
|
-
useNativeDriver: true
|
|
31
|
-
}).start(() => {
|
|
32
|
-
if (onClose) onClose();
|
|
33
|
-
});
|
|
34
|
-
}, duration);
|
|
35
|
-
return () => clearTimeout(timer);
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
// Determine background color based on the color prop
|
|
39
|
-
const getBackgroundColor = () => {
|
|
40
|
-
switch (color) {
|
|
41
|
-
case 'red':
|
|
42
|
-
return '#FFEBEE';
|
|
43
|
-
case 'green':
|
|
44
|
-
return '#E8F5E9';
|
|
45
|
-
case 'yellow':
|
|
46
|
-
return '#FFF8E1';
|
|
47
|
-
default:
|
|
48
|
-
return '#E3F2FD';
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// Determine text color based on the color prop
|
|
53
|
-
const getTextColor = () => {
|
|
54
|
-
switch (color) {
|
|
55
|
-
case 'red':
|
|
56
|
-
return '#D32F2F';
|
|
57
|
-
case 'green':
|
|
58
|
-
return '#388E3C';
|
|
59
|
-
case 'yellow':
|
|
60
|
-
return '#F57F17';
|
|
61
|
-
default:
|
|
62
|
-
return '#1976D2';
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
66
|
-
style: [styles.container, {
|
|
67
|
-
backgroundColor: getBackgroundColor(),
|
|
68
|
-
opacity: fadeAnim,
|
|
69
|
-
transform: [{
|
|
70
|
-
translateY: fadeAnim.interpolate({
|
|
71
|
-
inputRange: [0, 1],
|
|
72
|
-
outputRange: [-20, 0]
|
|
73
|
-
})
|
|
74
|
-
}]
|
|
75
|
-
}]
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
77
|
-
style: [styles.message, {
|
|
78
|
-
color: getTextColor()
|
|
79
|
-
}]
|
|
80
|
-
}, message));
|
|
81
|
-
};
|
|
82
|
-
const styles = _reactNative.StyleSheet.create({
|
|
83
|
-
container: {
|
|
84
|
-
position: 'absolute',
|
|
85
|
-
top: 40,
|
|
86
|
-
left: 20,
|
|
87
|
-
right: 20,
|
|
88
|
-
padding: 16,
|
|
89
|
-
borderRadius: 8,
|
|
90
|
-
shadowColor: '#000',
|
|
91
|
-
shadowOffset: {
|
|
92
|
-
width: 0,
|
|
93
|
-
height: 2
|
|
94
|
-
},
|
|
95
|
-
shadowOpacity: 0.1,
|
|
96
|
-
shadowRadius: 4,
|
|
97
|
-
elevation: 3,
|
|
98
|
-
zIndex: 1000
|
|
99
|
-
},
|
|
100
|
-
message: {
|
|
101
|
-
fontSize: 16,
|
|
102
|
-
fontWeight: '500'
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
var _default = exports.default = Notification;
|
|
106
|
-
//# sourceMappingURL=Notification.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Notification","message","color","duration","onClose","fadeAnim","useState","Animated","Value","useEffect","timing","toValue","useNativeDriver","start","timer","setTimeout","clearTimeout","getBackgroundColor","getTextColor","createElement","View","style","styles","container","backgroundColor","opacity","transform","translateY","interpolate","inputRange","outputRange","Text","StyleSheet","create","position","top","left","right","padding","borderRadius","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","zIndex","fontSize","fontWeight","_default","exports"],"sourceRoot":"..\\..\\..\\src","sources":["components/Notification.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAgE,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EA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,OAAO,EAAE;MAAEC,KAAK,EAAEgB,YAAY,CAAC;IAAE,CAAC;EAAE,GAAEjB,OAAc,CAC5D,CAAC;AAEpB,CAAC;AAED,MAAMqB,MAAM,GAAGU,uBAAU,CAACC,MAAM,CAAC;EAC/BV,SAAS,EAAE;IACTW,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,EAAE;IACPC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE,EAAE;IACTC,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,MAAM,EAAE;EACV,CAAC;EACD9C,OAAO,EAAE;IACP+C,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEYS,YAAY","ignoreList":[]}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, Animated } from 'react-native';
|
|
3
|
-
const Notification = ({
|
|
4
|
-
message,
|
|
5
|
-
color = 'blue',
|
|
6
|
-
duration = 3000,
|
|
7
|
-
onClose
|
|
8
|
-
}) => {
|
|
9
|
-
const [fadeAnim] = useState(new Animated.Value(0));
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
// Fade in
|
|
12
|
-
Animated.timing(fadeAnim, {
|
|
13
|
-
toValue: 1,
|
|
14
|
-
duration: 300,
|
|
15
|
-
useNativeDriver: true
|
|
16
|
-
}).start();
|
|
17
|
-
|
|
18
|
-
// Set timeout to fade out
|
|
19
|
-
const timer = setTimeout(() => {
|
|
20
|
-
Animated.timing(fadeAnim, {
|
|
21
|
-
toValue: 0,
|
|
22
|
-
duration: 300,
|
|
23
|
-
useNativeDriver: true
|
|
24
|
-
}).start(() => {
|
|
25
|
-
if (onClose) onClose();
|
|
26
|
-
});
|
|
27
|
-
}, duration);
|
|
28
|
-
return () => clearTimeout(timer);
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
// Determine background color based on the color prop
|
|
32
|
-
const getBackgroundColor = () => {
|
|
33
|
-
switch (color) {
|
|
34
|
-
case 'red':
|
|
35
|
-
return '#FFEBEE';
|
|
36
|
-
case 'green':
|
|
37
|
-
return '#E8F5E9';
|
|
38
|
-
case 'yellow':
|
|
39
|
-
return '#FFF8E1';
|
|
40
|
-
default:
|
|
41
|
-
return '#E3F2FD';
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Determine text color based on the color prop
|
|
46
|
-
const getTextColor = () => {
|
|
47
|
-
switch (color) {
|
|
48
|
-
case 'red':
|
|
49
|
-
return '#D32F2F';
|
|
50
|
-
case 'green':
|
|
51
|
-
return '#388E3C';
|
|
52
|
-
case 'yellow':
|
|
53
|
-
return '#F57F17';
|
|
54
|
-
default:
|
|
55
|
-
return '#1976D2';
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
59
|
-
style: [styles.container, {
|
|
60
|
-
backgroundColor: getBackgroundColor(),
|
|
61
|
-
opacity: fadeAnim,
|
|
62
|
-
transform: [{
|
|
63
|
-
translateY: fadeAnim.interpolate({
|
|
64
|
-
inputRange: [0, 1],
|
|
65
|
-
outputRange: [-20, 0]
|
|
66
|
-
})
|
|
67
|
-
}]
|
|
68
|
-
}]
|
|
69
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
70
|
-
style: [styles.message, {
|
|
71
|
-
color: getTextColor()
|
|
72
|
-
}]
|
|
73
|
-
}, message));
|
|
74
|
-
};
|
|
75
|
-
const styles = StyleSheet.create({
|
|
76
|
-
container: {
|
|
77
|
-
position: 'absolute',
|
|
78
|
-
top: 40,
|
|
79
|
-
left: 20,
|
|
80
|
-
right: 20,
|
|
81
|
-
padding: 16,
|
|
82
|
-
borderRadius: 8,
|
|
83
|
-
shadowColor: '#000',
|
|
84
|
-
shadowOffset: {
|
|
85
|
-
width: 0,
|
|
86
|
-
height: 2
|
|
87
|
-
},
|
|
88
|
-
shadowOpacity: 0.1,
|
|
89
|
-
shadowRadius: 4,
|
|
90
|
-
elevation: 3,
|
|
91
|
-
zIndex: 1000
|
|
92
|
-
},
|
|
93
|
-
message: {
|
|
94
|
-
fontSize: 16,
|
|
95
|
-
fontWeight: '500'
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
export default Notification;
|
|
99
|
-
//# sourceMappingURL=Notification.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","View","Text","StyleSheet","Animated","Notification","message","color","duration","onClose","fadeAnim","Value","timing","toValue","useNativeDriver","start","timer","setTimeout","clearTimeout","getBackgroundColor","getTextColor","createElement","style","styles","container","backgroundColor","opacity","transform","translateY","interpolate","inputRange","outputRange","create","position","top","left","right","padding","borderRadius","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","zIndex","fontSize","fontWeight"],"sourceRoot":"..\\..\\..\\src","sources":["components/Notification.js"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAE/D,MAAMC,YAAY,GAAGA,CAAC;EAAEC,OAAO;EAAEC,KAAK,GAAG,MAAM;EAAEC,QAAQ,GAAG,IAAI;EAAEC;AAAQ,CAAC,KAAK;EAC9E,MAAM,CAACC,QAAQ,CAAC,GAAGV,QAAQ,CAAC,IAAII,QAAQ,CAACO,KAAK,CAAC,CAAC,CAAC,CAAC;EAElDZ,SAAS,CAAC,MAAM;IACd;IACAK,QAAQ,CAACQ,MAAM,CAACF,QA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AE,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,CAAC;MACH,CAAC;IAEL,CAAC;EACD,gBAEFjC,KAAA,CAAAuB,aAAA,CAACnB,IAAI;IAACoB,KAAK,EAAE,CAACC,MAAM,CAACjB,OAAO,EAAE;MAAEC,KAAK,EAAEa,YAAY,CAAC;IAAE,CAAC;EAAE,GAAEd,OAAc,CAC5D,CAAC;AAEpB,CAAC;AAED,MAAMiB,MAAM,GAAGpB,UAAU,CAAC6B,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,EAAE;IACPC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE,EAAE;IACTC,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,MAAM,EAAE;EACV,CAAC;EACDxC,OAAO,EAAE;IACPyC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAe3C,YAAY","ignoreList":[]}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, Animated } from 'react-native';
|
|
3
|
-
|
|
4
|
-
const Notification = ({ message, color = 'blue', duration = 3000, onClose }) => {
|
|
5
|
-
const [fadeAnim] = useState(new Animated.Value(0));
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
// Fade in
|
|
9
|
-
Animated.timing(fadeAnim, {
|
|
10
|
-
toValue: 1,
|
|
11
|
-
duration: 300,
|
|
12
|
-
useNativeDriver: true,
|
|
13
|
-
}).start();
|
|
14
|
-
|
|
15
|
-
// Set timeout to fade out
|
|
16
|
-
const timer = setTimeout(() => {
|
|
17
|
-
Animated.timing(fadeAnim, {
|
|
18
|
-
toValue: 0,
|
|
19
|
-
duration: 300,
|
|
20
|
-
useNativeDriver: true,
|
|
21
|
-
}).start(() => {
|
|
22
|
-
if (onClose) onClose();
|
|
23
|
-
});
|
|
24
|
-
}, duration);
|
|
25
|
-
|
|
26
|
-
return () => clearTimeout(timer);
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
// Determine background color based on the color prop
|
|
30
|
-
const getBackgroundColor = () => {
|
|
31
|
-
switch (color) {
|
|
32
|
-
case 'red':
|
|
33
|
-
return '#FFEBEE';
|
|
34
|
-
case 'green':
|
|
35
|
-
return '#E8F5E9';
|
|
36
|
-
case 'yellow':
|
|
37
|
-
return '#FFF8E1';
|
|
38
|
-
default:
|
|
39
|
-
return '#E3F2FD';
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Determine text color based on the color prop
|
|
44
|
-
const getTextColor = () => {
|
|
45
|
-
switch (color) {
|
|
46
|
-
case 'red':
|
|
47
|
-
return '#D32F2F';
|
|
48
|
-
case 'green':
|
|
49
|
-
return '#388E3C';
|
|
50
|
-
case 'yellow':
|
|
51
|
-
return '#F57F17';
|
|
52
|
-
default:
|
|
53
|
-
return '#1976D2';
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Animated.View
|
|
59
|
-
style={[
|
|
60
|
-
styles.container,
|
|
61
|
-
{
|
|
62
|
-
backgroundColor: getBackgroundColor(),
|
|
63
|
-
opacity: fadeAnim,
|
|
64
|
-
transform: [
|
|
65
|
-
{
|
|
66
|
-
translateY: fadeAnim.interpolate({
|
|
67
|
-
inputRange: [0, 1],
|
|
68
|
-
outputRange: [-20, 0],
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
]}
|
|
74
|
-
>
|
|
75
|
-
<Text style={[styles.message, { color: getTextColor() }]}>{message}</Text>
|
|
76
|
-
</Animated.View>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const styles = StyleSheet.create({
|
|
81
|
-
container: {
|
|
82
|
-
position: 'absolute',
|
|
83
|
-
top: 40,
|
|
84
|
-
left: 20,
|
|
85
|
-
right: 20,
|
|
86
|
-
padding: 16,
|
|
87
|
-
borderRadius: 8,
|
|
88
|
-
shadowColor: '#000',
|
|
89
|
-
shadowOffset: { width: 0, height: 2 },
|
|
90
|
-
shadowOpacity: 0.1,
|
|
91
|
-
shadowRadius: 4,
|
|
92
|
-
elevation: 3,
|
|
93
|
-
zIndex: 1000,
|
|
94
|
-
},
|
|
95
|
-
message: {
|
|
96
|
-
fontSize: 16,
|
|
97
|
-
fontWeight: '500',
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export default Notification;
|