@khaledz370/slider-react-native

0.0.11 • Public • Published

Crafty-app

Made by Crafty-app

React native slider

A fully custimizable slider for react native

Installation

npm:

  npm i @khaledz370/slider-react-native

yarn:

  yarn add @khaledz370/slider-react-native

Usage

List of possible values:

maxValue:

    Maximum slider value
    default = 1

minValue:

   Minimum slider value
   default = 0

width:

   Slider width

value:

    Current slider value default minimum value

step:

   Step at which slider move
   you can also use step in persentage Ex:"17%" as a string
   default 0

height:

  Slider height
  default 20

trackStyle

  Style of the full track
  takes a style object

progressBarStyle

  Style of the progress slider
  takes a style object

panStyle:

  Style of the pan
  takes a style object

trackBackgroundImage:

  Changes backGround image of the full track
  default null
  takes an image value

progressBarBackgroundImage:

  Changes backGround image of the progress track
  default null
  takes an image value

panBackgroundImage:

  Changes backGround image of the pan
  default null
  takes an image value

vertical

  Chages the slider to a vertical slider
  default false

flip

  Will flip the slider verticaly or horizontaly
  default false

disabled

  will disable the slider
  default false

onChange

  required!
  returns a value based on the slider position

Usage/Examples

Slider basic example

import Slider from "@khaledz370/slider-react-native";

export default function App() {
  const [value, setValue] = useState(50);
  return (
    <View style={styles.container}>
      {showModal && (
        <Slider
          value={value}
          step={10}
          maxValue={500}
          minValue={30}
          onChange={e => setValue(e)}
          width={300}
        />
      )}
    </View>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "skyblue",
    alignItems: "center",
    justifyContent: "space-around"
  }
});

Screenshots

alt text

Slider custom example

        <Slider
          ...
          height={50}
          trackStyle={{
            borderRadius: 50,
            borderColor: "lightgreen",
            borderWidth: 5
            }}
          panStyle={{
            backgroundColor: "red",
            borderColor: "blue",
            borderWidth: 5,
            width: 50,height: 80,
            borderRadius: 15
            }}
          progressBarStyle={{
            backgroundColor: "wheat"
            }}
        />

Screenshots

alt text

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.113latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.113

Package Sidebar

Install

npm i @khaledz370/slider-react-native

Weekly Downloads

2

Version

0.0.11

License

crafty-app

Unpacked Size

11.9 kB

Total Files

4

Last publish

Collaborators

  • khaledz370