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

0.2.3 • Public • Published

react-native-reanimated-toggle

React native toggle component built with react-native-reanimated

  • [x] Built with Reanimated v2
  • [x] Built with typescript
  • [x] Customizable
  • [ ] Support for gestures

Installation

For this component to work you need to have installed react-native-reanimated

yarn add react-native-reanimated-toggle
npm install react-native-reanimated-toggle

Usage

Default component

import { View } from 'react-native';
import Toggle from 'react-native-reanimated-toggle';

const App = () => {
  const [toggled, setToggled] = useState(false);
  return <View>
    <Toggle toggled={toggled} onChange={setToggled} />
  </View>
}

Customize design

import { View } from 'react-native';
import Toggle from 'react-native-reanimated-toggle';

const App = () => {
  const [toggled, setToggled] = useState(false);
  return <Toggle
    toggled={toggled}
    onChange={setToggled}
    thumbOffset={4}
    activeTrackColor="orange"
    trackStyle={{ height: 30, width: 48 }}
    thumbSize={20}
  />
}

Demo

demo gif

For more examples check out expo project in /example folder.

License

MIT

Project bootstrapped with react-native-builder-bob

Dependencies (0)

    Dev Dependencies (20)

    Package Sidebar

    Install

    npm i react-native-reanimated-toggle

    Weekly Downloads

    1

    Version

    0.2.3

    License

    MIT

    Unpacked Size

    38.7 kB

    Total Files

    21

    Last publish

    Collaborators

    • danilodev