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

Fix native ActivityIndicator not being shown on Android #50

Merged

Conversation

pklatka
Copy link
Collaborator

@pklatka pklatka commented Nov 5, 2023

On Android native progressView/ActivityIndicator was not visible when opening slow loading page. It was caused by react-native behavior: to achieve performance, not all native components are being re-laid. Also manually re-laying the progressView in onLayout didin't work as expected. A fix from here solved this issue.

Comment on lines +203 to +214
override fun requestLayout() {
super.requestLayout()
post(measureAndLayout)
}

private val measureAndLayout = Runnable {
measure(
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
)
layout(left, top, right, bottom)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to add a comment describing why this code has been added?

@pklatka pklatka merged commit 83594be into software-mansion-labs:main Nov 17, 2023
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.

2 participants