Skip to content

Commit 8c4ac22

Browse files
authored
fix: prevent Require cycles warning cherry-pick from main (#2474)
This is a #2410 cherry-pick from main. This PR aims to bring the fix to v3 as well. ## Description This PR fixes `require cycles` warning caused by importing from `react-native-screens` in a `react-native-screens` module by changing the imports to relative. Additionally it fixes an [issue](#2302) with react-compiler in expo projects. Fixes #2408 #2302. ## Checklist - [x] Ensured that CI passes
1 parent 880a5d7 commit 8c4ac22

15 files changed

+29
-30
lines changed

src/components/Screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Animated, View, Platform } from 'react-native';
55

66
import TransitionProgressContext from '../TransitionProgressContext';
77
import DelayedFreeze from './helpers/DelayedFreeze';
8-
import { ScreenProps } from 'react-native-screens';
8+
import { ScreenProps } from '../types';
99

1010
import {
1111
freezeEnabled,

src/components/Screen.web.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { ScreenProps } from 'react-native-screens';
3+
import { ScreenProps } from '../types';
44
import { Animated, View } from 'react-native';
55
import React from 'react';
66

src/components/ScreenContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Platform, View } from 'react-native';
44
import React from 'react';
5-
import { ScreenContainerProps } from 'react-native-screens';
5+
import { ScreenContainerProps } from '../types';
66
import { isNativePlatformSupported, screensEnabled } from '../core';
77

88
// Native components

src/components/ScreenStack.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use client';
22

33
import React from 'react';
4-
import { ScreenStackProps, freezeEnabled } from 'react-native-screens';
4+
import { ScreenStackProps } from '../types';
5+
import { freezeEnabled } from '../core';
56
import DelayedFreeze from './helpers/DelayedFreeze';
67

78
// Native components

src/components/ScreenStackHeaderConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
HeaderSubviewTypes,
66
ScreenStackHeaderConfigProps,
77
SearchBarProps,
8-
} from 'react-native-screens';
8+
} from '../types';
99
import { Image, ImageProps, StyleSheet, ViewProps } from 'react-native';
1010

1111
// Native components

src/components/ScreenStackHeaderConfig.web.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
HeaderSubviewTypes,
55
ScreenStackHeaderConfigProps,
66
SearchBarProps,
7-
} from 'react-native-screens';
7+
} from '../types';
88

99
export const ScreenStackHeaderBackButtonImage = (
1010
props: ImageProps,

src/components/SearchBar.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
'use client';
22

33
import React from 'react';
4-
import {
5-
isSearchBarAvailableForCurrentPlatform,
6-
SearchBarCommands,
7-
SearchBarProps,
8-
} from 'react-native-screens';
4+
import { SearchBarCommands, SearchBarProps } from '../types';
5+
import { isSearchBarAvailableForCurrentPlatform } from '../utils';
96
import { View } from 'react-native';
107

118
// Native components

src/gesture-handler/GestureDetectorProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { GHContext } from 'react-native-screens';
2+
import { GHContext } from '../native-stack/contexts/GHContext';
33
import ScreenGestureDetector from './ScreenGestureDetector';
44
import type { GestureProviderProps } from '../native-stack/types';
55

src/native-stack/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
ScreenStackHeaderConfigProps,
2424
SearchBarProps,
2525
SheetDetentTypes,
26-
} from 'react-native-screens';
26+
} from '../types';
2727

2828
export type NativeStackNavigationEventMap = {
2929
/**

src/native-stack/utils/getDefaultHeaderHeight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Platform } from 'react-native';
2-
import { StackPresentationTypes } from 'react-native-screens';
2+
import { StackPresentationTypes } from '../../types';
33
type Layout = { width: number; height: number };
44

55
const formSheetModalHeight = 56;

0 commit comments

Comments
 (0)