expo-dev-launcher 2.4.10 → 2.4.11

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.
@@ -10,7 +10,7 @@ const baseAddress = Platform.select({
10
10
  });
11
11
 
12
12
  const statusPage = 'status';
13
- const portsToCheck = [8081, 8082, 19000, 19001, 19002, 19003, 19004, 19005];
13
+ const portsToCheck = [8081, 8082, 8083, 8084, 8085, 19000, 19001, 19002];
14
14
 
15
15
  export async function getDevSessionsAsync({
16
16
  isAuthenticated = false,
@@ -1,3 +1,4 @@
1
+ import { useFocusEffect } from '@react-navigation/core';
1
2
  import {
2
3
  Heading,
3
4
  Text,
@@ -37,18 +38,12 @@ import { useUpdatesConfig } from '../providers/UpdatesConfigProvider';
37
38
  import { DevSession } from '../types';
38
39
 
39
40
  export type HomeScreenProps = {
40
- fetchOnMount?: boolean;
41
41
  pollInterval?: number;
42
42
  pollAmount?: number;
43
43
  navigation?: any;
44
44
  };
45
45
 
46
- export function HomeScreen({
47
- fetchOnMount = false,
48
- pollInterval = 1000,
49
- pollAmount = 5,
50
- navigation,
51
- }: HomeScreenProps) {
46
+ export function HomeScreen({ pollInterval = 1000, pollAmount = 5, navigation }: HomeScreenProps) {
52
47
  const modalStack = useModalStack();
53
48
  const [inputValue, setInputValue] = React.useState('');
54
49
  const [loadingUrl, setLoadingUrl] = React.useState('');
@@ -59,13 +54,14 @@ export function HomeScreen({
59
54
 
60
55
  const crashReport = useCrashReport();
61
56
 
62
- const initialDevSessionData = React.useRef(devSessions);
63
-
64
- React.useEffect(() => {
65
- if (initialDevSessionData.current.length === 0 && fetchOnMount) {
66
- pollAsync({ pollAmount, pollInterval });
67
- }
68
- }, [fetchOnMount, pollInterval, pollAmount, pollAsync]);
57
+ const hasDevSessions = devSessions?.length > 0;
58
+ useFocusEffect(
59
+ React.useCallback(() => {
60
+ if (!hasDevSessions) {
61
+ pollAsync({ pollAmount, pollInterval });
62
+ }
63
+ }, [hasDevSessions, pollAmount, pollInterval])
64
+ );
69
65
 
70
66
  const onLoadUrl = async (url: string) => {
71
67
  setLoadingUrl(url);
@@ -141,7 +137,7 @@ export function HomeScreen({
141
137
 
142
138
  <Spacer.Horizontal />
143
139
 
144
- {devSessions.length > 0 && (
140
+ {devSessions?.length > 0 && (
145
141
  <Button.FadeOnPressContainer
146
142
  bg="ghost"
147
143
  rounded="full"
@@ -157,7 +153,7 @@ export function HomeScreen({
157
153
 
158
154
  <View px="medium">
159
155
  <View>
160
- {devSessions.length === 0 && (
156
+ {devSessions?.length === 0 && (
161
157
  <>
162
158
  <View padding="medium" bg="default" roundedTop="large">
163
159
  <Text>Start a local development server with:</Text>