1 Star 0 Fork 0

MR03 / toggle-switch-react-native

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Toggle Switch Component for react native, it works on iOS and Android.

Content

Installation

  • 1.Run npm i toggle-switch-react --save
  • 2.import ToggleSwitch from 'toggle-switch-react'

Demo

Screenshots

Getting started

To Get Started, Import toggle-switch-react to your js file.

import ToggleSwitch from 'toggle-switch-react'

Inside your component's render method, or any other method returning views, use ToggleSwitch:

<ToggleSwitch
  isOn={false}
  onColor="green"
  offColor="red"
  label="Example label"
  labelStyle={{ color: "black", fontWeight: "900" }}
  size="large"
  onToggle={isOn => console.log("changed to : ", isOn)}
/>

API

Props Type Optional Default Description
isOn Boolean true 'false' Default state, true for On, false for off
onColor String true '#634fc9' On Color
offColor String true '#ecf0f1' Off Color
label String true Custom Label Text on the Left of the toggle Button
labelStyle Object true {marginHorizontal: 10} Custom Styling for the Label Text View
size String true 'medium' Size of the toggle switch button ( 'large', 'medium', 'small')
icon React Component true null Icon for the toggle. Can be any React Component considerate of size
onToggle Function Callback false none Callback when the toggle switch component changes the state, params: isOn
disabled Boolean true 'false' Disable toggling the component

Contribution

If you encountered an Issue, please add a screenshot of the bug or a code snippet.

Quickest way to solve issue is to reproduce it on the example project

Pull requests are welcome. If you want to change the API or imporove something, feel free to create an issue and discuss it first.


MIT Licensed

MIT License Copyright (c) 2017 Amine Benkeroum Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
JavaScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/mr03/toggle-switch-react-native.git
git@gitee.com:mr03/toggle-switch-react-native.git
mr03
toggle-switch-react-native
toggle-switch-react-native
master

搜索帮助