githuboftigran / rn-range-slider

A native slider with range
MIT License
237 stars 133 forks source link

When using "ref", Typescript gives "No Overload matches this call" error #47

Closed Runtime-Err closed 3 years ago

Runtime-Err commented 4 years ago

Problem:

When creating a reference to an instance of RangeSlider to call methods (as suggested here), TypeScript gives the error "No overload matches this call."

How to reproduce:

// ref to set slider to minimum position in useEffect()
  const slider = useRef(null);

  useEffect(() => {
    if (slider.current !== null && reset === true) {
      slider.current.setLowValue(50); 
    }
  }, [reset]);

    <View>
      <RangeSlider
        ref={slider} // error: No overload matches this call
        rangeEnabled={false}
        max={70}
        min={50}
        step={1}
        initialLowValue={height}
        value={height}
        onValueChanged={(sliderValue: number) => setHeightValues(sliderValue)}
      />
    </View> 
githuboftigran commented 3 years ago

All view props are supported now