[Fix] searchBar `focus:` true ignored on mergeOptions when searchController already exists
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- ios, objective-c, react-native
- Área
- mobile
Línea de trabajo
Comienza en UIViewController+RNNOptions.mm, en setSearchBarWithOptions:, comparando el flujo del controlador existente con el flujo de creación inicial. Verifica el flujo de mergeOptions en una pantalla con un controlador de búsqueda existente y, después, ejecuta las pruebas relevantes de iOS o reproduce los pasos para cambiar entre pestañas. Se considera terminado cuando focus: true vuelve a enfocar la barra de búsqueda después de mergeOptions sin cambiar el comportamiento de la creación inicial.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug
When calling Navigation.mergeOptions() with topBar.searchBar.focus: true on a screen that already has a search controller, the focus is silently ignored. The search bar only auto-focuses on initial creation (first applyOptions), never on subsequent mergeOptions calls.
Current Behaviour
setSearchBarWithOptions: in UIViewController+RNNOptions.mm only handles focus inside the if (!self.navigationItem.searchController) branch (initial creation). The else branch (existing search controller) skips focus entirely.
Expected Behaviour
mergeOptions with focus: true should refocus the search bar even when the search controller already exists. This is needed for re-focusing the search bar when the screen reappears (e.g., switching back to a bottom tab).
Steps to Reproduce
- Register a screen with
searchBar: { visible: true, focus: true }in static options - Screen mounts — search bar is focused (correct)
- Navigate away from the screen (e.g., switch tabs)
- Navigate back and call
Navigation.mergeOptions(componentId, { topBar: { searchBar: { visible: true, focus: true } } }) - Search bar is not focused
Proposed Fix
Add focus handling in the else branch of setSearchBarWithOptions::
} else {
// ... existing iOS 26 placement code ...
if (focus) {
dispatch_async(dispatch_get_main_queue(), ^{
self.navigationItem.searchController.active = true;
[self.navigationItem.searchController.searchBar becomeFirstResponder];
});
}
}
Environment
- react-native-navigation: 8.8.2
- React Native: 0.85.3
- iOS 18+
- Lenguaje dominante
- MDX
- Estrellas
- 13.2k
- Forks
- 2.6k
- Merge medio
- 2 d 10 h
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wix/react-native-navigation
-
needs triage triage: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
wix/react-native-navigation#8343 · 1 comentario ·
-
Build Failed with RN 0.87Abiertoneeds triage type: accepted/bug
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
wix/react-native-navigation#8365 · 2 comentarios ·
-
`showOverlay` creates a scene-less `UIWindow`, so overlays never appear under UIScene lifecyclePosiblemente ocupada @yedidyak la tomó hace 3 días. Abiertoplatform: iOS type: accepted/bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
wix/react-native-navigation#8345 · 2 comentarios · 2 reacciones ·
-
platform: iOS type: accepted/bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
wix/react-native-navigation#8340 ·
-
platform: iOS type: accepted/bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
wix/react-native-navigation#8339 ·
Todos los issues de wix/react-native-navigation
Issues similares
-
移动端下载页实时吞吐与筛选栏滚动层级不一致Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MaikuB/flutter_local_notifications#2866 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
appandflow/stim#5258 ·
Los mantenedores suelen responder en 1 día