Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

react-native-dropdown-picker

#go to the wesite and read the docs
Web_link: https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/
    
#sample: 
#installation
npm install react-native-dropdown-picker

const [facultyOpen, setFacultyOpen] = useState(false);
const [facultyValue, setFacultyValue] = useState('electrical');
const [faculty, setFaculty] = useState([
    { label: 'Electrical & Computer Engineering', value: 'electrical' },
    { label: 'Civil Engineering', value: 'civil' },
    { label: 'Mechanical Engineering', value: 'mechanical' },
]);
#after-return
#used tailwind for style. delete all tw`` part if you don't use tailwind css
<View style={[tw`mb-3 z-50`]}>
          <Text
            style={[
              tw`font-semibold text-purple-600 ml-1 mb-1`,
              { fontSize: 18 },
            ]}
          >
            Faculty
          </Text>
          <DropDownPicker
            open={facultyOpen}
            value={facultyValue}
            items={faculty}
            setValue={setFacultyValue}
            setItems={setFaculty}
            setOpen={setFacultyOpen}
            style={[tw`bg-gray-200 w-full px-4 py-3 border-0`]}
            containerStyle={[tw`border-0 bg-gray-200 rounded-lg`]}
            dropDownContainerStyle={[
              tw``,
              {
                backgroundColor: '#E5E7EB',
                borderRadius: 10,
                zIndex: 1,
                borderWidth: 0,
              },
            ]}
          />
        </View>
Comment

react-native-dropdown-picker for form react native

import React, { useState } from 'react';
import SelectPicker from 'react-native-form-select-picker'; // Import the package
//...
const options = ["Apple", "Banana", "Orange"];
const YourComponent = ({ /* your props */ }) => {
	const [selected, setSelected] = useState();
	return (
		//...

		<SelectPicker
			onValueChange={(value) => {
				// Do anything you want with the value. 
				// For example, save in state.
				setSelected(value);
			}}
			selected={selected}
			>
			
			{Object.values(options).map((val, index) => (
				<SelectPicker.Item label={val} value={val} key={index} />
			))}

		</SelectPicker>

		//...
	)
}
Comment

react native dropdown

// well designed multi select works with native base

import MultiSelectInput from 'native-base-select';

// ...

const [language, setLanguage] = React.useState({
  value: '',
  list: [
    { _id: 1, name: 'Hindi' },
    { _id: 2, name: 'English' },
    { _id: 3, name: 'Bengali' },
    { _id: 4, name: 'Marathi' },
    { _id: 5, name: 'Telugu' },
    { _id: 6, name: 'Tamil' },
    { _id: 7, name: 'Gujarati' },
    { _id: 8, name: 'Urdu' },
    { _id: 9, name: 'Kannada' },
    { _id: 10, name: 'Odia' },
    { _id: 11, name: 'Malayalam' },
    { _id: 12, name: 'Punjabi' },
    { _id: 13, name: 'Assamese' },
    { _id: 14, name: 'Maithili' },
    { _id: 15, name: 'Sanskrit' },
    { _id: 16, name: 'Nepali' },
    { _id: 17, name: 'Dzongkha' },
    { _id: 18, name: 'Bhojpuri' },
    { _id: 19, name: 'Tibetan' },
    { _id: 20, name: 'Sinhalese' },
    { _id: 21, name: 'Khasi' },
  ],
  selectedList: [],
  error: '',
});

<MultiSelectInput
  label="Language"
  placeholder="Select at least 2 Language"
  value={language.value}
  list={language.list}
  selectedList={language.selectedList}
  onSelection={(value: any) => {
    setLanguage({
      ...language,
      value: value.text,
      selectedList: value.selectedList,
      error: '',
    });
  }}
  errorText={language.error}
/>;
Comment

PREVIOUS NEXT
Code Example
Python :: extract all capital words dataframe 
Python :: vscode python workding directory 
Python :: Converting Dataframe from the multi-dimensional list with column name 
Python :: group by 2 columns pandas 
Python :: which function to use in random module for a list in python 
Python :: np ln 
Python :: convert all numbers in list to string python 
Python :: video capture opencv and multiprocessing 
Python :: request.build_absolute_uri django 
Python :: Python Frozenset() for Dictionary 
Python :: convert 2d aray into 1d using python 
Python :: python turn off garbage collection 
Python :: python ssl 
Python :: wav file to array python 
Python :: transformers bert 
Python :: text animation python 
Python :: private instance attribute python 
Python :: how to use dictionary in python 
Python :: python list replace nan with 0 
Python :: start python server 
Python :: jointplot title 
Python :: convex hull python 
Python :: pip install pandas Getting requirements to build wheel 
Python :: python random select no replace 
Python :: python json to dict 
Python :: create python executable 
Python :: how to take array as input in python 
Python :: python access each group 
Python :: permutation python 
Python :: Jinja for items in list 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =