Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use different lifecycle methods for React 16.4 support. #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ export default class Slider extends PureComponent {
value: new Animated.Value(this.props.value),
};

componentWillMount() {
constructor(props) {
super(props);
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder,
onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder,
Expand All @@ -200,20 +201,21 @@ export default class Slider extends PureComponent {
onPanResponderTerminationRequest: this._handlePanResponderRequestEnd,
onPanResponderTerminate: this._handlePanResponderEnd,
});
};
}

componentWillReceiveProps(nextProps) {
var newValue = nextProps.value;
componentDidUpdate(prevProps) {
const oldValue = prevProps.value;
const newValue = this.props.value;

if (this.props.value !== newValue) {
if (newValue !== oldValue) {
if (this.props.animateTransitions) {
this._setCurrentValueAnimated(newValue);
}
else {
this._setCurrentValue(newValue);
}
}
};
}

render() {
var {
Expand Down