Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not overcast to
ReactEditText
(#776)
## 📜 Description Cast to base `EditText` class whenever it's possible. ## 💡 Motivation and Context If you deal with native SDKs (i. e. Stripe), then in such SDKs they may inherit their component from native `EditText` and simply expose them to JS layer. Casting to `ReactEditText` will eventually fail and part of this library will not be working (everything about tracking focused input). So in this PR I decided to cast everything to `EditText`. Conditional casting will be only in two places `focus` method and in reflection in `addTextChangedListener`. But in the last method I still can get a crash: `Expected receiver of type com.facebook.react.views.textinput.ReactEditText, but got com.stripe.android.view.CardNumberEditText`, so to overcome this problem I decided to handle that exception and call original method. Resolves android issue in #775 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### Android - cast to `EditText` instead of `ReactEditText` whenever it's possible; - handle `IllegalArgumentException` in `addOnTextChangedListener`. ## 🤔 How Has This Been Tested? Tested on Medium Phone API 35 emulator. ## 📸 Screenshots (if appropriate): Sorry, but emulator is really laggy 😬 https://github.com/user-attachments/assets/08024fcc-6233-4fca-97f9-d5c6dfdfc479 ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
- Loading branch information