瀏覽代碼

conflict fixed

Viktoriia 5 月之前
父節點
當前提交
8268b23a68
共有 3 個文件被更改,包括 4 次插入14 次删除
  1. 1 1
      App.tsx
  2. 2 12
      src/contexts/NavigationContext.tsx
  3. 1 1
      src/screens/InAppScreens/TravelsScreen/CountriesScreen/index.tsx

+ 1 - 1
App.tsx

@@ -38,7 +38,7 @@ const linking = {
   prefixes: [API_HOST, 'nomadmania://'],
   config: {
     screens: {
-      publicProfileView: 'profile/:userId'
+      publicProfileView: '/profile/:userId'
     }
   }
 };

+ 2 - 12
src/contexts/NavigationContext.tsx

@@ -1,5 +1,5 @@
 import React, { createContext, useContext, useEffect, useState } from 'react';
-import { Linking, Platform } from 'react-native';
+import { Linking } from 'react-native';
 import { useNavigation } from '@react-navigation/native';
 import { NAVIGATION_PAGES } from 'src/types';
 import { storage, StoreType } from 'src/storage';
@@ -17,13 +17,7 @@ const parseURL = (url: string) => {
   return { path, queryParams };
 };
 
-export const useNavigationContext = () => {
-  const context = useContext(NavigationContext);
-  if (!context) {
-    throw new Error('useNavigationContext must be used within a NavigationProvider');
-  }
-  return context;
-};
+export const useNavigationContext = () => useContext(NavigationContext);
 
 export const NavigationProvider = ({ children }: { children: React.ReactNode }) => {
   const navigation = useNavigation();
@@ -32,14 +26,11 @@ export const NavigationProvider = ({ children }: { children: React.ReactNode })
 
   const handleDeepLink = async (url?: string) => {
     const link = url || (await Linking.getInitialURL());
-    console.log('Deep Link URL:', link);
     if (link) {
       const { path } = parseURL(link);
-      console.log('Parsed URL:', { path });
       if (path.startsWith('/profile') && token) {
         const segments = path.split('/');
         const userId = segments[2];
-        console.log('Navigating to public profile:', userId);
         navigation.navigate(...([NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW, { userId }] as never));
       }
     }
@@ -54,7 +45,6 @@ export const NavigationProvider = ({ children }: { children: React.ReactNode })
     }
 
     const subscription = Linking.addEventListener('url', (event) => {
-      console.log('Linking event:', event);
       handleDeepLink(event.url);
     });
 

+ 1 - 1
src/screens/InAppScreens/TravelsScreen/CountriesScreen/index.tsx

@@ -238,7 +238,7 @@ const CountriesScreen = () => {
         onClose={() => setInfoModalVisible(false)}
         type="success"
         title="SLOW score"
-        message={`Mark countries as visited.\nTell us if you stayed longer (7, 31, 101) days, this will increase your SLOW score, each longer stay should include at least 7 days countinuous stay in a country.`}
+        message={`Mark countries as visited.\nTell us if you stayed longer (11, 31, 101) days, this will increase your SLOW score, each longer stay should include at least 11 days countinuous stay in a country.`}
       />
     </PageWrapper>
   );