Add object in NativeModules

2020-05-08 07:49发布

问题:

I would like to use https://github.com/dgladkov/react-native-image-rotate in react-native project

I download it with yarn add react-native-image-rotate

I link it with react-native link

I import it in my component with import ImageRotate from 'react-native-image-rotate';

But when I try to use it I have a Cannot read property 'rotateImage' of undefined

I put a break-point in node_modules/react-native-image-rotate/index.js on the line:

const RCTImageRotateModule = NativeModules.ImageRotateModule;

And in the object NativeModules there is no ImageRotateModule object.

How Can I add ImageRotateModule in NativeModules ?

Im using react-native 0.50.3

Thx

回答1:

react-native link react-native-image-rotate