@umituz/react-native-settings 1.3.5 → 1.3.6

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.5",
3
+ "version": "1.3.6",
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",
@@ -140,8 +140,16 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
140
140
  };
141
141
 
142
142
  const handleClose = () => {
143
+ // Try to go back in current navigator first
143
144
  if (navigation.canGoBack()) {
144
145
  navigation.goBack();
146
+ } else {
147
+ // If we can't go back in current navigator, try parent navigator
148
+ // This handles the case where Settings is the root screen of a stack
149
+ const parent = navigation.getParent();
150
+ if (parent?.canGoBack()) {
151
+ parent.goBack();
152
+ }
145
153
  }
146
154
  };
147
155
 
@@ -157,8 +165,15 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
157
165
  await onboardingStore.reset();
158
166
  // Emit event to trigger navigation to onboarding
159
167
  DeviceEventEmitter.emit('reset-onboarding');
160
- // Close settings first
161
- navigation.goBack();
168
+ // Close settings first - try parent navigator if current can't go back
169
+ if (navigation.canGoBack()) {
170
+ navigation.goBack();
171
+ } else {
172
+ const parent = navigation.getParent();
173
+ if (parent?.canGoBack()) {
174
+ parent.goBack();
175
+ }
176
+ }
162
177
  // Small delay to ensure navigation completes
163
178
  setTimeout(() => {
164
179
  DeviceEventEmitter.emit('show-onboarding');