Skip to content

Commit 1226357

Browse files
author
Ben-hur Santos Ott
authored
Merge pull request #139 from benhurott/1.12.0
1.12.0
2 parents 5556de5 + 754cddf commit 1226357

File tree

11 files changed

+123
-5491
lines changed

11 files changed

+123
-5491
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
## Unreleased
44

5+
## [1.12.0] - 2019-04-07
6+
7+
### Added
8+
9+
- Adding `rawText` in `onChangeText`. (Thanks to [questionablequestion](https://github.com/questionablequestion))
10+
11+
### Fixed
12+
13+
- Fixing return type of `getRawValue` in `ts definition`. (Thanks to [gabelerner](https://github.com/gabelerner))
14+
15+
### Changed
16+
17+
- Improving component initialization. (Thanks to [rsouthgate](https://github.com/rsouthgate))
18+
519
## [1.11.1] - 2019-03-05
620

721
### Fixed

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
copy-to-test:
2-
rm -rf ../rn-test/react-native-masked-text
3-
npm run clean
4-
npm run build
5-
cp -R dist ../rn-test/react-native-masked-text
1+
copy-to-samples:
2+
rm -rf /Users/ben/Documents/dev/react-native-masked-text-samples/ReactNativeMaskedTextSamples/lib
3+
mkdir /Users/ben/Documents/dev/react-native-masked-text-samples/ReactNativeMaskedTextSamples/lib
4+
cp -R lib /Users/ben/Documents/dev/react-native-masked-text-samples/ReactNativeMaskedTextSamples

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,26 @@ const unmasked = this.zipCodeField.getRawValue()
592592
// unmasked: 98765321
593593
```
594594

595+
### ... Utils
595596

597+
#### Including the `rawText` in `onChangeText` [1.12.0+]
598+
599+
If you need the raw value in every text change, you can use the `includeRawValueInChangeText`.
600+
601+
It will provide the masked and the raw text in every text change.
602+
603+
```jsx
604+
<TextInputMask
605+
type={'cpf'}
606+
value={this.state.value}
607+
includeRawValueInChangeText={true}
608+
onChangeText={(maskedText, rawText) => {
609+
// maskedText: 123.456.789-01
610+
// rawText: 12345678901
611+
}}
612+
/>
613+
```
596614

597-
### ... Utils
598615

599616
#### Getting the `TextInput` instance
600617
If you want to get the `TextInput` raw component, use the `getElement()` method:

dist/lib/base-text-component.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/text-input-mask.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,19 @@ export interface TextInputMaskOptionProp {
4646
// Custom type.
4747
mask?: string
4848
validator?: (value: string, settings: TextInputMaskOptionProp) => boolean
49-
getRawValue?: (value: string, settings: TextInputMaskOptionProp) => boolean
49+
getRawValue?: (value: string, settings: TextInputMaskOptionProp) => any
5050
translation?: { [s: string]: (val: string) => string | null | undefined }
51+
52+
// Options
53+
includeRawValueInChangeText?: boolean
5154
}
5255

5356
// TextInputMask Props
54-
export interface TextInputMaskProps extends TextInputProps {
57+
export interface TextInputMaskProps extends Pick<TextInputProps, Exclude<keyof TextInputProps, 'onChangeText'>> {
5558
type: TextInputMaskTypeProp
5659
options?: TextInputMaskOptionProp
5760
checkText?: (previous: string, next: string) => boolean
58-
onChangeText?: (text: string) => void
61+
onChangeText?: (text: string, rawText?: string) => void
5962
refInput?: (ref: any) => void
6063
customTextInput?: any
6164
customTextInputProps?: Object

0 commit comments

Comments
 (0)