@umituz/react-native-settings 1.3.4 → 1.3.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/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import React, { useMemo } from 'react';
|
|
15
15
|
import { List, Divider } from 'react-native-paper';
|
|
16
|
-
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
16
|
+
import { DeviceEventEmitter, Alert, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
17
17
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
18
18
|
|
|
19
19
|
import { useNavigation } from '@react-navigation/native';
|
|
@@ -32,6 +32,16 @@ try {
|
|
|
32
32
|
// Package not available, notificationService will be null
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// Optional onboarding store - only import if package is available
|
|
36
|
+
let useOnboardingStore: any = null;
|
|
37
|
+
try {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
39
|
+
const onboardingPackage = require('@umituz/react-native-onboarding');
|
|
40
|
+
useOnboardingStore = onboardingPackage.useOnboardingStore;
|
|
41
|
+
} catch {
|
|
42
|
+
// Package not available, useOnboardingStore will be null
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
/**
|
|
36
46
|
* Check if a navigation screen exists in the navigation state
|
|
37
47
|
*/
|
|
@@ -135,6 +145,33 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
135
145
|
}
|
|
136
146
|
};
|
|
137
147
|
|
|
148
|
+
const handleShowOnboarding = async () => {
|
|
149
|
+
if (!useOnboardingStore) {
|
|
150
|
+
Alert.alert('Error', 'Onboarding package is not available');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
const onboardingStore = useOnboardingStore.getState();
|
|
156
|
+
// Reset onboarding state
|
|
157
|
+
await onboardingStore.reset();
|
|
158
|
+
// Emit event to trigger navigation to onboarding
|
|
159
|
+
DeviceEventEmitter.emit('reset-onboarding');
|
|
160
|
+
// Close settings first
|
|
161
|
+
navigation.goBack();
|
|
162
|
+
// Small delay to ensure navigation completes
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
DeviceEventEmitter.emit('show-onboarding');
|
|
165
|
+
}, 100);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
Alert.alert(
|
|
168
|
+
'Error',
|
|
169
|
+
'Failed to show onboarding. Please try again.',
|
|
170
|
+
[{ text: 'OK' }],
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
138
175
|
// Debug: Log features to help diagnose empty screen issues
|
|
139
176
|
/* eslint-disable-next-line no-console */
|
|
140
177
|
if (__DEV__) {
|
|
@@ -200,6 +237,21 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
200
237
|
</List.Section>
|
|
201
238
|
)}
|
|
202
239
|
|
|
240
|
+
{/* Development/Test: Show Onboarding */}
|
|
241
|
+
{__DEV__ && useOnboardingStore && (
|
|
242
|
+
<List.Section style={{ marginBottom: 8 }}>
|
|
243
|
+
<List.Subheader style={{ color: theme.colors.textSecondary }}>Development</List.Subheader>
|
|
244
|
+
<SettingItem
|
|
245
|
+
icon="Play"
|
|
246
|
+
iconGradient={theme.colors.settingGradients.info as unknown as string[]}
|
|
247
|
+
title="Show Onboarding (Dev)"
|
|
248
|
+
description="Navigate to onboarding screen"
|
|
249
|
+
onPress={handleShowOnboarding}
|
|
250
|
+
testID="show-onboarding-button"
|
|
251
|
+
/>
|
|
252
|
+
</List.Section>
|
|
253
|
+
)}
|
|
254
|
+
|
|
203
255
|
{/* About & Legal Section */}
|
|
204
256
|
{(features.about || features.legal) && (
|
|
205
257
|
<List.Section style={{ marginBottom: 8 }}>
|