Skip to content

fix(android): resolve crash due to null promise rejection code#336

Merged
plrthink merged 1 commit intomockingbot:masterfrom
pSapien:fix_non_null_error
Apr 12, 2026
Merged

fix(android): resolve crash due to null promise rejection code#336
plrthink merged 1 commit intomockingbot:masterfrom
pSapien:fix_non_null_error

Conversation

@pSapien
Copy link
Copy Markdown
Contributor

@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"
}

@wooller
Copy link
Copy Markdown

wooller commented Feb 24, 2026

We had the same issue and can confirm this change fixes the issue. It looks like quite a small change, would be great to get into a release some time soon @plrthink if you have time to review? ❤️

@duysolo
Copy link
Copy Markdown

duysolo commented Apr 3, 2026

https://www.npmjs.com/package/rn-zip-archive-v2

Please this package instead. I fixed the issue

@plrthink plrthink merged commit ea67eb0 into mockingbot:master Apr 12, 2026
@plrthink
Copy link
Copy Markdown
Collaborator

Hi @pSapien,

Sorry for the late response!

Your fix has been included in the just published v7.1.0 release. Thanks again for your contribution!

You can now update with:

npm install react-native-zip-archive@7.1.0

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

4 participants