npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-option-dropdown

v1.1.9

Published

react-native-option-dropdown is light weight dropdown for simple react native apps.

Downloads

17

Readme

react-native-option-dropdown

Demo 1 | Demo 2 :-------------------------:|:-------------------------: |

Why ?

This library is created in an attempt to provide a lightweight, simple and customizable dropdown solution for react native apps .

It try to solve the problem of having to install very heavy and big libraries for something as simple as a dropdown, as react native does not have any by default. this library is build by deafult react native tools so it's not dependent on other libraries.

It is so simple you can go to your project node_modules/react-native-option-dropdown/index.js and edit the code yourself and cusomize it even more. OR copy the code from there and use it anywhere as a component, no need to installing anything else. 🎉

Getting started 🤖

$ npm i react-native-option-dropdown

MacOS 🖥

CocoaPods on MacOS needs this extra step , Go to ios folder and run.

pod install

Usage 🛠

Import Dropdown from react-native-option-dropdown

import Dropdown from 'react-native-option-dropdown';

Create state which will be used by the Dropdown:

const [selectedItem, setSelectedItem] = useState(null);

Add Dropdown like this:

import { StyleSheet, Text, View } from 'react-native'
import React, {useState} from 'react';
import Dropdown from 'react-native-option-dropdown'

const App = () => {
    const [selectedItem, setSelectedItem] = useState(null);

    let data = [
        {id: 1, name: 'All'},
        {id: 2, name: 'Today'},
        {id: 3, name: 'Yesterday'},
        {id: 4, name: 'Current Week'},
      ];

      const onSelect = item=>{
        setSelectedItem(item);
        alert(item.name)
      } 
  return (
    <View style={{marginTop:'10%'}}>
          <Dropdown
          data={data}
          onSelect={onSelect}
          value={selectedItem}
          transparent ={false}
          alignList={'center'}
          fontSize={20}
          defaultText={"Please Select"}
          animationType={'slide'}
          DropdownWidth={'50%'}
          dropDownStyle ={
               {paddingVertical: 4,
               paddingHorizontal: 8,
               borderRadius: 3,
               minHeight: 32,
               justifyContent: 'space-between',
               flexDirection: 'row',
               alignItems: 'center',
               marginBottom: 8,
               borderColor: '#000',
               borderWidth: 0.5,
             overflow:'scroll' }
          }
        />
    </View>
  )
}

export default App

Props 🗝

Prop | Type | Optional | Default | Description ------------------- | -------- | -------- | --------- | ----------- data | Array of objects . (id: Key must be there in every object) as shown above | No | false | Data for the dropdown options. onSelect | Function | No | false | function that will run after selecting the option from dropdown. transparent | Bool | No | false |It will change the dropdown backround, will take true & false . value | String | No | false | It will take the value of state to show after selecting a option (as shown in the example above). alignList | String | No | false | It is for postion of dropdown list, will take tree options as string center , flex-end & flex-start. fontSize | Number | No | false | It will change the font size. animationType | String | No | false | The animationType prop controls how the modal animates. It will take three values none , slide & fade as String. defaultText | String | No | false | It is default text when nothing is selected. dropDownStyle | Object | No | false | This is for dropdown style. It will take any default React Native style .

Suggestions and feedback are welcome at [email protected] .