5

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

enter image description here

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

enter image description here

How can I import the plugin successfully?

Thanks in advance.

Hassan Hosseini
  • 573
  • 1
  • 3
  • 20

1 Answers1

3

1- Something is Missings

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

-

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;

enter image description here

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

Muhammad Numan
  • 12,108
  • 1
  • 25
  • 50
  • the project was in git. which i didn't make. that was a very dumb thinking from my side. however i resolved it before your comment. still i will upvote and accept it. – Arpit Todewale May 19 '20 at 06:57
  • you can clone then perform these steps and make patch package then push again that will become the part of your project – Muhammad Numan May 19 '20 at 06:59