diff --git a/example/src/index.tsx b/example/src/index.tsx
index fb0ad130..84265cc4 100644
--- a/example/src/index.tsx
+++ b/example/src/index.tsx
@@ -7,7 +7,11 @@ import {
StatusBar,
I18nManager,
} from 'react-native';
+// eslint-disable-next-line import/no-unresolved
+import { enableScreens } from 'react-native-screens';
import RNRestart from 'react-native-restart';
+import { Updates } from 'expo';
+import { Asset } from 'expo-asset';
import { MaterialIcons } from '@expo/vector-icons';
import {
Provider as PaperProvider,
@@ -17,7 +21,6 @@ import {
List,
Divider,
} from 'react-native-paper';
-import { Asset } from 'expo-asset';
import {
InitialState,
useLinking,
@@ -49,10 +52,11 @@ import DynamicTabs from './Screens/DynamicTabs';
import AuthFlow from './Screens/AuthFlow';
import CompatAPI from './Screens/CompatAPI';
import SettingsItem from './Shared/SettingsItem';
-import { Updates } from 'expo';
YellowBox.ignoreWarnings(['Require cycle:', 'Warning: Async Storage']);
+enableScreens();
+
type RootDrawerParamList = {
Root: undefined;
Another: undefined;
diff --git a/packages/stack/src/views/Stack/CardStack.tsx b/packages/stack/src/views/Stack/CardStack.tsx
index 21c3bcc9..c89eb7aa 100755
--- a/packages/stack/src/views/Stack/CardStack.tsx
+++ b/packages/stack/src/views/Stack/CardStack.tsx
@@ -37,14 +37,6 @@ type GestureValues = {
[key: string]: Animated.Value;
};
-// @ts-ignore
-const maybeExpoVersion = global.Expo?.Constants.manifest.sdkVersion.split(
- '.'
-)[0];
-const isInsufficientExpoVersion = maybeExpoVersion
- ? Number(maybeExpoVersion) <= 36
- : maybeExpoVersion === 'UNVERSIONED';
-
type Props = {
mode: StackCardMode;
insets: EdgeInsets;
@@ -82,37 +74,27 @@ type State = {
};
const EPSILON = 0.01;
-const FAR_FAR_AWAY = 9000;
const dimensions = Dimensions.get('window');
const layout = { width: dimensions.width, height: dimensions.height };
const MaybeScreenContainer = ({
enabled,
- style,
...rest
}: ViewProps & {
enabled: boolean;
children: React.ReactNode;
}) => {
if (enabled && screensEnabled()) {
- return ;
+ return ;
}
- return (
-
- );
+ return ;
};
const MaybeScreen = ({
enabled,
active,
- style,
...rest
}: ViewProps & {
enabled: boolean;
@@ -121,39 +103,10 @@ const MaybeScreen = ({
}) => {
if (enabled && screensEnabled()) {
// @ts-ignore
- return ;
+ return ;
}
- return (
-
- );
+ return ;
};
const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });
@@ -450,9 +403,7 @@ export default class CardStack extends React.Component {
// Screens is buggy on iOS, so we don't enable it there
// For modals, usually we want the screen underneath to be visible, so also disable it there
- const isScreensEnabled =
- Platform.OS !== 'ios' &&
- (isInsufficientExpoVersion ? mode !== 'modal' : true);
+ const isScreensEnabled = Platform.OS !== 'ios' && mode !== 'modal';
return (
@@ -466,26 +417,13 @@ export default class CardStack extends React.Component {
const gesture = gestures[route.key];
const scene = scenes[index];
- // Display current screen and a screen beneath.
- let isScreenActive: Animated.AnimatedInterpolation | 0 | 1 =
- index >= self.length - 2 ? 1 : 0;
-
- if (isInsufficientExpoVersion) {
- isScreenActive =
- index === self.length - 1
- ? 1
- : Platform.OS === 'android'
- ? scene.progress.next
- ? scene.progress.next.interpolate({
- inputRange: [0, 1 - EPSILON, 1],
- outputRange: [1, 1, 0],
- extrapolate: 'clamp',
- })
- : 1
- : index === self.length - 2
- ? 1
- : 0;
- }
+ const isScreenActive = scene.progress.next
+ ? scene.progress.next.interpolate({
+ inputRange: [0, 1 - EPSILON, 1],
+ outputRange: [1, 1, 0],
+ extrapolate: 'clamp',
+ })
+ : 1;
const {
safeAreaInsets,