Send componentType field in componentDidAppear and componentDidDisappear events.
The new field is either:
- TopBarButton
- TopBarTitle
- TopBarBackground
- Component
Prevent creation of button react view with the same componentId (#5687)
When updating buttons with mergeOptions, existing custom buttons are unmounted and then recreated. This commit adds an optimisation which prevents the react components from being recreated.
To avoid unnecessary recreation, add an `id` to the component. If an existing react view is found for that id, it will be reused.
Use autolayout constraints to set size of custom bar button item (#4732)
This fixes an issue where the frame for the custom view can be set to the incorrect y-offset upon setting the custom frame.
In iOS 11, this behavior changed, as UIBarButtonItem went from being using springs-and-struts for sizing, to using a UIStackView, and thus using Autolayout.
This lead to the superview of having a frame of (0, 22, 0, 0) at the first layout pass.
By moving to using NSLayoutConstaints, we can now properly size our custom view.
See also: https://gist.github.com/niw/569b49648f
See also: https://stackoverflow.com/questions/10988918/change-width-of-a-uibarbuttonitem-in-a-uinavigationbar