react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

Fix default back button not appearing when removing header left

Open janicduplessis opened this issue 1 month ago • 0 comments

Description

When using a header left view and then removing it the default back button doesn't reappear on new arch. This is because we do not call updateViewControllerIfNeeded when removing views.

Changes

Call updateViewControllerIfNeeded in unmountChildComponentView.

Test code and steps to reproduce

In the FabricExample HeaderOptions example:

  • Open Header item setting
  • Choose left
  • Choose right
  • See the back button is gone.
image image image

When toggling state the default back button doesn't reappear.

Checklist

  • [x] Included code example that can be used to test this change
  • [ ] Updated TS types
  • [ ] Updated documentation:
    • [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md
    • [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md
    • [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx
    • [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx
  • [x] Ensured that CI passes

janicduplessis avatar Jul 04 '24 17:07 janicduplessis