fix: remove isLaidOut
check from copyBoundsInWindow
method
#275
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.
📜 Description
Removed
isLaidOut
check fromcopyBoundsInWindow
method.💡 Motivation and Context
When we are using
native-stack
then on initial mount the view propertyisLaidOut
will betrue
. When we open a new screen and return back to the previousisLaidOut
will befalse
.I've tried to call
invalidate
/requestLayout
/forceLayout
methods inonAttachedToWindow
method, but it doesn't seem to have any effect at all.Then I decided to compare how
copyBoundsInWindow
works ifisLaidOut
check is removed. And turned out there is no difference between two executions:So taking this information into consideration I've decided to remove that check.
Also for the sake of safety and avoidance of unexpected crashes I decided to remove
throw Exception
construction and replace it with a simple logger (since I'm not handling exceptions in my code it's better to log it).Closes #274 #203
📢 Changelog
Android
isLaidOut
check fromcopyBoundsInWindow
method;🤔 How Has This Been Tested?
Tested on Pixel 7 Pro (android 14).
📸 Screenshots (if appropriate):
telegram-cloud-document-2-5381959313151507275.mp4
📝 Checklist