Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

multi 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

multi select

// 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
Typescript :: react tailwind css components npm 
Typescript :: react inherit html input props 
Typescript :: eloquent fetch documents specific date 
Typescript :: angular cancel http request 
Typescript :: split dict into multiple dicts python 
Typescript :: ipywidgets hide widget 
Typescript :: outside click hook react 
Typescript :: convert c# class to typescript 
Typescript :: How can I call a method every x seconds? 
Typescript :: Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0 
Typescript :: how to compile ts in cmd 
Typescript :: mailbox exists c# 
Typescript :: compare two lists and find at least one equal python 
Typescript :: Unshift type Typescript 
Typescript :: No type arguments expected for interface Callback 
Typescript :: int sum. 
Typescript :: c# to typescript 
Typescript :: c# merge two lists different types 
Typescript :: nuxtServerInit nuxt 3 
Typescript :: how to show code conflicts in git 
Typescript :: 8.1.3. Varying Data Types&para; Arrays 
Typescript :: s3.bucket objects filter top 10 
Typescript :: check if all array elements match closure swift 
Typescript :: how to get an object from array of objects in java 
Typescript :: how to implement loudspeaker in web development 
Typescript :: phaser load progress 
Typescript :: nullable parameter typescript 
Typescript :: take two inputs from user and add them using callback function 
Typescript :: get ols regression results with for loop for dataframe against a constant 
Typescript :: firewalld list ports redbat 8 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =