bhrott / react-native-masked-text

A pure javascript masked text and input text component for React-Native.
MIT License
1.61k stars 249 forks source link

BUG: Obfuscated won't allow user to type in the full number #145

Closed CaffeinatedFunctionality closed 5 years ago

CaffeinatedFunctionality commented 5 years ago

For some reason Obfuscated: true will skip over the obfuscated numbers. I'm looking in to a fix as well as building an id mask and american phone number mask.

CaffeinatedFunctionality commented 5 years ago

Created the below test as an example `test('12341 obfuscated true results 1234 ', () => { var mask = new CreditCardMask() var expected = '1234 ' var received = mask.getValue('12341', { obfuscated: true })

expect(received).toBe(expected) })`

I was given this in return `Error: expect(received).toBe(expected) // Object.is equality

Expected: "1234 *" Received: "1234 1" at Object.toBe (/Users/taylormitchell/Documents/projects/react-native-masked-text/tests/mask/credit-card.mask.test.js:36:20) at Object.asyncJestTest (/Users/taylormitchell/Documents/projects/react-native-masked-text/node_modules/jest-jasmine2/build/jasmine_async.js:108:37) at resolve (/Users/taylormitchell/Documents/projects/react-native-masked-text/node_modules/jest-jasmine2/build/queue_runner.js:56:12) at new Promise () at mapper (/Users/taylormitchell/Documents/projects/react-native-masked-text/node_modules/jest-jasmine2/build/queue_runner.js:43:19) at promise.then (/Users/taylormitchell/Documents/projects/react-native-masked-text/node_modules/jest-jasmine2/build/queue_runner.js:87:41) at at process._tickCallback (internal/process/next_tick.js:118:7)`

This tells me something is definitely wrong with the obfuscation for the credit cards. Was this working in the past? If it did then it is now broken.

bhrott commented 5 years ago

Obfuscated just let the user to add the first 4 and the last 4.