Skip to content

[expo-image][jest] ExpoImage spitting console error on Expo 51 while testing #28831

Closed
@lodev09

Description

@lodev09

Minimal reproducible example

https://github.com/lodev09/expaw

What platform(s) does this occur on?

Jest

Did you reproduce this issue in a development build?

Yes

Summary

expo-image is spitting console.error during tests with jest after upgrading to Expo 51. Although tests pass, it's kinda annoying with all the red texts 🥲

yarn run v1.22.22
$ jest
  console.error
    Warning: Unexpected ref object provided for ExpoImage. Use either a ref-setter function or React.createRef().
        at NativeComponent (/Users/lodev09/Projects/github/expaw/node_modules/expo-modules-core/src/NativeViewManagerAdapter.native.tsx:79:25)
        at ExpoImage (/Users/lodev09/Projects/github/expaw/node_modules/expo-image/src/ExpoImage.tsx:30:17)
        at Image (/Users/lodev09/Projects/github/expaw/node_modules/expo-image/src/Image.tsx:15:20)
        at style (/Users/lodev09/Projects/github/expaw/src/components/PreviewImage.tsx:5:11)

       6 | describe('PreviewImage', () => {
       7 |   it('should render', () => {
    >  8 |     render(<PreviewImage source={{ uri: 'somefile.jpg' }} />)
         |           ^
       9 |     expect(screen.queryByRole('image'))
      10 |   })
      11 | })
...

To reproduce, checkout this repo

yarn && yarn test

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.19.1 - /opt/homebrew/bin/node
      Yarn: 1.22.22 - /opt/homebrew/bin/yarn
      npm: 10.2.4 - /opt/homebrew/bin/npm
      Watchman: 2024.03.25.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
    IDEs:
      Android Studio: 2023.2 AI-232.10300.40.2321.11668458
      Xcode: 15.3/15E204a - /usr/bin/xcodebuild
    npmPackages:
      expo: ^51.0.5 => 51.0.5 
      react: 18.2.0 => 18.2.0 
      react-native: 0.74.1 => 0.74.1 
    npmGlobalPackages:
      eas-cli: 9.0.3
    Expo Workflow: managed

Expo Doctor Diagnostics

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check native tooling versions
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

Metadata

Metadata

Assignees

Labels

needs reviewIssue is ready to be reviewed by a maintaineroutdated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions