Reputation: 1038
How to fix this error in Expo v34.0.0?
Upvotes: 2
Views: 2942
Reputation: 1038
In Expo, you can no longer import directly from 'expo', so change from (the old way):
import { Constants } from 'expo'; // OLD WAY
to (the updated way):
import Constants from 'expo-constants'; // NEW WAY
Similarly, if you are using the following features, use this format:
import MapView from 'react-native-maps';
import * as Location from 'expo-location';
import * as Permissions from 'expo-permissions';
import { DeviceMotion } from 'expo-sensors';
Expo documentation is quite helpful.
If you are using the online Expo editor, you will be prompted to install the packages, so just click OK. Otherwise, run:
expo install expo-constants
Upvotes: 2
Reputation: 932
Expo separated a lot of their previously joined libraries and Constants
is one of them, to get the constants now, follow along:
expo-constants
by running this on your project directory:expo install expo-constants
import Constants from 'expo-constants';
const barHeight = Constants.statusBarHeight;
More on the new documentations for Expo SDK 34 can be found here.
Hope this Helps!
Upvotes: 1