switch-react-native
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Switch React Native

Content

Installation

npm install switch-react-native

Usage example

import React, { Component } from 'react';
import { View } from 'react-native';
import { Switch } from 'switch-react-native';
 
class SwitchExample extends Component {
  render() {
    return (
      <View>
        <Switch
          height={40}
          width={300}
          activeText={`Active Text`}
          inActiveText={`InActive Text`}
          onValueChange={(value: any) => console.log(value)}
        />
      </View>
    );
  }
}

Properties

  • width (Number) - Initial switch state (default: 150),
  • height (Number) - Initial switch state (default: 50),
  • time (Number) - Initial switch state (default: 200 mms),
  • value (Bool) - Initial switch state (default: false),
  • activeText (String) - String activeText,
  • inActiveText (String) - String inActiveText,
  • activeTextStyle (Object) - Style is object,
  • inActiveTextStyle (Object) - Style is object,
  • activeStyle (Object) - Style is object,
  • backgroundStyle (Object) - Style is object,

Events

  • onValueChange: This function is called when the switch is activated.

License

MIT License

Questions?

Feel free to create an issue

Package Sidebar

Install

npm i switch-react-native

Weekly Downloads

1

Version

1.0.9

License

MIT

Unpacked Size

8.96 kB

Total Files

11

Last publish

Collaborators

  • jundat95