|
@@ -33,69 +33,11 @@ type Props = {
|
33
|
33
|
style: Object
|
34
|
34
|
};
|
35
|
35
|
|
36
|
|
-/**
|
37
|
|
- * The type of the React {@code Component} state of
|
38
|
|
- * {@link LocalVideoTrackUnderlay}.
|
39
|
|
- */
|
40
|
|
-type State = {
|
41
|
|
-
|
42
|
|
- /**
|
43
|
|
- * The style of {@code LocalVideoTrackUnderlay} which is a combination
|
44
|
|
- * of its default style and the consumer-specified style.
|
45
|
|
- */
|
46
|
|
- style: Object
|
47
|
|
-};
|
48
|
|
-
|
49
|
36
|
/**
|
50
|
37
|
* Implements a React {@code Component} which underlays the local video track,
|
51
|
38
|
* if any, underneath its children.
|
52
|
39
|
*/
|
53
|
|
-class LocalVideoTrackUnderlay extends Component<Props, State> {
|
54
|
|
- /**
|
55
|
|
- * Initializes a new {@code LocalVideoTrackUnderlay} instance.
|
56
|
|
- *
|
57
|
|
- * @param {Object} props - The read-only React {@code Component} props with
|
58
|
|
- * which the new instance is to be initialized.
|
59
|
|
- */
|
60
|
|
- constructor(props) {
|
61
|
|
- super(props);
|
62
|
|
-
|
63
|
|
- this.componentWillReceiveProps(props);
|
64
|
|
- }
|
65
|
|
-
|
66
|
|
- /**
|
67
|
|
- * Notifies this mounted React {@code Component} that it will receive new
|
68
|
|
- * props. Forks (in Facebook/React speak) the prop {@code style} because its
|
69
|
|
- * value is to be combined with the default style.
|
70
|
|
- *
|
71
|
|
- * @inheritdoc
|
72
|
|
- * @param {Object} nextProps - The read-only React {@code Component} props
|
73
|
|
- * that this instance will receive.
|
74
|
|
- * @returns {void}
|
75
|
|
- */
|
76
|
|
- componentWillReceiveProps(nextProps) {
|
77
|
|
- // style
|
78
|
|
- const prevStyle = this.props && this.props.style;
|
79
|
|
- const nextStyle = nextProps && nextProps.style;
|
80
|
|
- const assignState = !this.state;
|
81
|
|
-
|
82
|
|
- if (prevStyle !== nextStyle || assignState) {
|
83
|
|
- const nextState = {
|
84
|
|
- style: {
|
85
|
|
- ...styles.localVideoTrackUnderlay,
|
86
|
|
- ...nextStyle
|
87
|
|
- }
|
88
|
|
- };
|
89
|
|
-
|
90
|
|
- if (assignState) {
|
91
|
|
- // eslint-disable-next-line react/no-direct-mutation-state
|
92
|
|
- this.state = nextState;
|
93
|
|
- } else {
|
94
|
|
- this.setState(nextState);
|
95
|
|
- }
|
96
|
|
- }
|
97
|
|
- }
|
98
|
|
-
|
|
40
|
+class LocalVideoTrackUnderlay extends Component<Props> {
|
99
|
41
|
/**
|
100
|
42
|
* Implements React's {@link Component#render()}.
|
101
|
43
|
*
|
|
@@ -105,7 +47,11 @@ class LocalVideoTrackUnderlay extends Component<Props, State> {
|
105
|
47
|
*/
|
106
|
48
|
render() {
|
107
|
49
|
return (
|
108
|
|
- <View style = { this.state.style }>
|
|
50
|
+ <View
|
|
51
|
+ style = { [
|
|
52
|
+ styles.localVideoTrackUnderlay,
|
|
53
|
+ this.props.style
|
|
54
|
+ ] }>
|
109
|
55
|
<VideoTrack videoTrack = { this.props._localVideoTrack } />
|
110
|
56
|
<TintedView>
|
111
|
57
|
{ this.props.children }
|