Skip to content

Commit

Permalink
remove createRef use instance
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Oct 29, 2020
1 parent 8ea88a2 commit b2a9203
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/AttachmentPicker/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {createRef} from 'react';
import React from 'react';
import PropTypes from 'prop-types';

const propTypes = {
Expand All @@ -21,11 +21,6 @@ const propTypes = {
* </AttachmentPicker>
*/
class AttachmentPicker extends React.Component {
constructor(props) {
super(props);
this.onChangeCallback = createRef();
}

render() {
return (
<>
Expand All @@ -36,12 +31,12 @@ class AttachmentPicker extends React.Component {
onChange={(e) => {
const file = e.target.files[0];
file.uri = URL.createObjectURL(file);
this.onChangeCallback.current(file);
this.callback(file);
}}
/>
{this.props.children({
show: (callback) => {
this.onChangeCallback.current = callback;
this.callback = callback;
this.fileInput.click();
},
})}
Expand Down

0 comments on commit b2a9203

Please sign in to comment.