Skip to content

RefreshControl IndexOutOfBoundsException: getChildDrawingOrder() crash #2329

@BenIrving

Description

@BenIrving

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidThis issue is specific to AndroidRepro providedA reproduction with a snack or repo is provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions