Kaynağa Gözat

feat: expo dev client

Oleksandr Honcharov 1 yıl önce
ebeveyn
işleme
01f3497abb

+ 1 - 0
App.tsx

@@ -1,3 +1,4 @@
+import 'react-native-gesture-handler';
 import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
 import { NavigationContainer } from '@react-navigation/native';
 

+ 63 - 22
app.config.ts

@@ -1,43 +1,84 @@
 import 'dotenv/config';
-import type { ConfigContext, ExpoConfig } from 'expo/config';
 import { env } from 'process';
+import path from 'path';
+import dotenv from 'dotenv';
+
+import type { ConfigContext, ExpoConfig } from 'expo/config';
+
+const API_HOST = env.ENV === 'production' ? env.PRODUCTION_API_HOST : env.DEVELOPMENT_API_HOST;
+
+dotenv.config({
+  path: path.resolve(process.cwd(), '.env')
+});
 
 export default ({ config }: ConfigContext): ExpoConfig => ({
   ...config,
-  name: 'nomadmania-app',
+  name: 'NomadMania',
   slug: 'nomadmania-app',
+  owner: 'nomadmania',
+  scheme: 'nm',
+  // Should be updated after every production release (deploy to AppStore/PlayMarket)
   version: '1.0.0',
+  // Should be updated after every dependency change
+  runtimeVersion: '1.1',
   orientation: 'portrait',
   icon: './assets/icon.png',
   userInterfaceStyle: 'light',
-  plugins: [
-    [
-      'expo-image-picker',
-      {
-        photosPermission: 'The app accesses your photos to let you share them with your friends.',
-        cameraPermission: 'The app accesses your photos to let you share them with your friends.'
-      }
-    ]
-  ],
   extra: {
-    API_HOST: env.API_HOST
+    ENV: env.ENV,
+    API_HOST: API_HOST,
+    eas: {
+      projectId: env.EAS_PROJECT_ID
+    }
   },
   splash: {
     image: './assets/splash.png',
-    resizeMode: 'contain',
-    backgroundColor: '#ffffff'
+    resizeMode: 'cover'
+  },
+  notification: {
+    icon: './assets/notification-icon.png'
+  },
+  updates: {
+    url: 'https://u.expo.dev/c31c6828-3c32-4c7a-aabc-f9b8336b3b66'
   },
+  platforms: ['ios', 'android'],
   assetBundlePatterns: ['**/*'],
   ios: {
-    supportsTablet: true
+    supportsTablet: true,
+    bundleIdentifier: env.PACKAGE_NAME,
+    infoPlist: {
+      UIBackgroundModes: ['fetch'],
+      NSLocationAlwaysUsageDescription:
+        'Turn on location service to allow NomadMania.com find friends nearby.',
+      NSPhotoLibraryUsageDescription:
+        'Enable NomadMania.com to access your photo library to upload your profile picture. Any violence, excess of nudity, stolen picture, or scam is forbidden',
+      NSPhotoLibraryAddUsageDescription:
+        'Enable NomadMania.com to access your photo library to upload your profile picture. Any violence, excess of nudity, stolen picture, or scam is forbidden',
+      NSPushNotificationsDescription:
+        'This will allow NomadMania.com to send you notifications. Also you can disable it in app settings'
+    }
   },
   android: {
-    adaptiveIcon: {
-      foregroundImage: './assets/adaptive-icon.png',
-      backgroundColor: '#ffffff'
-    }
+    package: env.PACKAGE_NAME,
+    permissions: [
+      'ACCESS_BACKGROUND_LOCATION',
+      'ACCESS_FINE_LOCATION',
+      'ACCESS_COARSE_LOCATION',
+      'READ_EXTERNAL_STORAGE',
+      'WRITE_EXTERNAL_STORAGE',
+      'NOTIFICATIONS',
+      'USER_FACING_NOTIFICATIONS',
+      'INTERNET',
+      'CAMERA'
+    ]
   },
-  web: {
-    favicon: './assets/favicon.png'
-  }
+  plugins: [
+    [
+      'expo-image-picker',
+      {
+        photosPermission: 'Allow NomadMania.com access to your photo library to upload photos.',
+        cameraPermission: 'Allow NomadMania.com access to your camera to upload photos directly.'
+      }
+    ]
+  ]
 });

BIN
assets/favicon.png


BIN
assets/icon.png


BIN
assets/notification-icon.png


BIN
assets/splash.png


+ 28 - 0
eas.json

@@ -0,0 +1,28 @@
+{
+  "cli": {
+    "version": ">= 5.6.0"
+  },
+  "build": {
+    "development": {
+      "developmentClient": true,
+      "distribution": "internal",
+      "channel": "development",
+      "env": {
+        "ENV": "development"
+      }
+    },
+    "production": {
+      "channel": "production",
+      "autoIncrement": true,
+      "android": {
+        "buildType": "app-bundle"
+      },
+      "env": {
+        "ENV": "production"
+      }
+    }
+  },
+  "submit": {
+    "production": {}
+  }
+}

+ 12 - 5
package.json

@@ -3,15 +3,17 @@
   "version": "1.0.0",
   "main": "node_modules/expo/AppEntry.js",
   "scripts": {
-    "start": "expo start",
+    "start": "expo start --dev-client",
     "android": "expo start --android",
     "ios": "expo start --ios",
-    "web": "expo start --web",
-    "postinstall": "patch-package"
+    "build:dev": "eas build --profile development",
+    "build:prod": "ENV=production eas build --platform all --profile production",
+    "publish:prod": "ENV=production eas update --branch production"
   },
   "dependencies": {
     "@react-native-async-storage/async-storage": "1.18.2",
     "@react-native-community/datetimepicker": "7.2.0",
+    "@react-native-community/masked-view": "^0.1.11",
     "@react-native-community/netinfo": "9.3.10",
     "@react-navigation/bottom-tabs": "^6.5.11",
     "@react-navigation/material-top-tabs": "^6.6.5",
@@ -24,11 +26,14 @@
     "dotenv": "^16.3.1",
     "expo": "~49.0.15",
     "expo-checkbox": "~2.4.0",
+    "expo-dev-client": "~2.4.12",
+    "expo-image": "~1.3.5",
     "expo-image-picker": "~14.3.2",
     "expo-location": "~16.1.0",
     "expo-splash-screen": "~0.20.5",
     "expo-sqlite": "~11.3.3",
     "expo-status-bar": "~1.6.0",
+    "expo-updates": "~0.18.19",
     "formik": "^2.4.5",
     "moment": "^2.29.4",
     "patch-package": "^8.0.0",
@@ -36,16 +41,18 @@
     "react": "18.2.0",
     "react-native": "0.72.6",
     "react-native-calendar-picker": "^7.1.4",
+    "react-native-gesture-handler": "~2.12.0",
     "react-native-keyboard-aware-scroll-view": "^0.9.5",
     "react-native-maps": "1.7.1",
     "react-native-pager-view": "6.2.0",
+    "react-native-reanimated": "~3.3.0",
+    "react-native-render-html": "^6.3.4",
     "react-native-safe-area-context": "4.6.3",
     "react-native-screens": "~3.22.0",
     "react-native-svg": "13.9.0",
     "react-native-tab-view": "^3.5.2",
     "yup": "^1.3.3",
-    "zustand": "^4.4.7",
-    "expo-image": "~1.3.5"
+    "zustand": "^4.4.7"
   },
   "devDependencies": {
     "@babel/core": "^7.20.0",

+ 2 - 2
src/screens/InAppScreens/ProfileScreen/Profile/edit-personal-info.tsx

@@ -48,13 +48,13 @@ const ProfileSchema = yup.object({
 });
 
 export const EditPersonalInfo = () => {
-  const [token, setToken] = useState<string | null>('');
+  const [token, setToken] = useState<string>('');
 
   const { mutate: updateProfile, data: updateResponse, reset } = usePostSetProfileMutation();
 
   useEffect(() => {
     async function getToken() {
-      setToken(await storageGet('token'));
+      setToken((await storageGet('token')) as unknown as string);
     }
     reset();