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

expo-select-dropdown

v1.1.3

Published

Expo / React Native Select Dropdown with search and other customizations

Downloads

223

Readme

| | | | | | |--------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | NPM VERSION | NPM WEEKLY DOWNLOADS | GITHUB STAR | LICENSE | NPM LIFETIME DOWNLOADS |

npm install expo-select-dropdown

OR

yarn add expo-select-dropdown

| Without Filters | With Fitlers | |------------------|--------------------------| | | |

    import {SelectDropdown, DropdownData} from "expo-select-dropdown";
    
    export default function App() {  
     const [selected, setSelected] = useState<DropdownData<string, string> | null>(null);  
     const [data] = useState<DropdownData<string, string>[]>([  
          {key: "1", value: "Toothbrush"}, 
          {key: "2", value: "Laptop"}, 
          {key: "3", value: "Sunglasses"},  
	      {key: "4", value: "Baseball"}, 
	      {key: "5", value: "Scissors"}, 
	      {key: "6", value: "Bicycle"},  
	      {key: "7", value: "Camera"}, 
	      {key: "8", value: "Umbrella"}, 
	      {key: "9", value: "Backpack"},  
	      {key: "10", value: "Water bottle"}  
     ]);
       
     return (  
          <SelectDropdown  
		      data={data}  
              placeholder={"Select option"}  
              selected={selected}  
              setSelected={setSelected}  
              searchOptions={{cursorColor: "#007bff"}}  
              searchBoxStyles={{borderColor: "#007bff"}}  
              dropdownStyles={{borderColor: "#007bff"}}  
          />  
      );  
    }
export default function App() {
    const [selected, setSelected] = useState<DropdownData<string, string> | null>(null);
    const data = [
        {key: "1", value: "Toothbrush", location: "Bathroom", date: "2021-05-01", time: "12:00"},
        {key: "2", value: "Laptop", location: "Bathroom", date: "2021-05-01", time: "12:00"},
        {key: "3", value: "Sunglasses", location: "Bedroom", date: "2021-05-01", time: "12:00"},
        {key: "4", value: "Baseball", location: "Bathroom", date: "2021-05-01", time: "12:00"},
        {key: "5", value: "Scissors", location: "Bedroom", date: "2021-06-01", time: "1:00"},
        {key: "6", value: "Bicycle", location: "Bedroom", date: "2021-05-01", time: "12:00"},
        {key: "7", value: "Camera", location: "Bathroom", date: "2021-06-01", time: "1:00"},
        {key: "8", value: "Umbrella", location: "Bedroom", date: "2021-06-01", time: "12:00"},
        {key: "9", value: "Backpack", location: "Bathroom", date: "2021-05-01", time: "1:00"},
        {key: "10", value: "Water bottle", location: "Bedroom", date: "2021-06-01", time: "12:00"},
    ]
    const [tags] = useState<TagData[]>([
        {key: "1", name: "Location", onFilter: () => {
            return data.filter((item) => item.location.toLowerCase().includes("Bathroom".toLowerCase()));
        }},
        {key: "2", name: "Date", onFilter: () => {
            return data.filter((item) => item.date.toLowerCase().includes("2021-05-01".toLowerCase()));
        }},
        {key: "3", name: "Time", onFilter: () => {
            return data.filter((item) => item.time.toLowerCase().includes("12:00".toLowerCase()));
        }}
    ])

    return (
        <View style={styles.container}>
            <SelectDropdown
                data={data.map((item) => {return {key: item.key, value: item.value}})}
                tags={tags}
                placeholder={"Select option"}
                selected={selected}
                setSelected={setSelected}
                searchOptions={{cursorColor: "#007bff"}}
                searchBoxStyles={{borderColor: "#007bff"}}
                dropdownStyles={{borderColor: "#007bff"}}
            />
        </View>
    );
}
interface SelectDropdownProps {  
    data: DropdownData<any, any>[]  
    placeholder: string  
    selected: DropdownData<any, any> | null  
    setSelected: (selected: DropdownData<any, any>) => void
    tags?: TagData[]
    searchOptions?: TextInputProps  
    searchBoxStyles?: ViewStyle  
    dropdownStyles?: ViewStyle
}
interface TagData {
    key: any;
    name: string;
    onFilter: () => DropdownData<any, any>[] | undefined;
}

Work In Progress

  • [x] Filter option added for searching items (optional)
  • [x] Tags for the filters
  • [x] Improved default styling
  • [ ] Restrict breaking styling options
  • [ ] Make search setting optional
  • [ ] Dependency clean up