Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

283
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda