sacmii / rn-vertical-slider

React Native Vertical Slider
MIT License
211 stars 46 forks source link

ball indicator not updating #26

Open karanjhinga opened 3 years ago

karanjhinga commented 3 years ago

The problem lies with the component should update

shouldComponentUpdate(nextProps, nextState) {
  if (nextProps.value && nextProps.value !== nextState.value) {
    this._changeState(nextProps.value);
  }
  return false;
}

By making this u are preventing the component from rerendering

JayantJoseph commented 3 years ago

@karanjhinga did you find a solution for this? Or did you edit this. @sacmii This is preventing this package to work.

tai8292 commented 3 years ago

Change return to true and the ball indicator will update. But you should check carefully about the performance of your app.

BaderSerhan commented 2 years ago

I changed shouldComponentUpdate to the following, which will let the ball indicator update while also preserving performance:

   shouldComponentUpdate(nextProps: props, nextState: state) {
        let shouldUpdate = nextProps.value !== this.props.value || nextProps.value !== this.state.value;
        if (shouldUpdate) {
            this._changeState(nextProps.value);
        }
        return shouldUpdate;
    }
will-thrive commented 1 year ago

Is the above solution of Jun 7, 2022 by BaderSerhan the preferred solution? If so, please could the repository be updated accordingly?

tal-VSL commented 1 year ago

We are currently facing the same issue. any ideas?

will-thrive commented 1 year ago

There is the following fork of this repo that has the ball number updating:
https://www.npmjs.com/package/rn-vertical-slider-matyno?activeTab=explore I'm using that fork for now.