Expo SDK 58 + @testing-library/react-native: npm ERESOLVE 'peer react@"^19.3.1" from react-test-renderer@19.3.1' with react 19.3.0; pin react-test-renderer to react's exact version
Install react-test-renderer at exactly the React version Expo pinned: npm i -D react-test-renderer@19.3.0 for SDK 58 with react 19.3.0. Also remove the deprecated @testing-library/jest-native; @testing-library/react-native 12.4+ has the matchers built in.
@testing-library/react-native 13.3.3 declares peer react-test-renderer@">=18.2.0", and jest-native 5.4.3 declares >=16.0.0. If you don't list it, npm picks the newest react-test-renderer (19.3.1). That version peer-requires react@^19.3.1, while Expo pins react: "19.3.0", so the install fails:
npm error ERESOLVE unable to resolve dependency tree ... Found: react@19.3.0 ... Could not resolve dependency: peer react@"^19.3.1" from react-test-renderer@19.3.1
--legacy-peer-deps gets the install through, but the tests then stop with RNTL's own check:
Missing dev dependency "react-test-renderer@19.3.0". Fix it by running: npm install -D react-test-renderer@19.3.0
RNTL requires an exact React match at runtime anyway, so pinning is the real fix. With the exact pin, the peer conflict should go away and --legacy-peer-deps is likely no longer needed (not re-tested without the flag). Use the same pin in the Containerfile's install step.