3.0.1 • Published 2 years ago

react-native-switch-with-icons v3.0.1

Weekly downloads
43
License
MIT
Repository
github
Last release
2 years ago

react-native-switch-with-icons

A simple switch component with icons in the thumb.

GitHub branch checks state npm GitHub Repo stars GitHub issues

Example

example

Installation

npm i react-native-switch-with-icons

or

yarn add react-native-switch-with-icons

Usage

import SwitchWithIcons from "react-native-switch-with-icons";

const [darkMode, setDarkMode] = useState(false);

<SwitchWithIcons
  value={darkMode}
  onValueChange={setDarkMode}
/>

Properties

PropDescriptionTypeDefault
valueThe value to be representedBooleanfalse
disabledDefines if user can interactBooleanfalse
noIconSets the visibility of the iconBooleanfalse
onValueChangeChange value callbackFunction-
iconThe icons to be displayedObject{true: SwitchOn, false: SwitchOff}
trackColorThe colors of the trackObject{true: "rgb(144, 195, 240)", false: "rgb(187, 194, 204)"}
thumbColorThe colors of the thumbObject{true: "rgb(52, 149, 235)", false: "rgb(255, 255, 255)"}
iconColorThe colors of the iconsObject{true: "#FFFFFF", false: "#9499AD"}
disabledThumbColorThe color of the thumb when disabledString"#9499AD"
disabledTrackColorThe color of the track when disabledString"#BCBFC9"
disabledIconColorThe color of the icon when disabledString"#FFFFFF"
animationDurationThe duration of the animationNumber200

Contributing

Pull requests are welcome.