not-tinder-ui

not-tinder-ui

  • Docs

›Components

Get started

  • Introduction

Components

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

AddRemoveImage

Tinder like add remove image component

No imageSource providedimageSource provided
AddRemoveImage_emptyAddRemoveImage_full

Usage

// src/AddRemove.tsx
import React, { useState } from 'react';
import { AddRemoveImage } from 'nottinderuikit';
import { MaterialCommunityIcons, Entypo } from '@expo/vector-icons';

const AddRemove = () => {
  const [imageSource, setImageSource] = useState<undefined | { uri: string }>()
  const removeIcon = <Entypo name='cross' size={25} color='white' />;
  const addIcon = (
    <MaterialCommunityIcons name='plus' size={25} color='white' />
  );
  const saveImage = (id: string) => {
    // Here you upload your image to your server
    // We just log the image id and set an imageSource 😄
    console.log(`Uploading image ${id}`);
    const uri = 'https://images.unsplash.com/photo-1585744134783-ae8804f900dc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=933&q=80';
    setImageSource({ uri });
  }
  const removeImage = (id: string) => {
    // Here you delete your image from your server
    // We just log the image id and unset the imageSource
    console.log(`Removing image ${id}`);
    setImageSource(undefined);
  }
  const sampleId = 'Image-1';


  return <AddRemoveImage
    addIcon={addIcon}
    addImage={saveImage}
    removeIcon={removeIcon}
    removeImage={removeImage}
    imageSource={imageSource}
    id={sampleId}
  />
}

export default AddRemove

AddRemoveImage_demo


Props

  • id
  • addIcon
  • addCallback
  • removeIcon
  • removeCallback
  • imageSource
  • height
  • width

Reference

id

Identifier of the file, this value is pased as a parameter on addCallback and removeCallback.

TypeDefaultRequired
stringundefinedtrue

addIcon

We didn't include icons as part of the library, in this example we used the ones provided by @expo/vector-icons

Icon shown on the bottom right of the component when there's no imageSource provided.

TypeDefaultRequired
ReactNodeundefinedtrue

addCallback

Function called when the component is pressed and there's no imageSource.

TypeDefaultRequired
function: ( id: string ) => anyundefinedtrue

removeIcon

We didn't include icons as part of the library, in this example we used the ones provided by @expo/vector-icons

Icon shown on the bottom right of the component when there is imageSource provided.

TypeDefaultRequired
ReactNodeundefinedtrue

removeCallback

Function called when the removeIcon is pressed.

TypeDefaultRequired
function: ( id: string ) => anyundefinedtrue


imageSource

Source object of the image

TypeDefaultRequired
object: { uri: string }undefinedfalse

height

Height of the AddRemoveImage component

TypeDefaultRequired
number150false

width

Width of the AddRemoveImage component

TypeDefaultRequired
number100false

← IntroductionAvatar →
  • Usage
  • Props
  • Reference
    • id
    • addIcon
    • addCallback
    • removeIcon
    • removeCallback
    • imageSource
    • height
    • width
not-tinder-ui
Docs
Getting Started (or other categories)
More
GitHubStar
Facebook Open Source