@nextsparkjs/mobile 0.1.0-beta.82 → 0.1.0-beta.84

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": "@nextsparkjs/mobile",
3
- "version": "0.1.0-beta.82",
3
+ "version": "0.1.0-beta.84",
4
4
  "description": "Mobile app infrastructure for NextSpark - API client, providers, and utilities for Expo apps",
5
5
  "license": "MIT",
6
6
  "author": "NextSpark <hello@nextspark.dev>",
Binary file
Binary file
Binary file
@@ -1,14 +1,25 @@
1
1
  /**
2
2
  * API Configuration
3
+ *
4
+ * Resolution order:
5
+ * 1. EXPO_PUBLIC_API_URL env variable (set in .env or EAS)
6
+ * 2. Auto-detect from Expo dev server host IP + default web port
7
+ * This uses the same network IP that Expo uses, so it works
8
+ * on both iOS Simulator and Android Emulator.
9
+ * 3. Fallback to localhost:3000 (standard Next.js default)
3
10
  */
4
11
 
12
+ import { Platform } from 'react-native'
5
13
  import Constants from 'expo-constants'
6
14
 
15
+ /** Default port for the NextSpark web app (Next.js default) */
16
+ const DEFAULT_WEB_PORT = 3000
17
+
7
18
  const API_URL =
8
19
  Constants.expoConfig?.extra?.apiUrl ||
9
20
  (Constants.expoConfig?.hostUri
10
- ? `http://${Constants.expoConfig.hostUri.split(':')[0]}:5173`
11
- : 'http://localhost:5173')
21
+ ? `http://${Constants.expoConfig.hostUri.split(':')[0]}:${DEFAULT_WEB_PORT}`
22
+ : `http://${Platform.OS === 'android' ? '10.0.2.2' : 'localhost'}:${DEFAULT_WEB_PORT}`)
12
23
 
13
24
  export const API_CONFIG = {
14
25
  baseUrl: API_URL,