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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider stuck when value is set #2515

Closed
dakkafex opened this issue Aug 23, 2020 · 4 comments · Fixed by #2585
Closed

Slider stuck when value is set #2515

dakkafex opened this issue Aug 23, 2020 · 4 comments · Fixed by #2585
Labels
🐛 Bug component: Slider Issue related to Slider Component 📥 PR Submitted Pull request has been submitted to resolve this issue
Milestone

Comments

@dakkafex
Copy link

dakkafex commented Aug 23, 2020

Update: The slider is not actually stuck but the button initially goes to the start, if you try to slide from where it should be, it does slide and stays to its proper position.

Explain what you did (Required)

useing the slider component with a value from state

Expected behavior (Required)

being able to slide

Describe the bug (Required)

slider is stuck at minimum position and wont respond to input

To Reproduce (Required)

Unable to reproduce on snack
but here it is how i have implemented it
https://snack.expo.io/PBHVS_RlT

Screenshots (Required)

image

Your Environment (Required):

software version
react-native-elements 2.0.4
react-native 0.61.5
@dakkafex
Copy link
Author

dakkafex commented Aug 23, 2020

Currently i implemented a ghettofix by updating the value of the slider with an onLayout by 0.1 and using Math.floor(sliderValue) on the value display, to force the thumb to move to the correct spot :P

@flyingcircle flyingcircle added 🐛 Bug component: Slider Issue related to Slider Component labels Aug 24, 2020
@flyingcircle flyingcircle added this to the 3.0.0 milestone Sep 3, 2020
@Elijen
Copy link

Elijen commented Sep 8, 2020

Same issue here. I used patch-package for a hotfix. Here's the patch:

react-native-elements+2.3.1.patch

diff --git a/node_modules/react-native-elements/src/slider/Slider.js b/node_modules/react-native-elements/src/slider/Slider.js
index 8deb5c2..fd95254 100644
--- a/node_modules/react-native-elements/src/slider/Slider.js
+++ b/node_modules/react-native-elements/src/slider/Slider.js
@@ -77,16 +77,18 @@ class Slider extends React.Component {
       onPanResponderTerminate: this.handlePanResponderEnd.bind(this),
     });
     this.isVertical = props.orientation === 'vertical';
+
+    this.componentDidUpdate(props, true);
   }
 
-  componentDidUpdate(prevProps) {
+  componentDidUpdate(prevProps, force) {
     const newValue = getBoundedValue(
       this.props.value,
       this.props.maximumValue,
       this.props.minimumValue
     );
 
-    if (prevProps.value !== newValue) {
+    if (prevProps.value !== newValue || force) {
       if (this.props.animateTransitions) {
         this.setCurrentValueAnimated(newValue);
       } else {

@ivansenic
Copy link

Any reason the patch was not included in the version 2.3.2? Updating to this version makes all sliders in the app unusable.. It's really inside that this has not been fixed since the 2.0.4 😢

@pranshuchittora
Copy link
Member

Hi @ivansenic
We are trying our best to fix high priority bugs and ship some new features to make the RNE more stable and robust. The following issue will be fixed in the next release for sure 😄

pranshuchittora added a commit to pranshuchittora/react-native-elements that referenced this issue Sep 18, 2020
…k issue.

Issues Fixed.
- allowTouchTrack` Slider thump position is off when sliding react-native-elements#2509
- Slider stuck when value is set react-native-elements#2515
@pranshuchittora pranshuchittora added the 📥 PR Submitted Pull request has been submitted to resolve this issue label Sep 18, 2020
pranshuchittora added a commit that referenced this issue Sep 18, 2020
…k issue. (#2585)

Issues Fixed.
- allowTouchTrack` Slider thump position is off when sliding #2509
- Slider stuck when value is set #2515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug component: Slider Issue related to Slider Component 📥 PR Submitted Pull request has been submitted to resolve this issue
Projects
None yet
5 participants