1.0.2 • Published 7 years ago

imoney-react-switch v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

imoney-react-switch

-1

Browser support

IE9+

Installation

npm i imoney-react-switch

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import Switch from "imoney-react-switch";
import "imoney-react-switch/src/index.css";
class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            checked: true
        };
        this.changeState = this.changeState.bind(this);
    }

    changeState(e, checked) {
        e.stopPropagation();
        this.setState({
            checked: checked
        });
    }

    render() {
        return (
            <div>
                <Switch onChange={this.changeState} checked={this.state.checked}/>
            </div>
        );
    }
}
ReactDOM.render(
    <App />,
    document.getElementById('app')
);

index

changeState(e,checked,index){
    e.stopPropagation();
    console.log(index);
},
<Switch index="1" onChange={this.changeState} checked={true}/>
<Switch index="2" onChange={this.changeState} checked={true}/>

disable

<Switch disable={true} onChange={this.changeState} checked={true}/>
1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago