react-native-template-obytes icon indicating copy to clipboard operation
react-native-template-obytes copied to clipboard

Reloading expo app throws Error: Failed to create a new MMKV instance: react-native-mmkv 3.x.x requires TurboModules

Open MOHAMED-LAAGUILI opened this issue 2 months ago • 1 comments

I’m encountering this error when reloading an Expo Prebuild React Native 20.0.2 app that uses [email protected]. Even though the New Architecture is explicitly enabled in my project, MMKV initialization fails at runtime, specifically on app reload.

Image

app.config.json

`` import type { ConfigContext, ExpoConfig } from '@expo/config'; import type { AppIconBadgeConfig } from 'app-icon-badge/types';

import { ClientEnv, Env } from './env';

const appIconBadgeConfig: AppIconBadgeConfig = { enabled: Env.APP_ENV !== 'production', badges: [ { text: Env.APP_ENV, type: 'banner', color: 'white', }, { text: Env.VERSION.toString(), type: 'ribbon', color: 'white', }, ], };

export default ({ config }: ConfigContext): ExpoConfig => ({ ...config, name: Env.NAME, description: ${Env.NAME} Mobile App, owner: Env.EXPO_ACCOUNT_OWNER, scheme: Env.SCHEME, slug: Env.SLUG, version: Env.VERSION.toString(), orientation: 'portrait', icon: './assets/icon-new.png', userInterfaceStyle: 'automatic', newArchEnabled: true, experiments: { typedRoutes: true, turboModules: true, }, updates: { fallbackToCacheTimeout: 0, }, assetBundlePatterns: ['**/*'], ios: { supportsTablet: true, bundleIdentifier: Env.BUNDLE_ID, infoPlist: { ITSAppUsesNonExemptEncryption: false, }, }, android: { adaptiveIcon: { foregroundImage: './assets/adaptive-icon-new.png', backgroundColor: '#FFFFFF', }, package: Env.PACKAGE, }, web: { favicon: './assets/favicon-new.png', bundler: 'metro', }, plugins: [ [ "expo-build-properties", { android: { newArchEnabled: true }, ios: { newArchEnabled: true } } ], [ 'expo-splash-screen', { backgroundColor: '#FFFFFF', image: './assets/splash-icon-new.png', imageWidth: 150, }, ], [ 'expo-font', { fonts: ['./assets/fonts/Inter.ttf'], }, ], 'expo-localization', 'expo-router', ['app-icon-badge', appIconBadgeConfig], ['react-native-edge-to-edge'], ], extra: { ...ClientEnv, eas: { projectId: Env.EAS_PROJECT_ID, }, },

}); ``

package.json

`` { "name": "timetracker", "version": "1.0.0", "private": true, "packageManager": "[email protected]", "main": "expo-router/entry", "scripts": { "start": "cross-env EXPO_NO_DOTENV=1 expo start", "prebuild": "cross-env EXPO_NO_DOTENV=1 pnpm expo prebuild", "android": "cross-env EXPO_NO_DOTENV=1 expo run:android", "ios": "cross-env EXPO_NO_DOTENV=1 expo run:ios", "web": "cross-env EXPO_NO_DOTENV=1 expo start --web", "xcode": "xed -b ios", "doctor": "npx expo-doctor@latest", "preinstall": "npx only-allow pnpm", "start:staging": "cross-env APP_ENV=staging pnpm run start", "prebuild:staging": "cross-env APP_ENV=staging pnpm run prebuild", "prebuild:development": "cross-env APP_ENV=development pnpm run prebuild", "android:staging": "cross-env APP_ENV=staging pnpm run android", "ios:staging": "cross-env APP_ENV=staging pnpm run ios", "start:production": "cross-env APP_ENV=production pnpm run start", "prebuild:production": "cross-env APP_ENV=production pnpm run prebuild", "android:production": "cross-env APP_ENV=production pnpm run android", "ios:production": "cross-env APP_ENV=production pnpm run ios", "build:development:ios": "cross-env APP_ENV=development EXPO_NO_DOTENV=1 eas build --profile development --platform ios", "build:development:android": "cross-env APP_ENV=development EXPO_NO_DOTENV=1 eas build --profile development --platform android--clear-cache", "build:staging:ios": "cross-env APP_ENV=staging EXPO_NO_DOTENV=1 eas build --profile staging --platform ios", "build:staging:android": "cross-env APP_ENV=staging EXPO_NO_DOTENV=1 eas build --profile staging --platform android ", "build:production:ios": "cross-env APP_ENV=production EXPO_NO_DOTENV=1 eas build --profile production --platform ios", "build:production:android": "cross-env APP_ENV=production EXPO_NO_DOTENV=1 eas build --profile production --platform android --clear-cache", "prepare": "husky", "app-release": "cross-env SKIP_BRANCH_PROTECTION=true np --no-publish --no-cleanup --no-release-draft", "version": "pnpm run prebuild && git add .", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "type-check": "tsc --noemit", "lint:translations": "eslint ./src/translations/ --fix --ext .json ", "test": "jest", "check-all": "pnpm run lint && pnpm run type-check && pnpm run lint:translations && pnpm run test", "test:ci": "pnpm run test --coverage", "test:watch": "pnpm run test --watch", "install-maestro": "curl -Ls 'https://get.maestro.mobile.dev/' | bash", "e2e-test": "maestro test .maestro/ -e APP_ID=com.obytes.development" }, "browser": { "better-sqlite3": false, "@nozbe/watermelondb/adapters/sqlite": false }, "lint-staged": { "package.json": [ "pnpm install --lockfile-only", "git add pnpm-lock.yaml" ], "pnpm-lock.yaml": [ "git add pnpm-lock.yaml" ] }, "dependencies": { "@expo/metro-runtime": "^5.0.4", "@expo/next-adapter": "^6.0.0", "@gorhom/bottom-sheet": "^5.0.5", "@hookform/resolvers": "^3.9.0", "@nozbe/watermelondb": "^0.28.0", "@react-native-async-storage/async-storage": "2.1.2", "@react-native-community/netinfo": "11.4.1", "@react-navigation/drawer": "^7.3.9", "@react-navigation/native": "^7.1.6", "@shopify/flash-list": "1.7.6", "@shopify/react-native-skia": "2.0.0-next.4", "@tanstack/react-query": "^5.85.5", "@tanstack/react-table": "^8.21.3", "@wuba/react-native-echarts": "1.1.1-alpha.1", "app-icon-badge": "^0.1.2", "axios": "^1.7.5", "better-sqlite3": "^12.2.0", "clsx": "^2.1.1", "expo": "53.0.23", "expo-build-properties": "^1.0.9", "expo-constants": "~17.1.6", "expo-crypto": "^14.1.5", "expo-dev-client": "~5.2.4", "expo-font": "~13.3.1", "expo-image": "~2.4.0", "expo-linear-gradient": "~14.1.5", "expo-linking": "~7.1.7", "expo-localization": "~16.1.6", "expo-router": "~5.1.6", "expo-splash-screen": "~0.30.10", "expo-sqlite": "^15.2.14", "expo-status-bar": "~2.2.3", "expo-system-ui": "~5.0.11", "expo-updates": "^0.28.17", "i18next": "^23.14.0", "lodash.memoize": "^4.1.2", "lottie-react-native": "7.2.2", "lucide-react-native": "^0.541.0", "moti": "^0.29.0", "nativewind": "^4.1.23", "next": "^15.5.0", "react": "19.0.0", "react-dom": "19.0.0", "react-error-boundary": "^4.0.13", "react-hook-form": "^7.53.0", "react-i18next": "^15.0.1", "react-icons": "^5.5.0", "react-native": "0.79.5", "react-native-chart-kit": "^6.12.0", "react-native-datatable-component": "^2.1.14", "react-native-edge-to-edge": "1.6.0", "react-native-flash-message": "^0.4.2", "react-native-gesture-handler": "~2.24.0", "react-native-gifted-charts": "^1.4.64", "react-native-keyboard-controller": "^1.17.4", "react-native-mmkv": "^3.3.3", "react-native-paper": "^5.14.5", "react-native-reanimated": "~3.17.5", "react-native-reanimated-table": "^0.0.2", "react-native-restart": "0.0.27", "react-native-safe-area-context": "5.4.0", "react-native-screens": "~4.11.1", "react-native-svg": "15.11.2", "react-native-table-component": "^1.2.2", "react-native-tableview-simple": "^4.4.1", "react-native-url-polyfill": "^2.0.0", "react-native-web": "~0.20.0", "react-query": "^3.39.3", "react-query-kit": "^3.3.0", "tailwind-rn": "^4.2.0", "tailwind-variants": "^0.2.1", "uuid": "^13.0.0", "zod": "^3.23.8", "zustand": "^5.0.5" }, "devDependencies": { "@babel/core": "^7.26.0", "@babel/helper-validator-identifier": "^7.27.1", "@commitlint/cli": "^19.2.2", "@commitlint/config-conventional": "^19.2.2", "@dev-plugins/react-query": "^0.0.7", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.28.0", "@expo/config": "~11.0.10", "@react-native-community/cli": "^20.0.2", "@testing-library/jest-dom": "^6.5.0", "@testing-library/react-native": "^12.7.2", "@types/i18n-js": "^3.8.9", "@types/invariant": "^2.2.37", "@types/jest": "^29.5.12", "@types/lodash.memoize": "^4.1.9", "@types/react": "~19.0.14", "@typescript-eslint/eslint-plugin": "^8.34.0", "@typescript-eslint/parser": "^8.34.0", "babel-plugin-module-resolver": "^5.0.2", "cross-env": "^7.0.3", "dotenv": "^16.4.5", "eslint": "^9.28.0", "eslint-config-expo": "^9.2.0", "eslint-config-prettier": "^10.1.5", "eslint-import-resolver-typescript": "^4.4.3", "eslint-plugin-i18n-json": "^4.0.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.4.1", "eslint-plugin-react-compiler": "19.1.0-rc.2", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-tailwindcss": "^3.18.0", "eslint-plugin-testing-library": "^7.5.2", "eslint-plugin-unicorn": "^59.0.1", "eslint-plugin-unused-imports": "^4.1.4", "husky": "^9.1.5", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jest-expo": "~53.0.10", "jest-junit": "^16.0.0", "lint-staged": "^15.2.9", "np": "^10.0.7", "prettier": "^3.3.3", "tailwindcss": "3.4.4", "ts-jest": "^29.1.2", "typescript": "~5.8.3", "typescript-eslint": "^8.34.0" }, "repository": { "type": "git", "url": "git+https://github.com/user/repo-name.git" }, "expo": { "doctor": { "reactNativeDirectoryCheck": { "listUnknownPackages": false, "exclude": [ "react-native-restart", "@nozbe/watermelondb", "react-native-chart-kit", "react-native-table-component" ] } }, "install": { "exclude": [ "eslint-config-expo" ] } }, "osMetadata": { "initVersion": "8.0.0" } }

``

MOHAMED-LAAGUILI avatar Oct 13 '25 15:10 MOHAMED-LAAGUILI

@tlebeitsuk @ahmedouvic @flexbox @mo-mughrabi any update ?

MOHAMED-LAAGUILI avatar Oct 17 '25 14:10 MOHAMED-LAAGUILI

https://github.com/rootstrap/react-native-template

@MOHAMED-LAAGUILI Check out this fork.

beanu avatar Dec 18 '25 10:12 beanu