'React native dependency of dependency requires pod dependency - new NativeEventEmitter requires a non-null argument

I have created a custom react-native package using react-native-builder-bob. The package uses react-native-shake as a dependency.

My custom-package package.json:

  "peerDependencies": {
    "react": "*",
    "react-native": "*",
    "react-native-shake": "*"
  },
  "devDependencies": {
    "react": "17.0.2",
    "react-native": "0.67.2",
    "react-native-builder-bob": "^0.18.0",
    "react-native-shake": "^5.1.1"
  }

When I start my custom-package everything works fine. The custom-package uses RNshake as followed"

import RNShake from 'react-native-shake';

const MyFunction = () => {
  useEffect(() => {
    RNShake.addListener(() => {
     //do something
    });
  });
  return <></>
}

When installing the package on an app (using yalc) after starting the app I'm getting this error:

"new NativeEventEmitter(); requires a non-null argument"

enter image description here

what am i doing wrong here ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source