Skip to content

Error back-icon@3x.png could not be found #1667

Closed

Description

@jalbertSyncroTech

Cross-reported to react-navigation
react-navigation/react-navigation#13023

Current behavior

I'm getting the following error from Metro v0.83.5 while running a development react-native build locally on my Pixel 9a, and the back arrow icon normally shown in the upper-left is not appearing:

Error: 'node_modules/@react-navigation/elements/lib/module/assets/back-icon@3x.png' could not be found, because it is not within the projectRoot or watchFolders, or it is blocked via the resolver.blockList config
    at getAsset (HeaderBackMissing\node_modules\metro\src\Assets.js:226:13)
    at Server._processSingleAssetRequest (HeaderBackMissing\node_modules\metro\src\Server.js:443:47)
    at async Server._processRequest (HeaderBackMissing\node_modules\metro\src\Server.js:550:7)

It works ok from a production release build for both Android and iOS, so I suspect this is related to Metro development only.

This started around 25-Feb-2026 after updating from react-native v0.84.0 to v.0.84.1 along with all of the react-navigation dependencies.

Our app uses @react-navigation/elements@2.9.10, however we specifically extract the <Header ...> portion of the <NativeStackView> component in order to customize the header.
https://github.com/react-navigation/react-navigation/blob/%40react-navigation/elements%402.9.10/packages/native-stack/src/views/NativeStackView.tsx#L116

I've included a reproduction Snack, however the issue is only visible if you use the included App.tsx and NativeStackHeader.tsx locally (possibly on this specific Android device), here's a screen capture:
https://snack.expo.dev/@jalbertsyncrotech/headerbackmissing?platform=android
Image

Expected behavior

The back icon should be shown in the upper left of a development build when using the @react-navigation/elements NativeStackView Header on a Pixel 9a.

Reproduction

https://snack.expo.dev/@jalbertsyncrotech/headerbackmissing?platform=android

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @react-navigation/native-stack
  • react-native-drawer-layout
  • react-native-tab-view

Environment

  • I've removed the packages that I don't use
package version
@react-navigation/elements 2.9.10
@react-navigation/native 7.1.33
@react-navigation/native-stack 7.14.4
react-native-screens 4.16.0
react-native-safe-area-context 5.6.0
react-native 0.84.1
node 22.22.0
yarn 1.22.22

Activity

  1. jalbertSyncroTech commented on Mar 9, 2026

    @jalbertSyncroTech
    Author

    Confirmed doesn't happen with the following packages.json w/metro 0.83.3

    {
      "name": "HeaderBackMissing",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "lint": "eslint .",
        "start": "react-native start",
        "test": "jest"
      },
      "dependencies": {
        "@react-navigation/elements": "2.9.5",
        "@react-navigation/native": "7.1.26",
        "@react-navigation/native-stack": "7.9.0",
        "react": "19.2.3",
        "react-native": "0.84.0",
        "react-native-safe-area-context": "5.6.2",
        "react-native-screens": "4.19.0"
      },
      "devDependencies": {
        "@babel/core": "^7.25.2",
        "@babel/preset-env": "^7.25.3",
        "@babel/runtime": "^7.25.0",
        "@react-native-community/cli": "20.1.1",
        "@react-native-community/cli-platform-android": "20.1.1",
        "@react-native-community/cli-platform-ios": "20.1.1",
        "@react-native/babel-preset": "0.84.0",
        "@react-native/eslint-config": "0.84.0",
        "@react-native/metro-config": "0.84.0",
        "@react-native/typescript-config": "0.84.0",
        "@types/jest": "^29.5.13",
        "@types/react": "^19.2.0",
        "@types/react-test-renderer": "^19.1.0",
        "eslint": "^8.19.0",
        "jest": "^29.6.3",
        "metro": "0.83.3",
        "metro-cache": "0.83.3",
        "metro-cache-key": "0.83.3",
        "metro-config": "0.83.3",
        "metro-core": "0.83.3",
        "metro-file-map": "0.83.3",
        "metro-minify-terser": "0.83.3",
        "metro-resolver": "0.83.3",
        "metro-runtime": "0.83.3",
        "metro-source-map": "0.83.3",
        "metro-symbolicate": "0.83.3",
        "metro-transform-plugins": "0.83.3",
        "metro-transform-worker": "0.83.3",
        "ob1": "0.83.3",
        "prettier": "2.8.8",
        "react-test-renderer": "19.2.3",
        "typescript": "^5.8.3"
      },
      "resolutions": {
        "metro": "0.83.3",
        "metro-cache": "0.83.3",
        "metro-cache-key": "0.83.3",
        "metro-config": "0.83.3",
        "metro-core": "0.83.3",
        "metro-file-map": "0.83.3",
        "metro-minify-terser": "0.83.3",
        "metro-resolver": "0.83.3",
        "metro-runtime": "0.83.3",
        "metro-source-map": "0.83.3",
        "metro-symbolicate": "0.83.3",
        "metro-transform-plugins": "0.83.3",
        "metro-transform-worker": "0.83.3",
        "ob1": "0.83.3"
      },
      "engines": {
        "node": ">= 22.22.0"
      },
      "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
    }
    
  2. jalbertSyncroTech commented on Mar 9, 2026

    @jalbertSyncroTech
    Author

    Seems like this might be an unintended side-effect of #1641, as that's the only change since 0.83.3 in the release notes indicating anything to do with Platform.OS.

    @react-navigation/elements intentionally only includes platform-specific files for this resource
    https://github.com/react-navigation/react-navigation/tree/%40react-navigation/elements%402.9.10/packages/elements/src/assets

    See the comment here
    react-navigation/react-navigation#13023 (comment)

  3. jalbertSyncroTech commented on Mar 9, 2026

    @jalbertSyncroTech
    Author

    There appears to be a more significant issue at play here:

    As a workaround I added the following "copyFiles" section to my packages.json utilizing the copy-files-from-to package:

    "copyFiles": [
        {
          "from": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@1x.ios.png",
          "to": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@1x.png"
        },
        {
          "from": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@2x.ios.png",
          "to": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@2x.png"
        },
        {
          "from": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@3x.ios.png",
          "to": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@3x.png"
        },
        {
          "from": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@4x.ios.png",
          "to": "node_modules/@react-navigation/elements/lib/module/assets/back-icon@4x.png"
        }
      ],
    

    Note that I'm copying the iOS assets, but at runtime it's correctly showing me the Android assets.

    So Metro is failing if the back-icon@3x.png file isn't present at all, but if it is it continues to check for the platform and correctly resolves back-icon@3x.android.png

  4. jesperjohansson commented on Mar 30, 2026

    @jesperjohansson

    It seems like this was caused by the changes in #1643.

    Temporary workaround using yarn patch or patch-package:

    diff --git a/src/Server.js b/src/Server.js
    index 38eea4307906fc87511e3566690239928fe074fd..051d11b907f19c4983671c001722369a4b1a18f4 100644
    --- a/src/Server.js
    +++ b/src/Server.js
    @@ -439,14 +439,12 @@ class Server {
           }),
         );
         try {
    -      const depGraph = await this._bundler.getBundler().getDependencyGraph();
           const data = await (0, _Assets.getAsset)(
             assetPath,
             this._config.projectRoot,
             this._config.watchFolders,
             urlObj.searchParams.get("platform"),
             this._config.resolver.assetExts,
    -        (filePath) => depGraph.doesFileExist(filePath),
           );
           if (process.env.REACT_NATIVE_ENABLE_ASSET_CACHING === true) {
             res.setHeader("Cache-Control", "max-age=31536000");
    
  5. christophby commented on Apr 8, 2026

    @christophby

    Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions