react-native-jitsi-meet module not found

喜欢而已 提交于 2020-07-20 10:40:03

问题


I am trying to install Jitsi-Meet plugin in my react-native project. I am trying to create a video/audio conference meetup feature in a website and I want to use react-native for the same purpose.

this is the plugin link.react-native-jitsi-meet - npmjs.org

The plugin gets successfully installed in the package.json

But when I am trying to import in my App.tsx file, it shows me module not found

How can I import the plugin successfully?

Thanks in advance.


回答1:


1- Something is Missings

There is missing index.js file which is mendatory for npm packge. you can see in screenshot

-

2- You need to perform these steps to resolve this package

Step 1:

make index.js file at node_modules/react-native-jitsi-meet/index.js

Step 2:

and this add code in that index.js file

import { NativeModules, requireNativeComponent } from 'react-native';

export const JitsiMeetView = requireNativeComponent('RNJitsiMeetView');
export const JitsiMeetModule = NativeModules.RNJitsiMeetView;
const call = JitsiMeetModule.call;
const audioCall = JitsiMeetModule.audioCall;
JitsiMeetModule.call = (url, userInfo) => {
  userInfo = userInfo || {};
  call(url, userInfo);
}
JitsiMeetModule.audioCall = (url, userInfo) => {
  userInfo = userInfo || {};
  audioCall(url, userInfo);
}
export default JitsiMeetModule;

after these steps everything will be working

Node: you should automate these steps when we install any package by npm or yarn

we can use patch-package to automate these steps



来源:https://stackoverflow.com/questions/60338882/react-native-jitsi-meet-module-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!