input-mask-android
input-mask-android copied to clipboard
fix ConcurrentModificationException when other text watchers are installed
I experienced this in a react-native app when using another library, LogRocket, which globally scans for text views to install their own text watcher for analytics purposes.
And along with react-native, I have these installed as well:
- react-native-text-input-mask, which uses this library.
- @logrocket/react-native, which installs its own text watcher on all edit text views.
What triggers the crash is:
- when the React Native text component loops over an iterator
- this library's
afterTextChangedis called which modifies the list while it's being iterated - there are any other text watchers (e.g. LogRocket) that come after this one in the list.
- the iterator will try to fetch its next element, which fails with
ConcurrentModificationExceptionduring the check for comodification.
If not for (3), the crash is avoided.
With this PR, I was able to substitute this library out for a patched one and confirmed it fixes the issue.
Let me know if you need anything else.