Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UIViewBox Implementation #1543

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Add UIViewBox Implementation #1543

merged 1 commit into from
Oct 10, 2023

Conversation

underscoretang
Copy link
Collaborator

@underscoretang underscoretang commented Sep 29, 2023

Here are some of the layouts that this creates
I had to do some custom coloring of things inside of the widgets that I won't make part of this commit. I think I'll follow up with adding a backgroundColor property to the Button widget inside of test-app, but hoping to lean on #1541 for full support

The blue background is the actual Box widget.
The green background is the Row that the Box is contained in
The elements inside the box have outlines and their own colors

Screen Shots
Simulator Screen Shot - iPhone 14 Pro - 2023-09-29 at 17 04 26 Simulator Screen Shot - iPhone 14 Pro - 2023-09-29 at 17 04 35
Simulator Screen Shot - iPhone 14 Pro - 2023-09-29 at 17 04 39 Simulator Screen Shot - iPhone 14 Pro - 2023-09-29 at 17 04 47

And this is how it looks without colors as a point of reference:

Simulator Screen Shot - iPhone 14 Pro - 2023-09-29 at 16 59 53

This was referenced Sep 29, 2023
@underscoretang
Copy link
Collaborator Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

},
remove = { index, count ->
val views = Array(count) {
typedSubviews[index].also(UIView::removeFromSuperview)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just to be safe, it can't hurt to bail early if index >= typedSubviews.size, and maybe throw an error rather than crashing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally our strategy has been to explode loudly on unexpected input. It gives bugs fewer places to hide!

Copy link
Collaborator

@dnagler dnagler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!

},
remove = { index, count ->
val views = Array(count) {
typedSubviews[index].also(UIView::removeFromSuperview)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally our strategy has been to explode loudly on unexpected input. It gives bugs fewer places to hide!

Copy link
Member

@colinrtwhite colinrtwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for taking this over

@underscoretang underscoretang merged commit 88c5f13 into trunk Oct 10, 2023
9 checks passed
@underscoretang underscoretang deleted the box/ui_view branch October 10, 2023 15:15
@JakeWharton JakeWharton mentioned this pull request Feb 26, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants