Skip to content

Commit 4489be1

Browse files
committed
expose quickblox native view
1 parent 689ebb7 commit 4489be1

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

QuickbloxLocalVideoView.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Created by Dat Tran on 2/8/17.
3+
*/
4+
import React from 'react';
5+
import PropTypes from 'prop-types'
6+
import {requireNativeComponent} from 'react-native';
7+
8+
export default class QuickbloxLocalVideoView extends React.Component {
9+
10+
constructor(props) {
11+
super(props);
12+
this.onRendered = this.onRendered.bind(this);
13+
}
14+
15+
onRendered(event: Event) {
16+
if (this.props.onRendered)
17+
this.props.onRendered()
18+
}
19+
20+
stopCamera() {
21+
this.myRef.setNativeProps({stopCamera: true})
22+
}
23+
24+
render() {
25+
return <NativeQuickbloxLocalVideoView
26+
{...this.props}
27+
ref={ci => this.myRef = ci}
28+
onChange={this.onRendered}
29+
/>;
30+
}
31+
}
32+
33+
QuickbloxLocalVideoView.propTypes = {
34+
onRendered: PropTypes.func
35+
}
36+
37+
const NativeQuickbloxLocalVideoView = requireNativeComponent('QuickbloxLocalVideoView', null);

QuickbloxRemoteVideoView.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Created by Dat Tran on 2/8/17.
3+
*/
4+
import React from 'react';
5+
import PropTypes from 'prop-types'
6+
import {requireNativeComponent} from 'react-native';
7+
8+
export default class QuickbloxRemoteVideoView extends React.Component {
9+
10+
constructor(props) {
11+
super(props);
12+
this.onRendered = this.onRendered.bind(this);
13+
}
14+
15+
onRendered(event: Event) {
16+
if (this.props.onRendered)
17+
this.props.onRendered()
18+
}
19+
20+
render() {
21+
return <NativeQuickbloxRemoteVideoView
22+
{...this.props}
23+
ref={ci => this.myRef = ci}
24+
onChange={this.onRendered}
25+
/>;
26+
}
27+
}
28+
29+
QuickbloxRemoteVideoView.propTypes = {
30+
onRendered: PropTypes.func
31+
}
32+
33+
const NativeQuickbloxRemoteVideoView = requireNativeComponent('QuickbloxRemoteVideoView', null);

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11

22
import { NativeModules } from 'react-native';
3+
import QuickbloxLocalVideoView from './QuickbloxLocalVideoView'
4+
import QuickbloxRemoteVideoView from './QuickbloxRemoteVideoView'
5+
6+
export {
7+
QuickbloxLocalVideoView,
8+
QuickbloxRemoteVideoView
9+
}
310

411
const { RNQuickblox } = NativeModules;
512

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{
32
"name": "react-native-video-quickblox",
43
"version": "1.0.1",
@@ -23,6 +22,8 @@
2322
},
2423
"homepage": "https://github.com/ttdat89/react-native-video-quickblox/blob/master/README.md",
2524
"peerDependencies": {
26-
"react-native": "^0.41.2"
25+
"react": "16.0.0-alpha.12",
26+
"react-native": "^0.48.3",
27+
"prop-types": "^15.5.10"
2728
}
2829
}

0 commit comments

Comments
 (0)