Expo App Stuck on Welcome Screen
Problem Statement
After upgrading to Expo SDK 51 or later, your app may unexpectedly get stuck on the "Welcome to Expo" screen during development, despite having existing application files in your project structure. This occurs even when:
- The
app
directory contains valid application files - The welcome screen text doesn't appear in your project code
- You've tried standard troubleshooting steps like restarting or cleaning builds
This frustrating issue prevents your actual app from loading during development.
Primary Solutions
Solution 1: Remove Conflicting Babel Configuration
The most common cause is conflicts with custom Babel plugins like react-native-dotenv
. Remove all environment-related Babel plugins:
npm uninstall react-native-dotenv babel-plugin-transform-inline-environment-variables
Then delete or simplify your babel.config.js
:
// Keep only this minimal configuration
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo']
};
};
Why this works
Expo SDK 51+ includes built-in environment variable handling and Babel configuration. Third-party plugins override Expo's defaults, causing the app to revert to the welcome screen.
Solution 2: Completely Remove Babel Config
For SDK 51+, completely removing babel.config.js
often resolves the issue:
rm babel.config.js
This allows Expo to manage Babel configuration automatically.
Final Steps for Both Solutions
After making changes, clear the cache and rebuild:
npx expo start --clear
# Alternative command:
# npx expo start -c
# Then rebuild for your platform
npx expo run:android
# or
npx expo run:ios
Using Environment Variables Correctly
Replace old approach
Expo SDK 51+ renders react-native-dotenv
obsolete
- Prefix all environment variables with
EXPO_PUBLIC_
in your.env
file:
EXPO_PUBLIC_API_KEY=your_key_here
EXPO_PUBLIC_API_URL=https://api.example.com
- Access variables directly in your code:
console.log(process.env.EXPO_PUBLIC_API_KEY);
Additional Troubleshooting Steps
If the issue persists:
- Verify all outdated packages are updated:
npx expo doctor
Ensure no Babel plugin references remain in
package.json
Check for warnings during build and resolve them
Why These Solutions Work
Expo SDK 51+ includes significant changes to environment handling and routing:
- Built-in support for
.env
files eliminates need for third-party packages - Custom Babel configs conflict with Expo Router's default settings
babel-preset-expo
is automatically included without additional config
As confirmed in the Expo SDK 51 changelog:
"react-native-dotenv is not compatible with expo-router... We recommend removing the library and Babel plugin"
Best Practices Going Forward
- Avoid custom Babel plugins unless absolutely necessary
- Follow Expo's environment variable documentation
- Regularly clear cache during upgrades (
npx expo start -c
) - Keep Expo SDK and dependencies updated