opentok-react-native
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "opentok-react-native", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "React Native components for OpenTok iOS and Android SDKs", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -15,2 +15,7 @@ import React, { Component } from 'react'; | ||
}; | ||
this.componentEvents = { | ||
streamDestroyed: Platform.OS === 'android' ? 'session:onStreamDropped' : 'session:streamDestroyed', | ||
streamCreated: Platform.OS === 'android' ? 'session:onStreamReceived' : 'session:streamCreated', | ||
}; | ||
this.componentEventsArray = Object.values(this.componentEvents); | ||
} | ||
@@ -25,8 +30,8 @@ componentWillMount() { | ||
this.streamDestroyed.remove(); | ||
OT.removeJSComponentEvents(this.componentEventsArray); | ||
} | ||
setEventListeners() { | ||
const streamDestroyed = Platform.OS === 'android' ? 'session:onStreamDropped' : 'session:streamDestroyed'; | ||
const streamCreated = Platform.OS === 'android' ? 'session:onStreamReceived' : 'session:streamCreated'; | ||
OT.setJSComponentEvents(this.componentEventsArray); | ||
this.streamCreated = nativeEvents.addListener( | ||
streamCreated, | ||
this.componentEvents.streamCreated, | ||
(stream) => { | ||
@@ -48,3 +53,3 @@ const subscriberProperties = sanitizeProperties(this.props.properties); | ||
this.streamDestroyed = nativeEvents.addListener( | ||
streamDestroyed, | ||
this.componentEvents.streamDestroyed, | ||
(stream) => { | ||
@@ -51,0 +56,0 @@ OT.removeSubscriber(stream.streamId, (error) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
89032
693