react-native-view-shot icon indicating copy to clipboard operation
react-native-view-shot copied to clipboard

NativeModules.RNViewShot is undefined

Open angleneo opened this issue 2 years ago β€’ 21 comments

so, how to react-native link react-native-view-shot ?

angleneo avatar Mar 18 '22 07:03 angleneo

Can you try again with 3.3.0 ? There were possible fixes for this. It should work like any other React Native library

gre avatar May 28 '22 11:05 gre

The error is still there.. Should we manually link the library? If so how to do it in 3.3.0?

buddhiv avatar Jun 01 '22 19:06 buddhiv

It all depends on your React Native set up, in latest bootstrap of a React Native project, there is nothing to do but to do a react-native link (as done in the example project)

see https://reactnative.dev/docs/linking-libraries-ios

gre avatar Jun 06 '22 09:06 gre

using react native 0.68.2 got the same error (NativeModules.RNViewShot is undefined) tried a lot of methods

  • wipeout Xcode DerivedData
  • manual linking
  • pod disintegrate setup and install
  • arch --x86_64 pod install
  • react native clean project

but in vain😭

πŸ‘‰ finally found a temporary workaround : changing project format to Xcode 11.4-compatible

everything just worked ! πŸ‘Œ

so regardless of the compatibility patch for Xcode 12 in version 3.3.0, I guess there should still be some compatibility issues with Xcode 12 in the current release. ( by the way I'm using apple silicon, maybe this only happens on apple silicon ? )

still an amazing package and a big thinks to all of the contributors !

ChenLiangZhen avatar Jun 12 '22 08:06 ChenLiangZhen

if this isn't single case, maybe there's a need to create an issue regarding the compatibility problem with Xcode 12 ? ( I know v3.3.0 introduced Xcode 12 compatibility patch but there still seems to be some problems going on. )

ChenLiangZhen avatar Jun 12 '22 09:06 ChenLiangZhen

generally speaking I think it's very hard to maintain software and libraries in multiple XCode versions, Apple tend to be very pushy in the need to get their stack up to date πŸ₯² I'm not sure what could specifically be related to this library.

gre avatar Jun 12 '22 10:06 gre

yeah they are so pushy and every time when a newer version of Apple product come out there's always a disaster for developers 😒 especially when it comes to compatibility.

It will be better if they choose to work on older version and make it stable until they release a newer version, or try to increase the interoperability between each versions πŸ€·β€β™‚οΈ

ChenLiangZhen avatar Jun 12 '22 12:06 ChenLiangZhen

Hi, I'm using React Native 0.59.10

I think the problem here is on MainAplication.java

When we do react-native link, somehow it only write import fr.greweb.reactnativeviewshot.RNViewShotPackage; But one more thing to do is to add this package

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          .... // your other package
          new RNViewShotPackage()
      );
    }

rukmanary avatar Jun 16 '22 06:06 rukmanary

Any update on this issue ?

yaminichhabra avatar Apr 04 '23 16:04 yaminichhabra

I recently encountered this issue. Any possible fix yet?

Makinde1034 avatar May 29 '23 19:05 Makinde1034

Same question here on android πŸ˜₯

eliasg52 avatar Jun 21 '23 20:06 eliasg52

I was able to fix this by creating a new development build after installing the package.

Makinde1034 avatar Jun 21 '23 20:06 Makinde1034

I was able to fix this by creating a new development build after installing the package.

Resetting the application cache also worked for me. thank you so much!

eliasg52 avatar Jun 21 '23 20:06 eliasg52

I am still facing the same issue on Android πŸ˜₯ Using react-native version 0.72.4 (Works with older versions) @eliasg52 how did you reset the application cache? I tried gradlew clean task and yarn restart cache.

tremblerz avatar Aug 14 '23 14:08 tremblerz

Likewise, I am using a dev client, rebuilding the app resolved it for me also.

sleekLancelot avatar Sep 13 '23 01:09 sleekLancelot

I already tried to remove the app and create a new build again, but after some period, the problem came back again..

ofir-hakshur avatar Mar 10 '24 12:03 ofir-hakshur