codler / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
https://www.npmjs.com/package/@codler/react-native-keyboard-aware-scroll-view
38 stars 16 forks source link

TypeError: undefined is not a function, js engine: hermes with v2.0.0/RN 0.66.3 #13

Open emclab opened 3 years ago

emclab commented 3 years ago

The error pops up in my RN 0.66.3 app with macOS Big Sur/Xcode 13. One of the modules installed (not sure which one) in the app installed @codler/react-native-keyboard-aware-scroll-view as dependency which was version 1.0.0 and it thrower error on IOS simulator.

ERROR  TypeError: undefined is not a function, js engine: hermes
Error: ENOENT: no such file or directory, open '/Users/macair/Documents/code/js/xyz_app5/http:/localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.xyz-app5'
    at Object.openSync (fs.js:498:3)
    at Object.readFileSync (fs.js:394:35)
    at getCodeFrame (/Users/macair/Documents/code/js/xyz_app5/node_modules/metro/src/Server.js:919:18)
    at Server._symbolicate (/Users/macair/Documents/code/js/xyz_app5/node_modules/metro/src/Server.js:992:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Server._processRequest (/Users/macair/Documents/code/js/xyz_app5/node_modules/metro/src/Server.js:403:7) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/macair/Documents/code/js/xyz_app5/http:/localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.xyz-app5'
} 

After reminding by one fellow on stackoverflow.com, I updated react-native-keyboard-aware-scroll-view to the latest which 2.0.0 and the error briefly disappeared. However after the reloading of the app, the exactly same error comes back again and now it states. Tried to re-installed the module again and it didn't help. Here is the dependencies of the app:

"dependencies": {
    "@codler/react-native-keyboard-aware-scroll-view": "^2.0.0",  //<<== yarn add to upgrade from 1.0.0 to 2.0.0
    "@ethersproject/shims": "^5.5.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/toolbar-android": "^0.2.1",
    "@react-native-picker/picker": "^2.1.0",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "aliyun-oss-react-native": "^1.0.0-alpha.7",
    "crypto-js": "^4.1.1",
    "ethers": "^5.5.1",
    "native-base": "2.15.2",
    "react": "17.0.2",
    "react-native": "0.66.3",
    "react-native-blob-util": "^0.13.16",
    "react-native-confirmation-code-field": "^7.1.0",
    "react-native-device-info": "^8.4.3",
    "react-native-easy-grid": "^0.2.2",
    "react-native-elements": "^3.4.2",
    "react-native-flash-message": "^0.2.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-get-random-values": "^1.7.0",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-image-crop-picker": "^0.36.4",
    "react-native-loading-spinner-overlay": "^2.0.0",
    "react-native-modal": "^13.0.0",
    "react-native-reanimated": "^2.2.3",
    "react-native-redash": "^16.2.2",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.8.0",
    "react-native-sensitive-info": "^6.0.0-alpha.9",
    "react-native-vector-icons": "^9.0.0",
    "socket.io-client": "^4.3.2"
  }, 

Here is the screen shot of simulator: Screen Shot 2021-11-17 at 8 33 42 PM

Is it a bug? How to fix the error?

jamesholcomb commented 3 years ago

Also receiving this in RN 0.65.2 with Hermes

jamesholcomb commented 3 years ago

@emclab The culprit is your dependency from native-base.

I was able to resolve this by switching from npm to yarn and adding to package.json:

  "resolutions": {
    "@codler/react-native-keyboard-aware-scroll-view": "2.0.0"
  },
  "dependencies": {
   ...
   "@codler/react-native-keyboard-aware-scroll-view": "2.0.0"
  },

There are other workarounds for forcing dependencies in npm, but they are quite cumbersome.