question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`allowTouchTrack` Slider thump position is off when sliding

See original GitHub issue

Explain what you did (Required)

I am using the Slider component. I was upgrading from version 2.0.4 to 2.2.1 in order to access the new allowTouchTrack prop. Before this upgrade, when sliding, the thumb was at the exact same position of the finger.

Expected behavior (Required)

The behaviour hasn’t changed.

Describe the bug (Required)

The bug is, that the slider’s thumb position is a bit ahead of the actual click/grab position. See the video below.

To Reproduce (Required)

We highly recommend that you re-create the bug on Snack. If not, list the steps that a reviewer can take to reproduce the behaviour:

By any means, I am willing to create a reproduction. I am not sure whether this bug is at your attention currently, or whether this is something specific that happens on my side. I will create a reproduction in the next 24 hours. Would be interesting to know meanwhile, whether this happens to other users as well.

When turning the prop allowTouchTrack on, the behaviour occurs. When turning it off everything is okay again.

Screenshots (Required) Video link Screenshot 2020-08-18 at 22 35 02

Your Environment (Required):

software version
react-native-elements 2.2.1
react-native 0.63.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hannojgcommented, Aug 19, 2020

Okay, reproduction is super simple: just create a slider and set the allowTouchTrack prop:

https://snack.expo.io/@hannojg/allowtouchtrack-bug

0reactions
pranshuchittoracommented, Dec 16, 2020

Hi @hannojg that’s the intended behaviour. If you press and hold and drag the slider will change as this is the intended behaviour of the Pan Gesture Handler.

What could have been a bug? If the slider responds outside its area.

The area of response is equal to the height.

Try this on the Playground Here -> https://react-native-elements.js.org/#/slider

Paste the below code.

import * as React from "react";
import { Slider, Icon } from "react-native-elements";

export default () => {
  return (
    <Slider
      animateTransitions
      animationType="timing"
      maximumTrackTintColor="#ccc"
      maximumValue={100}
      minimumTrackTintColor="#222"
      allowTouchTrack
      onSlidingComplete={() =>
        console.log("onSlidingComplete()")
      }
      onSlidingStart={() =>
        console.log("onSlidingStart()")
      }
      onValueChange={value =>
        console.log("onValueChange()", value)
      }
      orientation="horizontal"
      step={1}
      style={{ width: "80%", height: 10 }}
      thumbStyle={{ height: 20, width: 20 }}
      thumbProps={{
        children: (
          <Icon
            name="heartbeat"
            type="font-awesome"
            size={20}
            reverse
            containerStyle={{ bottom: 20, right: 20 }}
            color="#f50"
          />
        )
      }}
      thumbTintColor="#0c0"
      thumbTouchSize={{ width: 2, height: 2 }}
      trackStyle={{ height: 10, borderRadius: 20 }}
      value={50}
    />
  );
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable "tap and slide" in a UISlider? - Stack Overflow
When the user taps on the slider but outside of the thumbRect , the slider should jump to that value and then still...
Read more >
A Sliding Nightmare: Understanding the Range Input
Recording of the thumb motion in Edge from one end of the slider to the other (the three cases from top to bottom:...
Read more >
Flutter Slider widgets: A deep dive with examples
Slider is one of the basic Flutter widgets that can be used to select from a range of values by moving the slider...
Read more >
Material RangeSlider in Flutter - Medium
Also, if the thumbs are close enough together, and the tap is in both touch targets, no thumb is selected. In this case,...
Read more >
Playing With The HTML5 range Slider Input - the new code
Form inputs should have associated label elements, meaning that the range should also have an id attribute in most cases. Let's use the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found