Vahesaroyan-react-native-bubble-select - React native bubble picker

Overview

@vahesaroyan/react-native-bubble-select

React native bubble picker

Installation

npm install @vahesaroyan/react-native-bubble-select

Usage

import * as React from 'react';
import { useState } from 'react';

import { Dimensions } from 'react-native';
import BubbleSelect, {
  Bubble,
  BubbleProps,
} from '@vahesaroyan/react-native-bubble-select';

const createEmptyBounce = ({ key, width }: { key: number; width: number }) => ({
  id: '',
  text: '',
  borderColor: '#fff',
  borderWidth: 2,
  selectedColor: 'red',
  radius: width / 2,
  image: '',
  key: `K_${key}`,
  marginScale: 1.3,
});

const fakeData: (BubbleProps & { key?: string })[] = [
  createEmptyBounce({ key: 1, width: 29 }),
  createEmptyBounce({ key: 2, width: 91 }),
  {
    id: '1',
    text: 'Routes',
    borderWidth: 11,
    image: 'https://picsum.photos/200/300',
    radius: 55,
  },
  createEmptyBounce({ key: 3, width: 73 }),
  {
    id: '2',
    text: 'Parties',
    borderWidth: 6,
    image: 'https://picsum.photos/200/300',
    radius: 60,
  },
  {
    id: '3',
    text: 'Beach',
    borderWidth: 3,
    image: 'https://picsum.photos/200/300',
    radius: 60,
  },
  createEmptyBounce({ key: 4, width: 92 }),
  {
    id: '4',
    text: 'Food&Drinks',
    borderWidth: 9,
    image: 'https://picsum.photos/200/300',
    radius: 60,
  },
  {
    id: '5',
    text: 'With Kids',
    borderWidth: 7,
    image: 'https://picsum.photos/200/300',
    radius: 60,
  },
  createEmptyBounce({ key: 5, width: 95 }),
  {
    id: '6',
    text: 'Nature',
    borderWidth: 7,
    image: 'https://picsum.photos/200/300',
    radius: 44,
  },
  {
    id: '7',
    text: 'Culture',
    borderWidth: 6,
    image: 'https://picsum.photos/200/300',
    radius: 55,
  },
  createEmptyBounce({ key: 6, width: 90 }),
  {
    id: '8',
    text: 'Parties',
    borderWidth: 6,
    image: 'https://picsum.photos/200/300',
    radius: 41,
  },
  {
    id: '9',
    text: 'Romantic',
    borderWidth: 3,
    image: 'https://picsum.photos/200/300',
    radius: 41,
  },
  {
    id: '10',
    text: 'Urban',
    borderWidth: 11,
    image: 'https://picsum.photos/200/300',
    radius: 49,
  },
];

export const getCategory = (id: number | string) =>
  fakeData.find((item) => item.id === id.toString());

const exampleData: BubbleProps[] = fakeData.map((item) => ({
  borderColor: '#fff',
  selectedColor: '#fff',
  key: item.id || item.key,
  marginScale: 1.3,
  color: '#19de19',
  ...item,
  id: item.id.toString(),
}));

export const App = () => {
  const [selected, setSelected] = useState<string[]>([]);

  return (
    <BubbleSelect
      onSelect={(bubble) => {
        setSelected([...selected, bubble.id]);
      }}
      onDeselect={(bubble) => {
        setSelected(selected.filter((item) => item !== bubble.id));
      }}
      width={Dimensions.get('window').width}
      height={Dimensions.get('window').height}
      borderColor="#fff"
      bubbleSize={7}
    >
      {exampleData.map((item) => (
        <Bubble {...item} />
      ))}
    </BubbleSelect>
  );
};

export default App;

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

You might also like...
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

React Native Photo Editor (RNPE)
React Native Photo Editor (RNPE)

React Native Photo Editor (RNPE) 🌄 Image editor using native modules for iOS an

Discover Movies and TV shows -  React Native
Discover Movies and TV shows - React Native

movieapp Discover Movies and TV shows Download APK file Download from Google Drive - v2.2.1 What's included Name Description React Native Build Native

All my React Native examples

ReactNativeExamples All my React Native examples and experiements can be found here. This repo is divided into two sub folders, Instructions git clone

React Native Twitch application
React Native Twitch application

Notes I'm going to rewrite this project 😉 . Be ready to new Twitch application. Twitch This project was built for The Rolling Scopes #18 meetup. As o

React Native Todo List example app which uses Redux for managing app state
React Native Todo List example app which uses Redux for managing app state

react-native-redux-todo-list A sample todo list app developed by using React Native and Redux. How to run the app Install react-native If you don't ha

A simple To Do application written in React Native

Example To Do List application in react-native Requirements, install as needed: React Native: $ npm i -g react-native-cli watchman: $ brew install wa

A property finder application written using React Native

React Native PropertyFinder App This repository accompanies the tutorial I published on Ray Wenderlich's website, which describes the process of build

🏀 iOS and Android NBA app created with React Native
🏀 iOS and Android NBA app created with React Native

Swish An iOS and Android NBA app created with React Native. If you would like to request a feature, find a bug, have a question, or would like to leav

Comments
  • iOS - images freeze screen

    iOS - images freeze screen

    I have 25 bubbles that all have images. Unfortunately on the initial load of the page it freezes for a couple of seconds. Ideally the images should be loaded only if selected. I have been trying to fix the issue but no luck just yet.

    opened by LucasClaude 1
Owner
Vahe Saroyan
Over 5+ years of web/mobile development and good knowledge of web/mobile related technologies and languages such as HTML5/CSS3, JavaScript, React, React Native,
Vahe Saroyan
A react native interface for integrating payments using Braintree

A react native interface for integrating payments using Braintree

eKreative 17 Dec 30, 2022
React Native 实现无侵入自定义下拉刷新组件

react-native-ly-refresh-control 下拉刷新 iOS 基于MJRefresh 通过RCTCustomRefreshContolProtocol实现RefreshControl组件封装 JS端可以无侵入自定义下拉刷新只需要替换对应的refreshControl Androi

少言 12 Jul 2, 2022
iOS 15 share play API in react-native

react-native-shareplay iOS 15 share play API in react-native Installation yarn add react-native-shareplay And go to Xcode Capabilities and enable "Gro

Popshop Live 27 Oct 16, 2022
React Native package for interacting with HomeKit devices

React Native package for interacting with HomeKit devices

Ibrahim Berat Kaya 4 Dec 24, 2021
react native esptouch

react-native-esptouch One should know that This is a Unofficial project. The official demo is below: EsptouchForAndroid EsptouchForIOS Getting started

五毛共和国 Wumaoland 0 Oct 25, 2021
React Native Template for Taro

React Native Template for Taro requirement taro: @tarojs/cli@^3.2.0 framework: 'react' quick start install react native library install peerDependenci

null 1 Nov 20, 2021
A suite of IoT tools to use with React Native.

react-native-iot-tools WIP. A suite of IoT tools for React Native applications. Package iOS Android @react-native-iot-tools/bluetooth ✅ ❌ @react-nativ

Sara Pope 3 Oct 31, 2022
A testing MQTT react native library

react-native-awesome-testing abc Installation npm install react-native-awesome-testing Usage import { multiply } from "react-native-awesome-testing";

null 0 Nov 26, 2021
Encryption/Decryption for React Native

@dhairyasharma/react-native-encryption Encryption/decryption for React Native. Benchmark File Details File Link http://bit.do/benchmarkfile File Size

Dhairya Sharma 5 Sep 13, 2022
Encryption/Decryption for React Native

@dhairyasharma/react-native-encryption Encryption/decryption for React Native. Benchmark File Details File Link http://bit.do/benchmarkfile File Size

Dhairya Sharma 5 Sep 13, 2022