not-tinder-ui

not-tinder-ui

  • Docs

›Components

Get started

  • Introduction

Components

  • AddRemoveImage
  • Avatar
  • Card
  • ChatBubble
  • ChatInput
  • CustomSwitch
  • LabeledInput
  • LabeledRadioButtons
  • MediaCard
  • SwipeableWrapper

CustomSwitch

A tinder like switch

CustomSwitch_example

Usage

import React, { useState } from 'react'
import { CustomSwitch } from 'nottinderuikit'
import { MaterialCommunityIcons } from '@expo/vector-icons';

const SampleSwitch = () => {
  const [switchValue, setSwitchValue] = useState(false);
  const toggleValue = () => setSwitchValue(!switchValue);
  const lefttIcon = (
    <MaterialCommunityIcons
      name='fire'
      size={40}
      color={switchValue ? '#cecece' : '#fe526a'}
    />
  );
  const rightIcon = (
    <MaterialCommunityIcons
      name='star-four-points'
      size={20}
      color={switchValue ? '#edba59' : 'white'}
    />
  );
  const handleChange = (isToggledRight: boolean) => {
    if (isToggledRight) {
      console.log('Toggled right');
    } else {
      console.log('Toggled left');
    }
    toggleValue();
  }

  return <CustomSwitch
    handleChange={handleChange}
    isToggledRight={switchValue}
    leftIcon={lefttIcon}
    rightIcon={rightIcon}
  />
}

export default SampleSwitch;

Props

  • isToggledRight
  • handleChange
  • leftIcon
  • rightIcon

Reference

isToggledRight

State of the Switch

TypeDefaultRequired
booleanundefinedtrue

handleChange

Function called when the when the switch is pressed.

TypeDefaultRequired
function: (nextIsToggledRightValue: boolan) => voidundefinedtrue

leftIcon

Icon shown in the left side of the switch.

TypeDefaultRequired
ReactNodeundefinedtrue

rightIcon

Icon shown in the right side of the switch.

TypeDefaultRequired
ReactNodeundefinedfalse
← ChatInputLabeledInput →
  • Usage
  • Props
  • Reference
    • isToggledRight
    • handleChange
    • leftIcon
    • rightIcon
not-tinder-ui
Docs
Getting Started (or other categories)
More
GitHubStar
Facebook Open Source