Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 93 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,102 @@ To use this library you need to ensure you are using the correct version of Reac
| `minimumTrackImage` | Assigns a minimum track image. Only static images are supported. The rightmost pixel of the image will be stretched to fill the track. | Image<br/>.propTypes<br/>.source | No | iOS |
| `thumbImage` | Sets an image for the thumb. Only static images are supported. Needs to be a URI of a local or network image; base64-encoded SVG is not supported. | Image<br/>.propTypes<br/>.source | No | |
| `trackImage` | Assigns a single image for the track. Only static images are supported. The center pixel of the image will be stretched to fill the track. | Image<br/>.propTypes<br/>.source | No | iOS | |
| ⚠️ **Experimental:**</br> `StepMarker` | Component to be rendered for each step on the track,<br/>with the possibility to change the styling, when thumb is at that given step | `FC<MarkerProps>`, <br/> where <br/> `MarkerProps`: `{stepMarked: boolean}` | No | iOS, Android, Windows |
| ⚠️ **Experimental:**</br> `renderStepNumber` | Turns on the displaying of numbers of steps.<br/>Numbers of steps are displayed under the track | bool | No | iOS, Android, Windows |
| [`StepMarker`](#stepmarker) | Component to be rendered for each step on the track,<br/>with the possibility to change the styling, when thumb is at that given step | `FC<MarkerProps>` | No | iOS, Android, Windows |
| [`renderStepNumber`](#renderstepnumber) | Turns on the displaying of numbers of steps.<br/>Numbers of steps are displayed under the track | bool | No | iOS, Android, Windows |
| `ref` | Reference object. | MutableRefObject | No | web |
| `View` | [Inherited `View` props...](https://github.com/facebook/react-native-website/blob/master/docs/view.md#props) | | | |

## Custom step marker and step numbers

It is possible to render default step numbers under your slider and to render custom step component and step marker.
<br/>This can be achieved by using:

### `renderStepNumber`

Turns on the displaying of numbers of steps.<br/>Numbers of steps are displayed under the track.
<br/>Two font sizes are available and they will be selected automatically depending on the overall number of steps.

### `StepMarker`

Your custom component rendered for every step on the Slider, both the thumb and the rest of steps along the Slider's whole length.
<br/>This `StepMarker` prop accepts your custom component and provides it with the following parameters:

<table>
<tr>
<td>

```typescript
stepMarked: boolean;
```

</td>
<td>

Indicates whether that custom step is the one that the thum is currently on.
<br/>If user drags or clicks on that step, thumb will be moved there and the `stepMarked` parameter will be set to `true`.
<br/>Use it, to differentiate between rendering your custom thumb component, or your custom step marker.

</td>
</tr>
<tr>
<td>

```typescript
currentValue: number;
```

</td>
<td>
Contains the `number` type saying at which value of the Slider the thumb currently is.
<br/>Use it, for example, to render the Slider value on every step marker, or to render different step marker's variant depending on the Thumb position.

</td>
</tr>
<tr>
<td>

```typescript
index: number;
```

</td>
<td>

Contains the index at which this exact instantiation of your custom step marker was rendered at.
<br/>Use it if you would like to render step number within the step marker, or, for example, if you want to render many variants of step marker depending on their positions along the Slider's width.

</td>
</tr>
<tr>
<td>

```typescript
min: number;
```

</td>
<td>

Minimum value of the Slider. It is equal to `minimumValue` and has the same default if not set.

</td>
</tr>
<tr>
<td>

```typescript
max: number;
```

</td>
<td>

Maximum value of the Slider. It is equal to `maximumValue` and has the same default if not set.

</td>
</tr>
</table>

## Roadmap and Progress

There's a Project board available [here](https://github.com/callstack/react-native-slider/projects/1) which contains all reported issues organized into columns regarding their status.
Expand Down
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1806,10 +1806,10 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 1dca942403ed9342f98334bf4c3621f011aa7946
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
FBLazyVector: be7314029d6ec6b90f0f75ce1195b8130ed9ac4f
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 0555a84ea495e8e3b4bde71b597cd87fbb382888
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
RCTDeprecation: 2c5e1000b04ab70b53956aa498bf7442c3c6e497
Expand Down Expand Up @@ -1874,4 +1874,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 1a52083da6c006694389963dc5ddd0deab10abc9

COCOAPODS: 1.15.2
COCOAPODS: 1.14.2
1 change: 1 addition & 0 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading