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

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker' could not be found in v9.1.1 #702

Open
VishnuNCS opened this issue Feb 20, 2024 · 5 comments
Labels
addressed in premium version This issue has been addressed (implemented, fixed) in the package available to sponsors.

Comments

@VishnuNCS
Copy link

Bug report

Summary

When I run the app in android after upgrading to v9.1.1 and selected a document and sending to m backend. All seems works fine. But when I actually execute my test suite it throws error as below

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker' could not be found. Verify that a module by this name is registered in the native binary.

    2 | import { AccessibilityProps, Platform } from 'react-native';
    3 | import ReactNativeBlobUtil from 'react-native-blob-util';
> 4 | import DocumentPicker, {
      | ^
    5 |   DocumentPickerResponse,
    6 |   isInProgress,
    7 |   types,

Reproducible sample code

I have just used a snapshot for test case

const fileUpload = (
    <Provider store={store}>
      <NavigationContainer ref={navigationRef}>
        <FileUpload {...props} />
      </NavigationContainer>
    </Provider>
  );
 
  it('Match snapshot', () => {
    const fileUploadWithMedicalObject = render(fileUpload).toJSON();
 
    expect(fileUploadWithMedicalObject).toMatchSnapshot();
  });

Steps to reproduce

If you created a test case with v9.1.1 you should be able to reproduce this. Previously I was v8.1.3 didn't face any issues

Describe what you expected to happen:

  1. Even v9.1.1 should not fail with any error

Environment info

npx react-native info output:

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
    Memory: 8.19 GB / 15.69 GB
  Binaries:
    Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\node_modules\yarn\bin\yarn.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 31, 32, 33, 34
      Build Tools: 29.0.2, 30.0.2, 30.0.3, 32.0.0, 32.1.0, 33.0.2, 34.0.0
      System Images: android-30 | Google Play Intel x86 Atom, android-33 | Google APIs Intel x86_64 Atom
      Android NDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: AI-223.8836.35.2231.11090377
    Visual Studio: Not Found
  Languages:
    Java: 11.0.14
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^18.0.0 => 18.2.0
    react-native: 0.70.9 => 0.70.9
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

library version: 9.1.1

iOS / Android version: 17.2/13

@VishnuNCS VishnuNCS changed the title Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker' could not be found Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDocumentPicker' could not be found in v9.1.1 Feb 20, 2024
@code-jenn-or
Copy link

Same error and only when running test suite, document picker works as expected in both android and iOS otherwise.

@code-jenn-or
Copy link

@VishnuNCS I followed this comment which resolved my tests
#677 (comment)

@CMDevsInc
Copy link

same issue, when I just start the app

@SandaruCooray
Copy link

SandaruCooray commented Feb 29, 2024

I got the same issue by linking the library and restart the metro with reset cache solve the issue

  1. first do this npx react-native-asset react-native-document-picker
  2. if you get an error saying react-natiuve.config.js not found create a new file with that name in the root folder and add this
    module.Exports = { project: {ios: {},android: {},},assets: ['./src/assets/fonts/'], // path of your assert file};
    then try the first one again
  3. then npm start -- --reset-cache that's it :)

@vonovak
Copy link
Collaborator

vonovak commented Mar 23, 2024

Hello!
The new module now comes with jest mocks, see the docs here.

thank you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in premium version This issue has been addressed (implemented, fixed) in the package available to sponsors.
Projects
None yet
Development

No branches or pull requests

5 participants