Skip to content

Commit

Permalink
Make Picker controlled only and remove setNativeProps
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Sep 8, 2022
1 parent 1cce3d5 commit 4c90e34
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/components/Picker/BasePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ class BasePicker extends React.Component {

this.updateSelectedValueAndExecuteOnChange = this.updateSelectedValueAndExecuteOnChange.bind(this);
this.executeOnCloseAndOnBlur = this.executeOnCloseAndOnBlur.bind(this);
this.setNativeProps = this.setNativeProps.bind(this);
}

/**
* This method mimicks RN's setNativeProps method. It's exposed to Picker's ref and can be used by other components
* to directly manipulate Picker's value when Picker is used as an uncontrolled input.
*
* @param {*} value
*/
setNativeProps({value}) {
this.pickerValue = value;
}

updateSelectedValueAndExecuteOnChange(value) {
Expand Down Expand Up @@ -57,16 +46,6 @@ class BasePicker extends React.Component {
onFocus: this.props.onOpen,
onBlur: this.executeOnCloseAndOnBlur,
}}
ref={(node) => {
if (!node || !_.isFunction(this.props.innerRef)) {
return;
}

this.props.innerRef(node);

// eslint-disable-next-line no-param-reassign
node.setNativeProps = this.setNativeProps;
}}
/>
);
}
Expand Down

0 comments on commit 4c90e34

Please sign in to comment.