Coder Social home page Coder Social logo

zestime / react-native-select-pro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mobilereality/react-native-select-pro

1.0 0.0 0.0 1.56 MB

React Native select / dropdown customizable component

Home Page: https://mobilereality.github.io/react-native-select-pro/

License: MIT License

JavaScript 7.33% TypeScript 92.67%

react-native-select-pro's Introduction

React Native Select Pro

React Native select / dropdown customizable component


Version GitHub stars npm total downloads npm week downloads Last master branch commit License

Features

  • Customizable
  • Android / iOS / Expo supported
  • TypeScript supported

Example

Expo Snack

Example on Expo

Video preview

react-native-select-pro-preview-demo.mp4

Repo

Clone this repo and next:

cd example
yarn install
yarn android #run example app for Android
yarn ios #run example app for iOS

Documentation

https://mobilereality.github.io/react-native-select-pro/

Getting Started

Installation

npm install @mobile-reality/react-native-select-pro

or

yarn add @mobile-reality/react-native-select-pro

Usage

Firstly, wrap your app code in SelectProvider

import React from 'react';
import { SelectProvider } from '@mobile-reality/react-native-select-pro';

const RootComponent = () => {
  return (
    <SelectProvider>
      {/* rest of your app code */}
    </SelectProvider>
  )
};

Then you can use Select component

import React from 'react';
import { View } from 'react-native';
import { Select } from '@mobile-reality/react-native-select-pro';

const SomeComponent = () => {
  return (
    <View>
      <Select {/* One required prop: `options` */}
        options={[{ value: 'somevalue', label: 'somelabel'}]} 
      />
    </View>
  )
};

If you want to use Select component inside Modal from react-native (or react-native-modal) you need to wrap code inside Modal in SelectModalProvider

import React from 'react';
import { View, Modal, Text } from 'react-native';
import { Select, SelectModalProvider } from '@mobile-reality/react-native-select-pro';

const SomeComponent = () => {
  return (
    <View>
      <Modal> {/* `Modal` from `react-native` or `react-native-modal` */}
        <SelectModalProvider> {/* `SelectModalProvider` wrapping code inside `Modal` */}
          <Text>Modal</Text>
          <Select
            options={[{ value: 'somevalue', label: 'somelabel' }]}
          />
        </SelectModalProvider>
      </Modal>
    </View>
  )
};

Thanks

Contributing

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

License

MIT

react-native-select-pro's People

Contributors

irekrog avatar gitsad avatar zestime avatar koko57 avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.