Skip to content

Conversation

@pSapien
Copy link

@pSapien pSapien commented Dec 31, 2025

This PR replaces all instances of

Before:

promise.reject(null, ...)

After:

promise.reject("RNZipArchiveError", ...)

Context

In newer versions of React Native passing null as the rejection code throws a fatal NullPointerException, crashing the app

Tested with

  • React Native 0.81.5

Related issue

Fixes #335


🚨 Immediate Workaround (Patch-Package)

If you cannot wait for the PR to be merged, do the following

  1. Install patch-package as a dev dependency in your react-native project
yarn add --dev patch-package
  1. Open node_modules/react-native-zip-archive/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java
  2. Copy the change from this PR onto the file
  3. Run the patch command which should create a file in patches/react-native-zip-archive+x.x.x.patch
npx patch-package react-native-zip-archive
  1. Add "postinstall": "patch-package" to your package.json scripts to ensure that the fix applies after installation of node_modules
"scripts": {
  "postinstall": "patch-package"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

java.lang.NullPointerException: Parameter specified as non-null is null: method com.facebook.react.bridge.PromiseImpl.reject, parameter code

1 participant