question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Backspace not properly removing characters on both iOS and Android

See original GitHub issue

Bug report

Summary

I’ve just added this module to my project in order to support masks. However, I’ve noticed an issue when I use the backspace on both iOS and Android that the character is not properly erased. I’m not sure the issue is due to this library or due to the RedMadRobot/input-mask library.

I do reproduce this issue on both iOS and Android.

This is a screen recording of the issue:

File from iOS

Environment info

react-native info output:

SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.0
      System Images: android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-R | Google Play Intel x86 Atom
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

Library version: 2.0.0

Reproducible sample code

Just a regular use of the text input.

<TextInput
      placeholder="([000]) [000]-[00]-[00]"
      mask="([000]) [000]-[00]-[00]"
/>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
NeerajNegicommented, Jul 15, 2020

It can be done as @asfaarahmed suggested but it’s a workaround and not a fix. I think fixing the backspace issue for formatted value is the best way.

0reactions
asfaarahmedcommented, Jul 15, 2020

What if we want to store the formatted text. If this is the case then it won’t work with the current way. Is there any fix to use formatted text in both input and state?

import React, { Component, useContext } from ‘react’; import TextInputMask from ‘react-native-text-input-mask’;

export default function testClass() { const [valueE, setValueE] = React.useState(“”) const [valueF, setValueF] = React.useState(“”)

<TextInputMask refInput={ref => { this.input = ref }} onChangeText={(formatted, extracted) => { setValueE(extracted); setValueF(formatted); }} value={valueE} keyboardType={‘numeric’} mask={“([000]) [000]-[0000]”} placeholder=“Phone No” placeholderTextColor=“#525252” keyboardType={‘numeric’} />

//save valueF in db…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backspace not properly removing characters on both iOS and ...
However, I've noticed an issue when I use the backspace on both iOS and Android that the character is not properly erased.
Read more >
Obscure Text Makes Backspace Remove Two Characters at a ...
The app works without an issue in iOS and seems to work correctly with the Swiftkey Keyboard, but I am experiencing issues with...
Read more >
Why do Android and iOS keyboards only have a backspace ...
The obvious answer is that they both perform a similar function, but the backspace key is used far more often. Think about it…...
Read more >
LatinIME: fails to delete pre-existing characters ... - Issue Tracker
In the Android 4.4 branch of LatinIME, there is a regression in the backspace key handling that prevents users from deleting existing texts ......
Read more >
Ipad issues with Bluetooth keyboards and iOS 7
For some reason, my backspace key has starting to work like a delete key (i.e. deleting characters after the cursor, not before) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found