rn-vertical-slider icon indicating copy to clipboard operation
rn-vertical-slider copied to clipboard

ball indicator not updating

Open karanjhinga opened this issue 4 years ago • 6 comments

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

karanjhinga avatar Nov 17 '20 21:11 karanjhinga

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

JayantJoseph avatar Dec 11 '20 13:12 JayantJoseph

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

tai8292 avatar Apr 07 '21 08:04 tai8292

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;
    }

BaderSerhan avatar Jun 07 '22 14:06 BaderSerhan

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

will-thrive avatar Jan 26 '23 17:01 will-thrive

We are currently facing the same issue. any ideas?

tal-VSL avatar Jan 26 '23 17:01 tal-VSL

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.

will-thrive avatar Jan 30 '23 10:01 will-thrive