Migrate string refs over to createRef
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {createRef} from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import createReactClass from 'create-react-class';
|
||||
|
||||
@@ -30,12 +30,16 @@ module.exports = createReactClass({
|
||||
onResize: PropTypes.func,
|
||||
},
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
this._vid = createRef();
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
this.refs.vid.addEventListener('resize', this.onResize);
|
||||
this._vid.current.addEventListener('resize', this.onResize);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
this.refs.vid.removeEventListener('resize', this.onResize);
|
||||
this._vid.current.removeEventListener('resize', this.onResize);
|
||||
},
|
||||
|
||||
onResize: function(e) {
|
||||
@@ -46,7 +50,7 @@ module.exports = createReactClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<video ref="vid" style={{maxHeight: this.props.maxHeight}}>
|
||||
<video ref={this._vid} style={{maxHeight: this.props.maxHeight}}>
|
||||
</video>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user