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

175
Vistas
Override React navigation SearchBar to add Segmented Control

Is there a way to Override the header in react navigation with Search Bar and Segmented control using React navigation without writing a fully custom header? I want to use the inbuilt search component provided by react navigation but add a segmented control when search is tapped. Also want the native large title style in iOS.

React navigation has an option to specify Search Options which shows a SearchBar but I am not sure if I can override this functionality. Refer to screenshot below:

Search with Segmented control

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

the best I could do was

    React.useEffect(() => {
        navigation.setOptions({
            headerTitle: () => {
                return <SegmentedControl style={{ width: 200, alignSelf: 'center' }}
                    values={['One', 'Two']}
                    selectedIndex={selectedIndex}
                    onChange={(event) => setSelectedIndex(event.nativeEvent.selectedSegmentIndex)}
                />
            },
        });
    });

this replaces the small header title with a segmented control. header animations and search bar still work.

later edit: i just realized, this is the native behavior as well (you can check it on ios in the recents tab, on the call screen). the segements replace the small header title :)

result video

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