Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

select field in react native

// https://www.npmjs.com/package/react-native-picker-select
// npm install react-native-picker-select

//# React Native users
//npm install @react-native-picker/picker
//npx pod-install

//# Expo
//expo install @react-native-picker/picker
import RNPickerSelect from 'react-native-picker-select';

export const Dropdown = () => {
    return (
        <RNPickerSelect
            onValueChange={(value) => console.log(value)}
            items={[
                { label: 'Football', value: 'football' },
                { label: 'Baseball', value: 'baseball' },
                { label: 'Hockey', value: 'hockey' },
            ]}
        />
    );
};
Comment

react native select option

// use this package easy to use and more flexible 
https://www.npmjs.com/package/react-native-element-dropdown

 yarn add react-native-element-dropdown
Comment

react native select

// noice library to use with react native paper

import { PaperSelect } from 'react-native-paper-select';

// ...

const [colors, setColors] = useState({
  value: '',
  list: [
    { _id: '1', value: 'BLUE' },
    { _id: '2', value: 'RED' },
    { _id: '3', value: 'GREEN' },
    { _id: '4', value: 'YELLOW' },
    { _id: '5', value: 'BROWN' },
    { _id: '6', value: 'BLACK' },
    { _id: '7', value: 'WHITE' },
    { _id: '8', value: 'CYAN' },
  ],
  selectedList: [],
  error: '',
});

<PaperSelect
  label="Select Colors"
  value={colors.value}
  onSelection={(value: any) => {
    setColors({
      ...colors,
      value: value.text,
      selectedList: value.selectedList,
      error: '',
    });
  }}
  arrayList={[...colors.list]}
  selectedArrayList={colors.selectedList}
  errorText={colors.error}
  multiEnable={true}
  textInputMode="flat"
  searchStyle={{ iconColor: 'red' }}
/>;
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to play audio in javascript 
Javascript :: puppeteer headless 
Javascript :: node js response header 
Javascript :: repeat an array multiple times in js 
Javascript :: open modal useState 
Javascript :: how to remove property from object javascript 
Javascript :: react native float upto 2 digits 
Javascript :: js datetime format 
Javascript :: jquery wait for function to finish 
Javascript :: react navigation history clear 
Javascript :: create an element jquery 
Javascript :: text.toUpperCase is not a function 
Javascript :: discord.js guildMemberRemove 
Javascript :: express receive post data 
Javascript :: js base64 encoding 
Javascript :: new Date() get speicifc hours min sec 
Javascript :: js add array to array 
Javascript :: node js check if called from module 
Javascript :: how to do joins in sequelize and select things from the third table 
Javascript :: generate random color array javascript 
Javascript :: regex data 
Javascript :: how to remove an object from an array javascript 
Javascript :: base href angular 
Javascript :: debouncing javascript 
Javascript :: converting object to an array in javascript 
Javascript :: render XML in node 
Javascript :: reverse method 
Javascript :: angular 8 filter array of objects by property 
Javascript :: vue js tutorial 
Javascript :: how to add d3.js in angular 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =