Migrating from Expo CLI to React Native CLI (New Architecture)
Why Migrate?
Expo managed workflow is great for getting started quickly, but as your app grows, you may need:
- Custom native modules
- Better control over native code
- Access to the new React Native architecture (Fabric + TurboModules)
Prerequisites
Before starting the migration, ensure you have:
1. Xcode 15+ installed
2. Android Studio with NDK configured
3. Node.js 18+
4. A backup of your current project
Step 1: Eject from Expo
```bash
npx expo prebuild
```
This generates the `ios/` and `android/` folders with native code.
Step 2: Enable New Architecture
#
iOS
In `ios/Podfile`, add:
```ruby
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
```
#
Android
In `android/gradle.properties`:
```properties
newArchEnabled=true
```
Step 3: Handle Native Module Migration
Most Expo modules work out of the box, but you may need to update some:
- `expo-camera` → Native iOS/Android permissions
- `expo-notifications` → Firebase Cloud Messaging setup
- `expo-file-system` → Direct RNFS integration
Common Pitfalls
1. **Build failures**: Clear derived data and rebuild
2. **Metro bundler issues**: Reset cache with `npx react-native start --reset-cache`
3. **Native linking**: Run `pod install` after any native dependency changes
Conclusion
Migration requires patience, but the benefits of the new architecture—better performance, improved memory management, and synchronous native calls—are worth the effort.