fix(ios): improve menu view child component handling#7
Merged
sbaiahmed1 merged 2 commits intomainfrom Oct 30, 2025
Merged
Conversation
properly clean up menu button and restore disabled views when unmounting track disabled views in a set to avoid duplicate state changes
Reviewer's GuideThis PR enhances MenuView by introducing explicit state tracking for child button overlays, automating the disabling and restoration of user interaction on nested views, centralizing menu button cleanup logic, and integrating these processes into mount, unmount, and deallocation phases. Sequence diagram for mounting and unmounting child component views in MenuViewsequenceDiagram
participant MenuView
participant ChildView
participant MenuButton
participant DisabledViews
MenuView->>ChildView: mountChildComponentView()
alt If replacing old child view
MenuView->>MenuView: cleanupMenuButton()
MenuView->>MenuView: restoreUserInteractionForDisabledViews()
end
MenuView->>ChildView: setupChildViewAsMenuTrigger()
MenuView->>DisabledViews: disableUserInteractionRecursively()
MenuView->>ChildView: unmountChildComponentView()
MenuView->>MenuView: cleanupMenuButton()
MenuView->>MenuView: restoreUserInteractionForDisabledViews()
Sequence diagram for MenuView deallocation cleanupsequenceDiagram
participant MenuView
participant MenuButton
participant DisabledViews
MenuView->>MenuView: dealloc()
MenuView->>MenuView: cleanupMenuButton()
MenuView->>MenuView: restoreUserInteractionForDisabledViews()
Class diagram for updated MenuView child component handlingclassDiagram
class MenuView {
UIColor *_textColor
UIColor *_checkedColor
UIColor *_uncheckedColor
BOOL _isChildViewButton
NSMutableSet<UIView *> *_disabledViews
UIView *_childView
UIButton *_menuButton
NSArray *_menuItems
+mountChildComponentView(UIView<RCTComponentViewProtocol> *childComponentView, NSInteger index)
+unmountChildComponentView(UIView<RCTComponentViewProtocol> *childComponentView, NSInteger index)
+setupChildViewAsMenuTrigger(UIView *childView)
+disableUserInteractionRecursively(UIView *view)
+restoreUserInteractionForDisabledViews()
+cleanupMenuButton()
+dealloc()
+updateProps(Props::Shared const &props, Props::Shared const &oldProps)
}
MenuView --> UIButton
MenuView --> UIView
MenuView --> "*" UIView : disabledViews
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `ios/MenuView.mm:23` </location>
<code_context>
UIColor *_checkedColor;
UIColor *_uncheckedColor;
+ BOOL _isChildViewButton;
+ NSMutableSet<UIView *> *_disabledViews;
}
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Consider using NSHashTable for weak references to views.
NSMutableSet keeps strong references, which may cause memory leaks if views are not properly removed. NSHashTable with weak objects prevents this by allowing views to be deallocated automatically.
Suggested implementation:
```
NSHashTable<UIView *> *_disabledViews;
```
```
_disabledViews = [NSHashTable weakObjectsHashTable];
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…d views Use NSHashTable with weak references to prevent memory leaks when views are deallocated. Add safety checks during iteration to handle weak references properly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
properly clean up menu button and restore disabled views when unmounting track disabled views in a set to avoid duplicate state changes
Summary by Sourcery
Improve MenuView’s child component handling by centralizing cleanup logic for menu buttons and disabled subviews, ensuring consistent state restoration and preventing duplicate updates.
Enhancements: