Skip to content

fix(android): use ViewCompat.setStateDescription for API < 30 compat#606

Merged
lodev09 merged 2 commits intolodev09:mainfrom
Mohamed-kassim:fix/grabber-view-compat-api30
Mar 18, 2026
Merged

fix(android): use ViewCompat.setStateDescription for API < 30 compat#606
lodev09 merged 2 commits intolodev09:mainfrom
Mohamed-kassim:fix/grabber-view-compat-api30

Conversation

@Mohamed-kassim
Copy link
Contributor

@Mohamed-kassim Mohamed-kassim commented Mar 17, 2026

Problem

TrueSheetGrabberView.updateAccessibilityValue() calls View.stateDescription directly, which was added in API 30 (Android 11). On Android 10 and below, this causes a fatal NoSuchMethodError crash on every sheet present:

NoSuchMethodError: No virtual method setStateDescription(Ljava/lang/CharSequence;)V
in class Lcom/lodev09/truesheet/core/TrueSheetGrabberView;

Introduced in #587 (v3.10.0-beta.0), still present in v3.10.0-beta.2.

Fix

Replace the direct stateDescription = ... assignment with ViewCompat.setStateDescription(this, description), which handles the API check internally (no-op on API < 30, delegates to the platform method on API 30+).

Impact

In our production app (Tarteel, ~1M users), this caused 100+ affected users and 389+ crash events within 1 hours of shipping a release with v3.10.0-beta.1.

`View.stateDescription` (added in API 30) is called directly in
`TrueSheetGrabberView.updateAccessibilityValue()`, causing a fatal
`NoSuchMethodError` on Android 10 and below on every sheet present.

Replace with `ViewCompat.setStateDescription()` which is a no-op on
API < 30 and works identically on API 30+.

Introduced in lodev09#587 (v3.10.0-beta.0), still present in beta.2.
@vercel
Copy link

vercel bot commented Mar 17, 2026

@Mohamed-kassim is attempting to deploy a commit to the Jovanni's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-true-sheet Ready Ready Preview, Comment Mar 18, 2026 5:57pm

Request Review

Copy link
Owner

@lodev09 lodev09 left a comment

Choose a reason for hiding this comment

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

Thanks!

@lodev09 lodev09 merged commit 7c5e882 into lodev09:main Mar 18, 2026
6 checks passed
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