Giter Site home page Giter Site logo

Comments (4)

musabgulfam avatar musabgulfam commented on August 20, 2024

???

from react-native-multi-slider.

JDMathew avatar JDMathew commented on August 20, 2024

If you set smoothSnapped={true} does this fix your problem? It will then snap on release.

from react-native-multi-slider.

musabgulfam avatar musabgulfam commented on August 20, 2024

Alright, after a long time, I did observe a solution. Using onValueChange props is a bad idea. If you were to make it smooth, use the prop enableLabel, with a customLabel component which has the min and max values in its props to render the min and max values, and use the onValueChangeFinish prop to set the min and max values. So the final solution may look something like this.

       <MultiSlider
          values={[minPrice, maxPrice]}
          sliderLength={200}
          onValuesChangeFinish={handleValueChange}
          max={200}
          smoothSnapped={true}
          thumbTintColor={colors.secondaryColor}
          enableLabel
          customLabel={props => {
            return (
              <View>
                <Text style={{
                  color: '#121212',
                  fontSize: 25,
                  fontFamily: 'Oswald-Bold',
                  marginBottom: 10
                }}>${props.oneMarkerLeftPosition.toFixed(0)} - ${props.twoMarkerLeftPosition.toFixed(0)}</Text>
              </View>
            )
          }}
          step={1}
        />

from react-native-multi-slider.

manjubhatt avatar manjubhatt commented on August 20, 2024

Alright, after a long time, I did observe a solution. Using onValueChange props is a bad idea. If you were to make it smooth, use the prop enableLabel, with a customLabel component which has the min and max values in its props to render the min and max values, and use the onValueChangeFinish prop to set the min and max values. So the final solution may look something like this.

       <MultiSlider
          values={[minPrice, maxPrice]}
          sliderLength={200}
          onValuesChangeFinish={handleValueChange}
          max={200}
          smoothSnapped={true}
          thumbTintColor={colors.secondaryColor}
          enableLabel
          customLabel={props => {
            return (
              <View>
                <Text style={{
                  color: '#121212',
                  fontSize: 25,
                  fontFamily: 'Oswald-Bold',
                  marginBottom: 10
                }}>${props.oneMarkerLeftPosition.toFixed(0)} - ${props.twoMarkerLeftPosition.toFixed(0)}</Text>
              </View>
            )
          }}
          step={1}
        />

In customLabel i am not able to set the range input using min and max. By default its picking the sliderLength as min and max. any solution?

from react-native-multi-slider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.