Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Cómo tener una barra de búsqueda en la base nativa del componente "Seleccionar"

Me encantaría tener una barra de búsqueda en el componente "Seleccionar" de la base nativa de la biblioteca en react-native.

He intentado agregar un componente "TextInput" dentro del componente "Seleccionar". En la interfaz de usuario, se alinea perfectamente, pero cuando hago clic en "TextInput", se selecciona y la lista se despliega.

El siguiente es el código que probé:

 <Select w={w} h={h} variant="outline" selectedValue={selectedValue} minWidth="200" // borderColor={primaryColor} accessibilityLabel={accessibilityLabel?accessibilityLabel: "Choose Service" } placeholder={placeholder?placeholder: "Choose Service"} _selectedItem={{ bg:"coolGray.200", // endIcon: <CheckIcon size="5" /> }} mt={1} onValueChange={onValueChange} > <Input placeholder="Search" variant="filled" width="100%" h={heightPercentageToDP("6%")} borderRadius="10" py="1" px="2" borderWidth="0" /> { data?.map(item => { return( <Select.Item label={item.label} value={item.value} /> ) }) } </Select>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El cuadro de Select de base nativa tiene prop _actionSheetBody, contiene IFlatListProps para que pueda usar ListHeaderComponent allí. Entonces puede usar de esta manera.

  1. Utiliza un estado para guardar el valor de búsqueda:

    const [searchValue, setSearchValue] = React.useState<string>('');

  2. Editar cuadro de selección

`

 <Select w={w} h={h} variant="outline" selectedValue={selectedValue} minWidth="200" accessibilityLabel={accessibilityLabel?accessibilityLabel: "Choose Service" } placeholder={placeholder?placeholder: "Choose Service"} _selectedItem={{ bg:"coolGray.200", // endIcon: <CheckIcon size="5" /> }} mt={1} onValueChange={onValueChange} _actionSheetBody={{ ListHeaderComponent: <FormControl px={3} mb={3}> <Input px={15} py={2} fontSize={16} value={searchValue} placeholder="" _focus={{ bg: colors.white['50'], borderColor: 'darkBlue.600' }} type='text' onChangeText={(value: string) => { setSearchValue(value); }} /> </FormControl> }} > <Input placeholder="Search" variant="filled" width="100%" h={heightPercentageToDP("6%")} borderRadius="10" py="1" px="2" borderWidth="0" /> { (data && data.length)?data.filter((item)=>{ // you filter with searchValue return true; }).map(item => { return( <Select.Item label={item.label} value={item.value} /> ) }) } </Select>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!