react-native-dj-switch

daojia react-native-dj-switch

Usage no npm install needed!

<script type="module">
  import reactNativeDjSwitch from 'https://cdn.skypack.dev/react-native-dj-switch';
</script>

README

Toast

accordion

Install

npm i --save react-native-dj-switch

Usage

Using in your app will usually look like this:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
} from 'react-native';

import Switch from 'react-native-dj-switch';


export default class NPMTest extends Component {

    render() {
      return (
        <View style={{marginTop:20}}>
          <Switch open={true} onChange={this.onChange.bind(this)} />
        </View>
      );
    }
}

AppRegistry.registerComponent('xxx', () => NPMTest);

Props

The following props can be used to modify the style and/or behaviour:

Prop Type Opt/Required Default Note
open boolean Option false 控制UI是否处于打开状态,不控制数据状态,数据状态请自行控制
onChange function Option `` 状态改变触发的动作

Methods

The following methods can be used to open and close the Dialog:

Method Parameters Note