@umituz/react-native-settings 1.3.3 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-settings",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Settings management for React Native apps - user preferences, theme, language, notifications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -13,7 +13,8 @@
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
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
17
18
 
18
19
  import { useNavigation } from '@react-navigation/native';
19
20
  import { useTheme, useAppDesignTokens } from '@umituz/react-native-design-system-theme';
@@ -31,6 +32,16 @@ try {
31
32
  // Package not available, notificationService will be null
32
33
  }
33
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
+
34
45
  /**
35
46
  * Check if a navigation screen exists in the navigation state
36
47
  */
@@ -78,6 +89,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
78
89
  const navigation = useNavigation();
79
90
  const { theme, themeMode } = useTheme();
80
91
  const tokens = useAppDesignTokens();
92
+ const insets = useSafeAreaInsets();
81
93
  const { currentLanguage, t } = useLocalization();
82
94
 
83
95
  const currentLang = getLanguageByCode(currentLanguage);
@@ -133,6 +145,33 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
133
145
  }
134
146
  };
135
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
+
136
175
  // Debug: Log features to help diagnose empty screen issues
137
176
  /* eslint-disable-next-line no-console */
138
177
  if (__DEV__) {
@@ -147,7 +186,14 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
147
186
  return (
148
187
  <ScreenLayout testID="settings-screen" hideScrollIndicator>
149
188
  {/* Header with Close Button */}
150
- <View style={[styles.header, { borderBottomColor: theme.colors.borderLight }]}>
189
+ <View style={[
190
+ styles.header,
191
+ {
192
+ borderBottomColor: theme.colors.borderLight,
193
+ backgroundColor: theme.colors.surface,
194
+ paddingTop: insets.top,
195
+ }
196
+ ]}>
151
197
  <AtomicText type="headlineLarge" style={{ color: theme.colors.textPrimary, flex: 1 }}>
152
198
  {t('navigation.settings') || 'Settings'}
153
199
  </AtomicText>
@@ -191,6 +237,21 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
191
237
  </List.Section>
192
238
  )}
193
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
+
194
255
  {/* About & Legal Section */}
195
256
  {(features.about || features.legal) && (
196
257
  <List.Section style={{ marginBottom: 8 }}>
@@ -237,11 +298,14 @@ const styles = StyleSheet.create({
237
298
  alignItems: 'center',
238
299
  justifyContent: 'space-between',
239
300
  paddingHorizontal: 16,
240
- paddingVertical: 12,
301
+ paddingBottom: 12,
302
+ paddingTop: 12,
241
303
  borderBottomWidth: 1,
304
+ zIndex: 1000,
242
305
  },
243
306
  closeButton: {
244
- padding: 4,
307
+ padding: 8,
308
+ marginLeft: 8,
245
309
  },
246
310
  });
247
311