muba-input-text 4.1.2 → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/InputText.js +14 -2
  2. package/package.json +1 -1
package/InputText.js CHANGED
@@ -56,6 +56,10 @@ export default class InputText extends React.Component {
56
56
  }
57
57
  ]);
58
58
  this.setState({ fontLoaded: true });
59
+
60
+ if (this.props.autoFocus) {
61
+ setTimeout(() => this.input.focus(), 100);
62
+ }
59
63
  }
60
64
 
61
65
  isValidUrl(url) {
@@ -111,6 +115,9 @@ export default class InputText extends React.Component {
111
115
  }
112
116
 
113
117
  validateType() {
118
+ if (this.props.value != null && this.props.value !== this.props.value?.toString().trim()) {
119
+ this.onChangeText(this.props.value.toString().trim())
120
+ }
114
121
  if (this.props.type === 'email') {
115
122
  return this.isValidEmail();
116
123
  } else if (this.props.type === 'number') {
@@ -208,6 +215,12 @@ export default class InputText extends React.Component {
208
215
  this.input.focus();
209
216
  }
210
217
 
218
+ checkText = () => {
219
+ if (this.props.value !== this.props.value?.trim()) {
220
+ this.onChangeText(this.props.value.trim())
221
+ }
222
+ }
223
+
211
224
  render() {
212
225
  return (
213
226
  this.state.fontLoaded ?
@@ -258,8 +271,7 @@ export default class InputText extends React.Component {
258
271
  selection={this.props.selection}
259
272
  selectionColor={this.props.selectionColor}
260
273
  numberOfLines={this.props.numberOfLines}
261
- maxLength={this.props.maxLength}
262
- autoFocus={this.props.autoFocus} />
274
+ maxLength={this.props.maxLength} />
263
275
  {this.props.children}
264
276
 
265
277
  {this.props.value != null && !this.props.hideCancel ?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-input-text",
3
- "version": "4.1.2",
3
+ "version": "4.1.5",
4
4
  "description": "Input text",
5
5
  "main": "InputText.js",
6
6
  "scripts": {