Skip to content

Commit

Permalink
fix: improve pr
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej.lodygowski committed Sep 27, 2024
1 parent f8753f1 commit b6336a6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
14 changes: 14 additions & 0 deletions example/src/Examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,20 @@ export const examples: Props[] = [
);
},
},
{
title: 'Buffer value on Android',
render() {
return (
<SliderExample
step={1}
minimumValue={0}
maximumValue={100}
bufferedValue={75}
bufferedTrackTintColor="red"
/>
);
},
},
{
title: 'onSlidingStart',
render(): React.ReactElement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void disableStateListAnimatorIfNeeded() {

/* package */ void setBufferedValue(double value) {
mBufferedValue = value;
updateBufferedValue();
updateAll();
}

/* package */ void setStep(double step) {
Expand Down Expand Up @@ -238,6 +238,7 @@ private void updateAll() {
updateLowerLimit();
updateUpperLimit();
updateValue();
updateBufferedValue();
}

/** Update limit based on props limit, max and min
Expand Down
36 changes: 18 additions & 18 deletions package/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FC } from 'react';
import {FC} from 'react';
import * as ReactNative from 'react-native';
import { ImageURISource } from 'react-native';
import {ImageURISource} from 'react-native';

type Constructor<T> = new (...args: any[]) => T;

Expand All @@ -14,6 +14,21 @@ export interface SliderPropsAndroid extends ReactNative.ViewProps {
* Color of the foreground switch grip.
*/
thumbTintColor?: string;

/**
* Write-only property representing the bufferedValue of the slider.
* Entered once at the beginning still acts as an initial value.
* The value should be between minimumValue and maximumValue,
* which default to 0 and 1 respectively.
* Default value is 0.
*/
bufferedValue?: number;

/**
* The color used for the buffered track (secondaryProgress)
* Overrides the default grey gradient image.
*/
bufferedTrackTintColor?: string;
}

export interface SliderRef {
Expand Down Expand Up @@ -108,12 +123,6 @@ export interface SliderProps
*/
minimumTrackTintColor?: string;

/**
* The color used for the buffered track (secondaryProgress)
* Overrides the default grey gradient image.
*/
bufferedTrackTintColor?: string;

/**
* Initial minimum value of the slider. Default value is 0.
*/
Expand Down Expand Up @@ -163,15 +172,6 @@ export interface SliderProps
*/
value?: number;

/**
* Write-only property representing the bufferedValue of the slider.
* Entered once at the beginning still acts as an initial value.
* The value should be between minimumValue and maximumValue,
* which default to 0 and 1 respectively.
* Default value is 0.
*/
bufferedValue?: number;

/**
* Reverses the direction of the slider.
*/
Expand All @@ -183,7 +183,7 @@ export interface SliderProps
StepMarker?: FC<MarkerProps>;

/**
*
*
*/
renderStepNumber?: boolean;

Expand Down

0 comments on commit b6336a6

Please sign in to comment.