[ANDROID] Crash if placeholder is selected and deleted
Closed this issue · 3 comments
sclavijo93 commented
It's possible to select the placeholder and if its deleted the app crashes
Screen.Recording.2022-01-18.at.10.41.43.mov
Logs
FATAL EXCEPTION: main
Process: com.mangopayment.mangoapp.dev, PID: 8217
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
at com.inkind.RNMoneyInput.MoneyMask$Companion.unmask(RNMoneyInputModule.kt:119)
at com.inkind.RNMoneyInput.MoneyTextWatcher.onTextChanged(RNMoneyInputModule.kt:174)
at com.inkind.RNMoneyInput.MoneyTextListener.onTextChanged(RNMoneyInputModule.kt:70)
at com.facebook.react.views.textinput.ReactEditText$TextWatcherDelegator.onTextChanged(ReactEditText.java:1074)
at android.widget.TextView.sendOnTextChanged(TextView.java:10578)
at android.widget.TextView.handleTextChanged(TextView.java:10685)
at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:13568)
at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1267)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:576)
at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:230)
at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:37)
at android.text.method.BaseKeyListener.deleteSelection(BaseKeyListener.java:433)
at android.text.method.BaseKeyListener.backspaceOrForwardDelete(BaseKeyListener.java:328)
at android.text.method.BaseKeyListener.backspace(BaseKeyListener.java:71)
at android.text.method.BaseKeyListener.onKeyDown(BaseKeyListener.java:479)
at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:362)
at com.facebook.react.views.textinput.ReactEditText$InternalKeyListener.onKeyDown(ReactEditText.java:1128)
at android.widget.TextView.doKeyDown(TextView.java:8466)
at android.widget.TextView.onKeyDown(TextView.java:8240)
at android.view.KeyEvent.dispatch(KeyEvent.java:2842)
at android.view.View.dispatchKeyEvent(View.java:14247)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at com.facebook.react.ReactRootView.dispatchKeyEvent(ReactRootView.java:234)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959)
at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:476)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1861)
at android.app.Activity.dispatchKeyEvent(Activity.java:4085)
at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:558)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:2814)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:390)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5947)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5815)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5518)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5676)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3179)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2721)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2712)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3156)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:143)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
```
</details>
sclavijo93 commented
I also found that if I the state starts not empty (let's assume 20,000) and the placeholder is undefined then I delete the numbers until the state gets empty it crashes.
20,000 <-
2,000 <-
200 <-
20 <-
2 <-
crash
NathHorrigan commented
This should now be fixed with this WIP branch, can you confirm?
npm i --save --force https://github.com/inKindCards/react-native-money#hotfix/non-fractional-currencies
sclavijo93 commented
I've tested on Android and iOS and it works great!