@sleeperhq/mini-core 1.8.5 → 1.8.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.
@@ -17,7 +17,7 @@
17
17
  "@react-navigation/native": "6.1.3",
18
18
  "@react-navigation/stack": "6.3.12",
19
19
  "@shopify/flash-list": "1.4.1",
20
- "@sleeperhq/mini-core": "1.8.5",
20
+ "@sleeperhq/mini-core": "1.8.6",
21
21
  "amazon-cognito-identity-js": "6.3.2",
22
22
  "crypto-js": "3.3.0",
23
23
  "decimal.js-light": "2.5.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleeperhq/mini-core",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "Core library frameworks for developing Sleeper Mini Apps.",
5
5
  "main": "index.ts",
6
6
  "types": "index.d.ts",
@@ -1,7 +1,7 @@
1
1
  import React, {useEffect, useRef, useState} from 'react';
2
- import {Platform} from 'react-native';
2
+ import {Platform, NativeModules} from 'react-native';
3
3
  import {Config, SocketMessage} from '../types';
4
- import { ScriptLocatorResolver, ScriptManager, Federated } from '@callstack/repack/client';
4
+ import { ScriptLocatorResolver, ScriptManager } from '@callstack/repack/client';
5
5
  import NetInfo, { NetInfoState } from '@react-native-community/netinfo';
6
6
  import TcpSocket from 'react-native-tcp-socket';
7
7
  import { fetchMainVersionMap, getMainUrl } from './url_resolver';
@@ -187,6 +187,10 @@ const DevServer = props => {
187
187
  // @ts-ignore
188
188
  const ipAddress = netInfoDetails?.ipAddress;
189
189
 
190
+ const scriptURL = NativeModules.SourceCode.scriptURL;
191
+ const address = scriptURL.split('://')[1].split('/')[0];
192
+ const packagerIP = address.split(':')[0];
193
+
190
194
  if (!netInfoDetails || !('ipAddress' in netInfoDetails)) {
191
195
  console.error('[Sleeper] Failed to determine local IP address.');
192
196
  return stopSocket();
@@ -200,7 +204,7 @@ const DevServer = props => {
200
204
  }, () => {
201
205
  // When we establish a connection, send some data to the server
202
206
  const message: SocketMessage = {
203
- _ip: ipAddress,
207
+ _ip: packagerIP,
204
208
  _name: config.name,
205
209
  _entitlements: config.entitlements,
206
210
  _headerOptions: config.headerOptions,