React Native Create Seekbar Slider in Android iOS Example Tutorial

Slider also known as Seekbar is used to get one value from a multiple range of values in both android and iOS applications. Slider is most likely used in applications to set Ringer volume, Media Volume, Notification Volume, Screen brightness etc. This tutorial is the simplest example of Slider . In this tutorial we would going to create a react native application with Text component and Slider component, Now when application user starts moving the Slider then it will automatically update and set value between 1 to 100 in TextView.

Contents in this project Seekbar Slider Android iOS Example :

1. Start a fresh React Native project. If you don’t know how then read my this tutorial.

2. Import AppRegistry, StyleSheet, Text, View and Slider component in your project.

3. Create constructor() in your project’s class with super() method. Now create a State in your constructor named as SliderValue . Set the default starting value of SliderValue variable is zero(0) .

4. Create a Parent View in render’s return block and inside it create a Text component. Set the SliderValue State value in Text component. So when we will start updating the State value using Slider automatically updated value set inside the Text component.

5. Add Slider component just after the Text component.

step : This would set the margin value between each value.

minimumValue : Sets the minimum stating value of Slider .

maximumValue : Sets the maximum value of Slider .

minimumTrackTintColor : Color of Slider after moving.

onValueChange : Method call on moving Seekbar, so it will set the value inside Slider .

6. Create CSS Classes.

7. Complete source code for index.android.js / index.ios.js file:

Screenshots in Android mobile app:

Slider

Screenshot in iOS mobile application :

Slider