@oxyhq/services 6.9.3 → 6.9.5
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/ui/client.js +0 -7
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/components/IconButton/IconButton.js +3 -3
- package/lib/commonjs/ui/components/IconButton/IconButton.js.map +1 -1
- package/lib/commonjs/ui/components/feedback/FormInput.js.map +1 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/types.js +4 -0
- package/lib/commonjs/ui/screens/AppInfoScreen.js +66 -60
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +139 -79
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +39 -29
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/client.js +0 -1
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/components/IconButton/IconButton.js +3 -3
- package/lib/module/ui/components/IconButton/IconButton.js.map +1 -1
- package/lib/module/ui/components/feedback/FormInput.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/types.js +2 -0
- package/lib/module/ui/screens/AppInfoScreen.js +66 -60
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +139 -79
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +39 -29
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +0 -1
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/types.d.ts +18 -17
- package/lib/typescript/commonjs/ui/components/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +0 -1
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/types.d.ts +18 -17
- package/lib/typescript/module/ui/components/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/ui/client.ts +0 -1
- package/src/ui/components/IconButton/IconButton.tsx +2 -2
- package/src/ui/components/feedback/FormInput.tsx +1 -1
- package/src/ui/components/icon/OxyIcon.tsx +1 -1
- package/src/ui/components/types.tsx +19 -17
- package/src/ui/screens/AppInfoScreen.tsx +63 -61
- package/src/ui/screens/FileManagementScreen.tsx +130 -121
- package/src/ui/screens/SessionManagementScreen.tsx +30 -28
- package/lib/commonjs/ui/components/AnimationExample.js +0 -213
- package/lib/commonjs/ui/components/AnimationExample.js.map +0 -1
- package/lib/commonjs/ui/components/ErrorBoundary.js +0 -145
- package/lib/commonjs/ui/components/ErrorBoundary.js.map +0 -1
- package/lib/commonjs/ui/components/WebOxyProvider.js +0 -106
- package/lib/commonjs/ui/components/WebOxyProvider.js.map +0 -1
- package/lib/module/ui/components/AnimationExample.js +0 -209
- package/lib/module/ui/components/AnimationExample.js.map +0 -1
- package/lib/module/ui/components/ErrorBoundary.js +0 -139
- package/lib/module/ui/components/ErrorBoundary.js.map +0 -1
- package/lib/module/ui/components/WebOxyProvider.js +0 -102
- package/lib/module/ui/components/WebOxyProvider.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/AnimationExample.d.ts +0 -4
- package/lib/typescript/commonjs/ui/components/AnimationExample.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts +0 -31
- package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/WebOxyProvider.d.ts +0 -52
- package/lib/typescript/commonjs/ui/components/WebOxyProvider.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/AnimationExample.d.ts +0 -4
- package/lib/typescript/module/ui/components/AnimationExample.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/ErrorBoundary.d.ts +0 -31
- package/lib/typescript/module/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/WebOxyProvider.d.ts +0 -52
- package/lib/typescript/module/ui/components/WebOxyProvider.d.ts.map +0 -1
- package/src/ui/components/AnimationExample.tsx +0 -195
- package/src/ui/components/ErrorBoundary.tsx +0 -154
- package/src/ui/components/WebOxyProvider.tsx +0 -117
|
@@ -20,6 +20,7 @@ import { Header, GroupedSection } from '../components';
|
|
|
20
20
|
import { useThemeStyles } from '../hooks/useThemeStyles';
|
|
21
21
|
import { normalizeTheme } from '../utils/themeUtils';
|
|
22
22
|
import { useOxy } from '../context/OxyContext';
|
|
23
|
+
import { useI18n } from '../hooks/useI18n';
|
|
23
24
|
|
|
24
25
|
// Button background colors for session actions
|
|
25
26
|
const SWITCH_BUTTON_BG = {
|
|
@@ -46,6 +47,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
46
47
|
logoutAll,
|
|
47
48
|
switchSession,
|
|
48
49
|
} = useOxy();
|
|
50
|
+
const { t } = useI18n();
|
|
49
51
|
const [loading, setLoading] = useState(true);
|
|
50
52
|
const [refreshing, setRefreshing] = useState(false);
|
|
51
53
|
const [actionLoading, setActionLoading] = useState<string | null>(null);
|
|
@@ -74,11 +76,11 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
74
76
|
console.error('Failed to load sessions:', error);
|
|
75
77
|
}
|
|
76
78
|
if (Platform.OS === 'web') {
|
|
77
|
-
toast.error('
|
|
79
|
+
toast.error(t('sessionManagement.toasts.loadFailed'));
|
|
78
80
|
} else {
|
|
79
81
|
Alert.alert(
|
|
80
82
|
'Error',
|
|
81
|
-
'
|
|
83
|
+
t('sessionManagement.toasts.loadFailed'),
|
|
82
84
|
[{ text: 'OK' }]
|
|
83
85
|
);
|
|
84
86
|
}
|
|
@@ -90,17 +92,17 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
90
92
|
|
|
91
93
|
// Memoized logout session handler - prevents unnecessary re-renders
|
|
92
94
|
const handleLogoutSession = useCallback(async (sessionId: string) => {
|
|
93
|
-
confirmAction('
|
|
95
|
+
confirmAction(t('sessionManagement.confirms.logoutSession'), async () => {
|
|
94
96
|
try {
|
|
95
97
|
setActionLoading(sessionId);
|
|
96
98
|
await logout(sessionId);
|
|
97
99
|
await refreshSessions();
|
|
98
|
-
toast.success('
|
|
100
|
+
toast.success(t('sessionManagement.toasts.logoutSuccess'));
|
|
99
101
|
} catch (error) {
|
|
100
102
|
if (__DEV__) {
|
|
101
103
|
console.error('Logout session failed:', error);
|
|
102
104
|
}
|
|
103
|
-
toast.error('
|
|
105
|
+
toast.error(t('sessionManagement.toasts.logoutFailed'));
|
|
104
106
|
} finally {
|
|
105
107
|
setActionLoading(null);
|
|
106
108
|
}
|
|
@@ -116,11 +118,11 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
116
118
|
// Memoized logout other sessions handler - prevents unnecessary re-renders
|
|
117
119
|
const handleLogoutOtherSessions = useCallback(async () => {
|
|
118
120
|
if (otherSessionsCount === 0) {
|
|
119
|
-
toast.info('
|
|
121
|
+
toast.info(t('sessionManagement.toasts.noOtherSessions'));
|
|
120
122
|
return;
|
|
121
123
|
}
|
|
122
124
|
confirmAction(
|
|
123
|
-
|
|
125
|
+
t('sessionManagement.confirms.logoutOthers', { count: otherSessionsCount }),
|
|
124
126
|
async () => {
|
|
125
127
|
try {
|
|
126
128
|
setActionLoading('others');
|
|
@@ -130,12 +132,12 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
await refreshSessions();
|
|
133
|
-
toast.success('
|
|
135
|
+
toast.success(t('sessionManagement.toasts.logoutOthersSuccess'));
|
|
134
136
|
} catch (error) {
|
|
135
137
|
if (__DEV__) {
|
|
136
138
|
console.error('Logout other sessions failed:', error);
|
|
137
139
|
}
|
|
138
|
-
toast.error('
|
|
140
|
+
toast.error(t('sessionManagement.toasts.logoutOthersFailed'));
|
|
139
141
|
} finally {
|
|
140
142
|
setActionLoading(null);
|
|
141
143
|
}
|
|
@@ -146,7 +148,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
146
148
|
// Memoized logout all sessions handler - prevents unnecessary re-renders
|
|
147
149
|
const handleLogoutAllSessions = useCallback(async () => {
|
|
148
150
|
confirmAction(
|
|
149
|
-
'
|
|
151
|
+
t('sessionManagement.confirms.logoutAll'),
|
|
150
152
|
async () => {
|
|
151
153
|
try {
|
|
152
154
|
setActionLoading('all');
|
|
@@ -155,7 +157,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
155
157
|
if (__DEV__) {
|
|
156
158
|
console.error('Logout all sessions failed:', error);
|
|
157
159
|
}
|
|
158
|
-
toast.error('
|
|
160
|
+
toast.error(t('sessionManagement.toasts.logoutAllFailed'));
|
|
159
161
|
} finally {
|
|
160
162
|
setActionLoading(null);
|
|
161
163
|
}
|
|
@@ -165,7 +167,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
165
167
|
|
|
166
168
|
// Memoized relative time formatter - prevents function recreation on every render
|
|
167
169
|
const formatRelative = useCallback((dateString?: string) => {
|
|
168
|
-
if (!dateString) return '
|
|
170
|
+
if (!dateString) return t('appInfo.items.unknown');
|
|
169
171
|
const date = new Date(dateString);
|
|
170
172
|
const now = new Date();
|
|
171
173
|
const diffMs = date.getTime() - now.getTime();
|
|
@@ -187,12 +189,12 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
187
189
|
setSwitchLoading(sessionId);
|
|
188
190
|
try {
|
|
189
191
|
await switchSession(sessionId);
|
|
190
|
-
toast.success('
|
|
192
|
+
toast.success(t('sessionManagement.toasts.switchSuccess'));
|
|
191
193
|
} catch (e) {
|
|
192
194
|
if (__DEV__) {
|
|
193
195
|
console.error('Switch session failed', e);
|
|
194
196
|
}
|
|
195
|
-
toast.error('
|
|
197
|
+
toast.error(t('sessionManagement.toasts.switchFailed'));
|
|
196
198
|
} finally {
|
|
197
199
|
setSwitchLoading(null);
|
|
198
200
|
}
|
|
@@ -220,7 +222,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
220
222
|
id: session.sessionId,
|
|
221
223
|
icon: isCurrent ? 'shield-checkmark' : 'laptop-outline',
|
|
222
224
|
iconColor: isCurrent ? successColor : primaryColor,
|
|
223
|
-
title: isCurrent ? '
|
|
225
|
+
title: isCurrent ? t('sessionManagement.currentSession') : t('sessionManagement.sessionLabel', { id: session.sessionId.substring(0, 8) }),
|
|
224
226
|
subtitle: subtitleParts.join(' \u2022 '),
|
|
225
227
|
showChevron: false,
|
|
226
228
|
multiRow: true,
|
|
@@ -234,7 +236,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
234
236
|
{switchLoading === session.sessionId ? (
|
|
235
237
|
<ActivityIndicator size="small" color={primaryColor} />
|
|
236
238
|
) : (
|
|
237
|
-
<Text style={[styles.sessionPillText, { color: primaryColor }]}>
|
|
239
|
+
<Text style={[styles.sessionPillText, { color: primaryColor }]}>{t('sessionManagement.switch')}</Text>
|
|
238
240
|
)}
|
|
239
241
|
</TouchableOpacity>
|
|
240
242
|
<TouchableOpacity
|
|
@@ -245,13 +247,13 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
245
247
|
{actionLoading === session.sessionId ? (
|
|
246
248
|
<ActivityIndicator size="small" color={dangerColor} />
|
|
247
249
|
) : (
|
|
248
|
-
<Text style={[styles.sessionPillText, { color: dangerColor }]}>
|
|
250
|
+
<Text style={[styles.sessionPillText, { color: dangerColor }]}>{t('sessionManagement.logout')}</Text>
|
|
249
251
|
)}
|
|
250
252
|
</TouchableOpacity>
|
|
251
253
|
</View>
|
|
252
254
|
) : (
|
|
253
255
|
<View style={styles.sessionActionsRow}>
|
|
254
|
-
<Text style={[styles.currentBadgeText, { color: successColor }]}>
|
|
256
|
+
<Text style={[styles.currentBadgeText, { color: successColor }]}>{t('sessionManagement.active')}</Text>
|
|
255
257
|
</View>
|
|
256
258
|
),
|
|
257
259
|
selected: isCurrent,
|
|
@@ -265,8 +267,8 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
265
267
|
id: 'logout-others',
|
|
266
268
|
icon: 'exit-outline',
|
|
267
269
|
iconColor: primaryColor,
|
|
268
|
-
title: '
|
|
269
|
-
subtitle: otherSessionsCount === 0 ? '
|
|
270
|
+
title: t('sessionManagement.logoutOthers.title'),
|
|
271
|
+
subtitle: otherSessionsCount === 0 ? t('sessionManagement.logoutOthers.noOtherSessions') : t('sessionManagement.logoutOthers.subtitle'),
|
|
270
272
|
onPress: handleLogoutOtherSessions,
|
|
271
273
|
showChevron: false,
|
|
272
274
|
customContent: actionLoading === 'others' ? <ActivityIndicator size="small" color={primaryColor} /> : undefined,
|
|
@@ -277,8 +279,8 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
277
279
|
id: 'logout-all',
|
|
278
280
|
icon: 'warning-outline',
|
|
279
281
|
iconColor: dangerColor,
|
|
280
|
-
title: '
|
|
281
|
-
subtitle: '
|
|
282
|
+
title: t('sessionManagement.logoutAll.title'),
|
|
283
|
+
subtitle: t('sessionManagement.logoutAll.subtitle'),
|
|
282
284
|
onPress: handleLogoutAllSessions,
|
|
283
285
|
showChevron: false,
|
|
284
286
|
customContent: actionLoading === 'all' ? <ActivityIndicator size="small" color={dangerColor} /> : undefined,
|
|
@@ -291,7 +293,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
291
293
|
return (
|
|
292
294
|
<View style={[styles.container, styles.centerContent, { backgroundColor }]}>
|
|
293
295
|
<ActivityIndicator size="large" color={primaryColor} />
|
|
294
|
-
<Text style={[styles.loadingText, { color: textColor }]}>
|
|
296
|
+
<Text style={[styles.loadingText, { color: textColor }]}>{t('sessionManagement.loading')}</Text>
|
|
295
297
|
</View>
|
|
296
298
|
);
|
|
297
299
|
}
|
|
@@ -299,8 +301,8 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
299
301
|
return (
|
|
300
302
|
<View style={[styles.container, { backgroundColor }]}>
|
|
301
303
|
<Header
|
|
302
|
-
title=
|
|
303
|
-
subtitle=
|
|
304
|
+
title={t('sessionManagement.title')}
|
|
305
|
+
subtitle={t('sessionManagement.subtitle')}
|
|
304
306
|
|
|
305
307
|
onBack={goBack || onClose}
|
|
306
308
|
elevation="subtle"
|
|
@@ -319,7 +321,7 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
319
321
|
{userSessions.length > 0 ? (
|
|
320
322
|
<>
|
|
321
323
|
{lastRefreshed && (
|
|
322
|
-
<Text style={[styles.metaText, { color: '#777', marginBottom: 6 }]}>
|
|
324
|
+
<Text style={[styles.metaText, { color: '#777', marginBottom: 6 }]}>{t('sessionManagement.lastRefreshed', { time: formatRelative(lastRefreshed.toISOString()) })}</Text>
|
|
323
325
|
)}
|
|
324
326
|
<View style={styles.fullBleed}>
|
|
325
327
|
<GroupedSection items={sessionItems} />
|
|
@@ -331,13 +333,13 @@ const SessionManagementScreen: React.FC<BaseScreenProps> = ({
|
|
|
331
333
|
</>
|
|
332
334
|
) : (
|
|
333
335
|
<View style={styles.emptyState}>
|
|
334
|
-
<Text style={[styles.emptyStateText, { color: isDarkTheme ? '#BBBBBB' : '#666666' }]}>
|
|
336
|
+
<Text style={[styles.emptyStateText, { color: isDarkTheme ? '#BBBBBB' : '#666666' }]}>{t('sessionManagement.empty')}</Text>
|
|
335
337
|
</View>
|
|
336
338
|
)}
|
|
337
339
|
</ScrollView>
|
|
338
340
|
<View style={[styles.footer, { borderTopColor: borderColor }]}>
|
|
339
341
|
<TouchableOpacity style={styles.closeButton} onPress={onClose}>
|
|
340
|
-
<Text style={[styles.closeButtonText, { color: primaryColor }]}>
|
|
342
|
+
<Text style={[styles.closeButtonText, { color: primaryColor }]}>{t('sessionManagement.close')}</Text>
|
|
341
343
|
</TouchableOpacity>
|
|
342
344
|
</View>
|
|
343
345
|
</View>
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
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); }
|
|
12
|
-
// Example component showcasing improved Reanimated usage
|
|
13
|
-
const AnimationExample = () => {
|
|
14
|
-
const [currentStep, setCurrentStep] = (0, _react.useState)(0);
|
|
15
|
-
|
|
16
|
-
// Shared values for better performance
|
|
17
|
-
const opacity = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
18
|
-
const scale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
19
|
-
const translateX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
20
|
-
const rotation = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
21
|
-
const progress = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
22
|
-
const colorProgress = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
23
|
-
|
|
24
|
-
// Animated styles with proper interpolation
|
|
25
|
-
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
26
|
-
return {
|
|
27
|
-
opacity: opacity.value,
|
|
28
|
-
transform: [{
|
|
29
|
-
scale: scale.value
|
|
30
|
-
}, {
|
|
31
|
-
translateX: translateX.value
|
|
32
|
-
}, {
|
|
33
|
-
rotate: `${rotation.value}deg`
|
|
34
|
-
}]
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
const progressStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
38
|
-
return {
|
|
39
|
-
width: `${progress.value * 100}%`,
|
|
40
|
-
backgroundColor: (0, _reactNativeReanimated.interpolateColor)(colorProgress.value, [0, 1], ['#3498db', '#e74c3c'])
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
const backgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
44
|
-
return {
|
|
45
|
-
backgroundColor: (0, _reactNativeReanimated.interpolateColor)(colorProgress.value, [0, 1], ['#ecf0f1', '#f39c12'])
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Complex animation sequence
|
|
50
|
-
const animateSequence = () => {
|
|
51
|
-
'worklet';
|
|
52
|
-
|
|
53
|
-
// Staggered animations for smooth transitions
|
|
54
|
-
opacity.value = (0, _reactNativeReanimated.withTiming)(0.5, {
|
|
55
|
-
duration: 200
|
|
56
|
-
});
|
|
57
|
-
scale.value = (0, _reactNativeReanimated.withSpring)(0.8, {
|
|
58
|
-
damping: 15,
|
|
59
|
-
stiffness: 150
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Delayed follow-up animations
|
|
63
|
-
translateX.value = (0, _reactNativeReanimated.withDelay)(100, (0, _reactNativeReanimated.withSpring)(50, {
|
|
64
|
-
damping: 20,
|
|
65
|
-
stiffness: 100
|
|
66
|
-
}, finished => {
|
|
67
|
-
if (finished) {
|
|
68
|
-
translateX.value = (0, _reactNativeReanimated.withSpring)(0, {
|
|
69
|
-
damping: 15,
|
|
70
|
-
stiffness: 150
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}));
|
|
74
|
-
|
|
75
|
-
// Sequential animations
|
|
76
|
-
rotation.value = (0, _reactNativeReanimated.withSequence)((0, _reactNativeReanimated.withTiming)(10, {
|
|
77
|
-
duration: 150
|
|
78
|
-
}), (0, _reactNativeReanimated.withTiming)(-10, {
|
|
79
|
-
duration: 150
|
|
80
|
-
}), (0, _reactNativeReanimated.withTiming)(0, {
|
|
81
|
-
duration: 150
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
// Progress animation with easing
|
|
85
|
-
progress.value = (0, _reactNativeReanimated.withTiming)(1, {
|
|
86
|
-
duration: 1000,
|
|
87
|
-
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp)
|
|
88
|
-
}, finished => {
|
|
89
|
-
if (finished) {
|
|
90
|
-
(0, _reactNativeReanimated.runOnJS)(setCurrentStep)(currentStep + 1);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Color transition
|
|
95
|
-
colorProgress.value = (0, _reactNativeReanimated.withTiming)(1, {
|
|
96
|
-
duration: 800
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Reset animations
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
opacity.value = (0, _reactNativeReanimated.withSpring)(1);
|
|
102
|
-
scale.value = (0, _reactNativeReanimated.withSpring)(1);
|
|
103
|
-
progress.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
104
|
-
duration: 500
|
|
105
|
-
});
|
|
106
|
-
colorProgress.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
107
|
-
duration: 500
|
|
108
|
-
});
|
|
109
|
-
}, 1500);
|
|
110
|
-
};
|
|
111
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
|
|
112
|
-
style: [styles.container, backgroundStyle],
|
|
113
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
114
|
-
style: styles.title,
|
|
115
|
-
children: "Advanced Reanimated Example"
|
|
116
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
117
|
-
style: styles.subtitle,
|
|
118
|
-
children: ["Step: ", currentStep]
|
|
119
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
120
|
-
style: [styles.box, animatedStyle],
|
|
121
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
122
|
-
style: styles.boxText,
|
|
123
|
-
children: "Animated Box"
|
|
124
|
-
})
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
126
|
-
style: styles.progressContainer,
|
|
127
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
128
|
-
style: [styles.progressBar, progressStyle]
|
|
129
|
-
})
|
|
130
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
131
|
-
style: styles.button,
|
|
132
|
-
onPress: animateSequence,
|
|
133
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
134
|
-
style: styles.buttonText,
|
|
135
|
-
children: "Animate Sequence"
|
|
136
|
-
})
|
|
137
|
-
})]
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
const styles = _reactNative.StyleSheet.create({
|
|
141
|
-
container: {
|
|
142
|
-
flex: 1,
|
|
143
|
-
justifyContent: 'center',
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
padding: 20
|
|
146
|
-
},
|
|
147
|
-
title: {
|
|
148
|
-
fontSize: 24,
|
|
149
|
-
fontWeight: 'bold',
|
|
150
|
-
marginBottom: 10,
|
|
151
|
-
color: '#2c3e50'
|
|
152
|
-
},
|
|
153
|
-
subtitle: {
|
|
154
|
-
fontSize: 16,
|
|
155
|
-
marginBottom: 30,
|
|
156
|
-
color: '#7f8c8d'
|
|
157
|
-
},
|
|
158
|
-
box: {
|
|
159
|
-
width: 150,
|
|
160
|
-
height: 150,
|
|
161
|
-
backgroundColor: '#3498db',
|
|
162
|
-
borderRadius: 20,
|
|
163
|
-
justifyContent: 'center',
|
|
164
|
-
alignItems: 'center',
|
|
165
|
-
marginBottom: 30,
|
|
166
|
-
shadowColor: '#000',
|
|
167
|
-
shadowOffset: {
|
|
168
|
-
width: 0,
|
|
169
|
-
height: 4
|
|
170
|
-
},
|
|
171
|
-
shadowOpacity: 0.3,
|
|
172
|
-
shadowRadius: 8,
|
|
173
|
-
elevation: 8
|
|
174
|
-
},
|
|
175
|
-
boxText: {
|
|
176
|
-
color: 'white',
|
|
177
|
-
fontSize: 16,
|
|
178
|
-
fontWeight: 'bold'
|
|
179
|
-
},
|
|
180
|
-
progressContainer: {
|
|
181
|
-
width: '100%',
|
|
182
|
-
height: 10,
|
|
183
|
-
backgroundColor: '#ecf0f1',
|
|
184
|
-
borderRadius: 5,
|
|
185
|
-
marginBottom: 30,
|
|
186
|
-
overflow: 'hidden'
|
|
187
|
-
},
|
|
188
|
-
progressBar: {
|
|
189
|
-
height: '100%',
|
|
190
|
-
borderRadius: 5
|
|
191
|
-
},
|
|
192
|
-
button: {
|
|
193
|
-
backgroundColor: '#e74c3c',
|
|
194
|
-
paddingHorizontal: 30,
|
|
195
|
-
paddingVertical: 15,
|
|
196
|
-
borderRadius: 25,
|
|
197
|
-
shadowColor: '#000',
|
|
198
|
-
shadowOffset: {
|
|
199
|
-
width: 0,
|
|
200
|
-
height: 2
|
|
201
|
-
},
|
|
202
|
-
shadowOpacity: 0.2,
|
|
203
|
-
shadowRadius: 4,
|
|
204
|
-
elevation: 4
|
|
205
|
-
},
|
|
206
|
-
buttonText: {
|
|
207
|
-
color: 'white',
|
|
208
|
-
fontSize: 16,
|
|
209
|
-
fontWeight: 'bold'
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
var _default = exports.default = AnimationExample;
|
|
213
|
-
//# sourceMappingURL=AnimationExample.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AnimationExample","currentStep","setCurrentStep","useState","opacity","useSharedValue","scale","translateX","rotation","progress","colorProgress","animatedStyle","useAnimatedStyle","value","transform","rotate","progressStyle","width","backgroundColor","interpolateColor","backgroundStyle","animateSequence","withTiming","duration","withSpring","damping","stiffness","withDelay","finished","withSequence","easing","Easing","out","exp","runOnJS","setTimeout","jsxs","View","style","styles","container","children","jsx","Text","title","subtitle","box","boxText","progressContainer","progressBar","TouchableOpacity","button","onPress","buttonText","StyleSheet","create","flex","justifyContent","alignItems","padding","fontSize","fontWeight","marginBottom","color","height","borderRadius","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","overflow","paddingHorizontal","paddingVertical","_default","exports"],"sourceRoot":"../../../../src","sources":["ui/components/AnimationExample.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUiC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,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AE;IACPgB,KAAK,EAAE,OAAO;IACdH,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDb,iBAAiB,EAAE;IACjB/B,KAAK,EAAE,MAAM;IACb+C,MAAM,EAAE,EAAE;IACV9C,eAAe,EAAE,SAAS;IAC1B+C,YAAY,EAAE,CAAC;IACfH,YAAY,EAAE,EAAE;IAChBS,QAAQ,EAAE;EACZ,CAAC;EACDtB,WAAW,EAAE;IACXe,MAAM,EAAE,MAAM;IACdC,YAAY,EAAE;EAChB,CAAC;EACDd,MAAM,EAAE;IACNjC,eAAe,EAAE,SAAS;IAC1BsD,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBR,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAElD,KAAK,EAAE,CAAC;MAAE+C,MAAM,EAAE;IAAE,CAAC;IACrCI,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDjB,UAAU,EAAE;IACVU,KAAK,EAAE,OAAO;IACdH,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAEYS,gBAAgB","ignoreList":[]}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ErrorBoundary = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
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); }
|
|
11
|
-
/**
|
|
12
|
-
* Error Boundary Component
|
|
13
|
-
*
|
|
14
|
-
* Catches JavaScript errors anywhere in the child component tree,
|
|
15
|
-
* logs those errors, and displays a fallback UI instead of crashing.
|
|
16
|
-
*
|
|
17
|
-
* Usage:
|
|
18
|
-
* <ErrorBoundary>
|
|
19
|
-
* <YourComponent />
|
|
20
|
-
* </ErrorBoundary>
|
|
21
|
-
*/
|
|
22
|
-
class ErrorBoundary extends _react.Component {
|
|
23
|
-
constructor(props) {
|
|
24
|
-
super(props);
|
|
25
|
-
this.state = {
|
|
26
|
-
hasError: false,
|
|
27
|
-
error: null,
|
|
28
|
-
errorInfo: null
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
static getDerivedStateFromError(error) {
|
|
32
|
-
// Update state so the next render will show the fallback UI
|
|
33
|
-
return {
|
|
34
|
-
hasError: true,
|
|
35
|
-
error
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
componentDidCatch(error, errorInfo) {
|
|
39
|
-
// Log error to console in development
|
|
40
|
-
if (__DEV__) {
|
|
41
|
-
console.error('ErrorBoundary caught an error:', error, errorInfo);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Call optional error handler
|
|
45
|
-
if (this.props.onError) {
|
|
46
|
-
this.props.onError(error, errorInfo);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Update state with error info
|
|
50
|
-
this.setState({
|
|
51
|
-
error,
|
|
52
|
-
errorInfo
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
handleReset = () => {
|
|
56
|
-
this.setState({
|
|
57
|
-
hasError: false,
|
|
58
|
-
error: null,
|
|
59
|
-
errorInfo: null
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
render() {
|
|
63
|
-
if (this.state.hasError) {
|
|
64
|
-
// Use custom fallback if provided
|
|
65
|
-
if (this.props.fallback) {
|
|
66
|
-
return this.props.fallback;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Default fallback UI
|
|
70
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
71
|
-
style: styles.container,
|
|
72
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
73
|
-
style: styles.errorContainer,
|
|
74
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
75
|
-
style: styles.errorTitle,
|
|
76
|
-
children: "Something went wrong"
|
|
77
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
78
|
-
style: styles.errorMessage,
|
|
79
|
-
children: this.state.error?.message || 'An unexpected error occurred'
|
|
80
|
-
}), __DEV__ && this.state.errorInfo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
81
|
-
style: styles.errorDetails,
|
|
82
|
-
children: this.state.errorInfo.componentStack
|
|
83
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
84
|
-
style: styles.resetButton,
|
|
85
|
-
onPress: this.handleReset,
|
|
86
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
87
|
-
style: styles.resetButtonText,
|
|
88
|
-
children: "Try Again"
|
|
89
|
-
})
|
|
90
|
-
})]
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return this.props.children;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.ErrorBoundary = ErrorBoundary;
|
|
98
|
-
const styles = _reactNative.StyleSheet.create({
|
|
99
|
-
container: {
|
|
100
|
-
flex: 1,
|
|
101
|
-
justifyContent: 'center',
|
|
102
|
-
alignItems: 'center',
|
|
103
|
-
padding: 20,
|
|
104
|
-
backgroundColor: '#fff'
|
|
105
|
-
},
|
|
106
|
-
errorContainer: {
|
|
107
|
-
maxWidth: 400,
|
|
108
|
-
width: '100%',
|
|
109
|
-
padding: 20,
|
|
110
|
-
borderRadius: 8,
|
|
111
|
-
backgroundColor: '#f5f5f5',
|
|
112
|
-
borderWidth: 1,
|
|
113
|
-
borderColor: '#e0e0e0'
|
|
114
|
-
},
|
|
115
|
-
errorTitle: {
|
|
116
|
-
fontSize: 20,
|
|
117
|
-
fontWeight: 'bold',
|
|
118
|
-
marginBottom: 10,
|
|
119
|
-
color: '#d32f2f'
|
|
120
|
-
},
|
|
121
|
-
errorMessage: {
|
|
122
|
-
fontSize: 14,
|
|
123
|
-
marginBottom: 15,
|
|
124
|
-
color: '#666'
|
|
125
|
-
},
|
|
126
|
-
errorDetails: {
|
|
127
|
-
fontSize: 12,
|
|
128
|
-
marginBottom: 15,
|
|
129
|
-
color: '#999',
|
|
130
|
-
fontFamily: 'monospace'
|
|
131
|
-
},
|
|
132
|
-
resetButton: {
|
|
133
|
-
backgroundColor: '#007AFF',
|
|
134
|
-
padding: 12,
|
|
135
|
-
borderRadius: 6,
|
|
136
|
-
alignItems: 'center'
|
|
137
|
-
},
|
|
138
|
-
resetButtonText: {
|
|
139
|
-
color: '#fff',
|
|
140
|
-
fontSize: 16,
|
|
141
|
-
fontWeight: '600'
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
var _default = exports.default = ErrorBoundary;
|
|
145
|
-
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ErrorBoundary","Component","constructor","props","state","hasError","error","errorInfo","getDerivedStateFromError","componentDidCatch","__DEV__","console","onError","setState","handleReset","render","fallback","jsx","View","style","styles","container","children","jsxs","errorContainer","Text","errorTitle","errorMessage","message","errorDetails","componentStack","TouchableOpacity","resetButton","onPress","resetButtonText","exports","StyleSheet","create","flex","justifyContent","alignItems","padding","backgroundColor","maxWidth","width","borderRadius","borderWidth","borderColor","fontSize","fontWeight","marginBottom","color","fontFamily","_default"],"sourceRoot":"../../../../src","sources":["ui/components/ErrorBoundary.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAwE,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CA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