Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lodev09 opened this issue May 14, 2024 · 4 comments
Open
Assignees
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@lodev09
Copy link

lodev09 commented May 14, 2024

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!
@lodev09 lodev09 added the needs validation Issue needs to be validated label May 14, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 14, 2024
@nijk
Copy link

nijk commented May 14, 2024

I'm also seeing this

@killerchip
Copy link

I am also seeing this even when I use renderRouter

@alxjrvs
Copy link

alxjrvs commented May 21, 2024

Also seeing this!

@Echzio
Copy link

Echzio commented May 23, 2024

+also seeing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

7 participants