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

RefreshControl IndexOutOfBoundsException: getChildDrawingOrder() crash #2329

Closed
BenIrving opened this issue Sep 2, 2024 · 0 comments · Fixed by #2330
Closed

RefreshControl IndexOutOfBoundsException: getChildDrawingOrder() crash #2329

BenIrving opened this issue Sep 2, 2024 · 0 comments · Fixed by #2330
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided

Comments

@BenIrving
Copy link
Contributor

Description

In Screen.kt we have this check
if (child.javaClass.simpleName.equals("CircleImageView")) {

However, when we minify our code the class name is obfuscated and this check never returns true and we run into the same IndexOutOfBoundsException this check and corresponding code was added to avoid (link)

CircleImageView is a private class within androidx.swiperefreshlayout.widget therefore we cannot do a direct class comparison. A work around is to stop minification of this class by adding the following to pro guard rules

-keepnames class androidx.swiperefreshlayout.widget.CircleImageView

This is obviously a hacky workaround, and we should instead change the check. CircleImageView extends ImageView therefore we can add a safe, minification safe check to resolve the original issue, and this bug.

if (parent is SwipeRefreshLayout && child is ImageView) {

Steps to reproduce

  1. Build example app in release mode
  2. Navigate between screens
  3. Observe IndexOutOfBoundsException due to the CircleImageView child of SwipeRefreshLayout

Snack or a link to a repository

https://github.com/BenIrving/refreshcontrolrepro/tree/main

Screens version

3.24.0

React Native version

0.74.5

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided Platform: Android This issue is specific to Android labels Sep 2, 2024
@tboba tboba closed this as completed in d424e1a Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant