GithubHelp home page GithubHelp logo

just-the-v / react-native-simple-dropdown-picker Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 1.73 MB

A simple, and fully customizable drop down picker for react native.

Home Page: https://www.npmjs.com/package/react-native-simple-dropdown-picker

License: MIT License

JavaScript 100.00%
react-native component dropdown

react-native-simple-dropdown-picker's Introduction

react-native-simple-dropdown-picker

A simple, and fully customizable drop down picker.

Installation

Npm

npm install react-native-simple-dropdown-picker

Yarn

yarn add react-native-simple-dropdown-picker

Usage

You can see real example of DropDownPicker in the test app

import DropDownPicker from 'react-native-simple-dropdown-picker';

const MySimpleComponent = () => {
	const [value, setValue] = useState('');
	const data = ['Hello', 'World'];
	return (
		<DropDownPicker
			result={value}
			setResult={setValue}
			data={data}
			placeholder={'Choose an option'}
		/>
	);	
}

Config

Props

Name Type Default Value Description
result string or number null (required) State where you will place the result value picked (required)
setResult function null (required) Function to mutate result
data array [] (required) Possible value to result. Can be an array of value or an object like {id, value}
placeholder string First value of data Text to display if the value is not initialized
animatedIcon component <Image source={require('../assets/images/img.png')} /> Component to display at the right of the text

Style Props

Name Default Value Description Screenshot
wrapperStyle {} View wrapper
resultTextStyle {fontSize: 17} Text display in the input box
inputStyle {borderRadius: 40, paddingHorizontal: 20,height: 40,flexDirection: 'row',justifyContent: 'space-between',alignContent: 'center',alignItems: 'center',borderWidth: 1,} Touchable Opacity for display the dropdown
focusedInputStyle {} Style added on inputStyle when the dropdown is displayed ONLY
flatListStyle {flexGrow: 0,width: '90%',alignSelf: 'center',borderBottomRightRadius: 20,borderBottomLeftRadius: 20} FlatList.style that contains the values of data
flatListContainerStyle {paddingTop: 10,borderBottomRightRadius: 20,borderBottomLeftRadius: 20} FlatList.contentContainerStyle for the dropdown
touchableStyle {paddingHorizontal: 20,paddingVertical: 10,} TouchableOpacity that contain an extracted value of data
textStyle {fontSize: 16,marginLeft: 10,} Text that display an extracted value of data

react-native-simple-dropdown-picker's People

Contributors

just-the-v avatar

Stargazers

danGbe 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.