cometchat / chat-sdk-react-native

Voice & Video Calling and Text Chat SDK for React Native
Other
18 stars 17 forks source link

Calling init adds document to global scope #26

Closed cranberyxl closed 3 years ago

cranberyxl commented 3 years ago

Describe the problem

When we call CometChat.init(APP_ID, settings); it is defining document in the global scope.

What was the expected behavior?

document should not be globally defined. Other libraries use the existence of document typeof document !== 'undefined' to decide if the library should try to do browser things like accessing the DOM.

Reproduction

console.log(typeof document);
CometChat.init(APP_ID, settings);
console.log(typeof document);

Environment

  "react-native": "0.63.4",
 "@cometchat-pro/react-native-chat": "2.2.0",
anantgarg commented 3 years ago

Closing issue as @cranberyxl was able to modify the conflicting library to fix this issue. In the next version of CometChat Pro (v3), we will be removing the document definition creation.