1.1.3 • Published 4 years ago

react-native-full-switch v1.1.3

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

npm.io npm.io PRs Welcome

react-native-full-switch

A simple and fully customizable React Native component that implements a switch (toggle) for android and ios, that also support in RTL.

Example :-------------------------: npm.io example

Installation

If using yarn:

yarn add react-native-full-switch

If using npm:

npm i react-native-react-native-full-switch

##Usage

import Switch from 'react-native-full-switch'
...

const [checked, setChecked] = useState(false)
...

<Switch
    isOn={checked}
    onChange={isOn => setChecked(isOn)}
    />

Documentation

NameDescriptionDefaultType
isOnRequire, determine if the Switch is onfalseBoolean
onChangeRequire, a function that returns the new state of the switch after a pressFunction
trackWidthThe width style property of the track40Number
trackHeightThe height style property of the track24Number
curserWidthThe width style property of the curser20Number
curserHeightThe height style property of the curser20Number
spaceThe space of the curser from the beginning and the end of the track3Number
disableDisable the Switch for touchfalseBoolean
opacityOpacity of the press. number between 0 to 10.8Number
trackOnColorThe color of the track on on state"rgb(78,209,100)"String
trackOffColorThe color of the track on off state"rgb(223,223,223)"String
verticalChange the animation to verticalfalseBoolean
textText to show on the track""String
textStyleA custom style for the textStyle object
reversedRevers the direction of the animationfalseBoolean
trackStyleA custom style for the trackStyle object
curserOnColorThe color of the curser on on statewhiteString
curserOffColorThe color of the curser on off statewhiteString
curserStyleA custom style for the curserStyle object
disableOnCurserColorDisable color of the curser in on state"rgb(233,233,233)"String
disableOffCurserColorDisable color of the curser in off state"rgb(233,233,233)"String
durationThe duration of the animation in milliseconds500Number
disableOnTrackColorDisable color of the track on on state"rgba(78,209,100, 0.6)"String
disableOffTrackColorDisable color of the track on off state"rgba(223,223,223,0.6)"String
renderChildCurserRender a custom child component to the curserComponent

Contributing

Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.

License

MIT