App crashing in only release mode when invoking onLongPress event – Android

I added support for Android 14 to my app, but after that, the app crashed when invoking the onLongPress event with TouchableOpacity in release mode. The app is not crashing in debug mode.

On digging the crash with the logcat, the app was crashing with the error: Invalid Hook Call

  1. You might have mismatched versions of React and React DOM.
  2. You might be breaking the Rules of Hooks.
  3. You might have more than one copy of React in the same app.

I tried everything but no luck the error is still on it, please help

Stack Trace:

12-09 13:33:32.684 22511 22571 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
12-09 13:33:32.684 22511 22571 E AndroidRuntime: Process: com.autoscan.appv9, PID: 22511
12-09 13:33:32.684 22511 22571 E AndroidRuntime: com.facebook.react.common.JavascriptException: Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
12-09 13:33:32.684 22511 22571 E AndroidRuntime: 1. You might have mismatching versions of React and the renderer (such as React DOM)
12-09 13:33:32.684 22511 22571 E AndroidRuntime: 2. You might be breaking the Rules of Hooks
12-09 13:33:32.684 22511 22571 E AndroidRuntime: 3. You might have more than one copy of React in the same app
12-09 13:33:32.684 22511 22571 E AndroidRuntime: See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem., stack:
12-09 13:33:32.684 22511 22571 E AndroidRuntime: Ur@91:41069
12-09 13:33:32.684 22511 22571 E AndroidRuntime: <unknown>@424:1218
12-09 13:33:32.684 22511 22571 E AndroidRuntime: onLongPress@915:3684
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@212:7309
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@212:6947
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@212:9161
12-09 13:33:32.684 22511 22571 E AndroidRuntime: <unknown>@212:5059
12-09 13:33:32.684 22511 22571 E AndroidRuntime: k@117:535
12-09 13:33:32.684 22511 22571 E AndroidRuntime: callTimers@117:2632
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@42:3492
12-09 13:33:32.684 22511 22571 E AndroidRuntime: <unknown>@42:747
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@42:2538
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@42:719
12-09 13:33:32.684 22511 22571 E AndroidRuntime: value@-1
12-09 13:33:32.684 22511 22571 E AndroidRuntime: 
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:83)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:958)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:230)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:319)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
12-09 13:33:32.684 22511 22571 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:1012)
12-09 13:33:32.713  2389 23067 W ActivityManager: crash : com.autoscan.appv9,10331
12-09 13:33:32.715  2389  3097 W ActivityTaskManager:   Force finishing activity com.autoscan.appv9/.MainActivity

Package.json

{
  "name": "ApexScan",
  "version": "0.1.1",
  "private": true,
  "scripts": {
    "start": "NODE_OPTIONS=--openssl-legacy-provider react-native start",
    "start-cache": "react-native start --reset-cache",
    "pod": "cd ios && pod install && cd ..",
    "adb": "adb reverse tcp:8081 tcp:8081",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "startiPhone11": "npx react-native run-ios --udid 502CA678-5086-448F-B62B-8F56473E903E",
    "startiPad11": "npx react-native run-ios --udid AB365004-86C5-4B5D-84DB-17EE5A4412BB",
    "startiPhoneSE": "npx react-native run-ios --udid 7457F48E-DCE8-43C7-895C-C475B8AA7A84",
    "ios-xed": "xed -b ios",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "createCleanReleaseAPK": "cd android && ./gradlew assembleRelease && cd .. && open ./android/app/build/outputs/apk/release",
    "createCleanBundle": "cd android && ./gradlew clean && ./gradlew bundleRelease && cd .. && open ./android/app/build/outputs/bundle/release"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "1.15.5",
    "@react-native-community/checkbox": "^0.5.8",
    "@react-native-firebase/app": "^12.9.1",
    "@react-native-firebase/auth": "^13.1.0",
    "@react-native-google-signin/google-signin": "^7.0.1",
    "@react-navigation/bottom-tabs": "5.11.11",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/native-stack": "6.1.0",
    "@react-navigation/stack": "5.14.5",
    "@reduxjs/toolkit": "1.6.1",
    "@stripe/stripe-react-native": "^0.35.1",
    "@types/styled-components": "5.1.11",
    "@types/styled-components-react-native": "5.1.1",
    "axios": "0.21.1",
    "fast-xml-parser": "^3.20.3",
    "geolib": "^3.3.1",
    "lodash": "4.17.21",
    "lottie-ios": "^3.2.3",
    "lottie-react-native": "^4.1.3",
    "moment": "2.29.1",
    "react": "17.0.1",
    "react-native": "0.66.0",
    "react-native-barcode-mask": "^1.2.4",
    "react-native-camera": "^4.2.1",
    "react-native-currency-input": "^1.0.1",
    "react-native-date-picker": "4.2.0",
    "react-native-dropdown-picker": "5.1.23",
    "react-native-error-boundary": "1.1.11",
    "react-native-gesture-handler": "1.10.3",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-keyboard-aware-scroll-view": "0.9.4",
    "react-native-linear-gradient": "2.5.6",
    "react-native-logs": "^5.0.1",
    "react-native-modal": "12.0.3",
    "react-native-onesignal": "^4.5.3",
    "react-native-print": "^0.11.0",
    "react-native-rename": "^2.9.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.4.0",
    "react-native-share": "^7.2.0",
    "react-native-size-matters": "^0.4.2",
    "react-native-smtp-mailer": "^1.2.5",
    "react-native-splash-screen": "3.2.0",
    "react-native-svg": "12.1.1",
    "react-native-svg-transformer": "0.14.3",
    "react-native-toast-message": "^1.4.9",
    "react-redux": "7.2.4",
    "redux": "4.1.0",
    "redux-devtools-extension": "2.13.9",
    "redux-logger": "3.0.6",
    "redux-persist": "6.0.0",
    "redux-saga": "1.1.3",
    "rn-fetch-blob": "^0.12.0",
    "styled-components": "5.1.1"
  },
  "devDependencies": {
    "@babel/core": "7.12.9",
    "@babel/runtime": "7.12.5",
    "@react-native-community/eslint-config": "2.0.0",
    "@types/jest": "26.0.23",
    "@types/lodash": "4.14.172",
    "@types/react-native": "0.64.5",
    "@types/react-native-html-to-pdf": "^0.8.1",
    "@types/react-redux": "^7.1.18",
    "@types/react-test-renderer": "16.9.2",
    "@types/redux-logger": "3.0.9",
    "babel-jest": "26.6.3",
    "eslint": "7.14.0",
    "eslint-plugin-react-hooks": "^5.1.0",
    "jest": "26.6.3",
    "metro-react-native-babel-preset": "0.64.0",
    "react-native-codegen": "0.0.7",
    "react-test-renderer": "17.0.1",
    "typescript": "^3.8.3"
  },
  "resolutions": {
    "@types/react": "17"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật