muba-input-text 9.0.2 → 9.0.3

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.
package/InputText.js CHANGED
@@ -30,6 +30,13 @@ export default class InputText extends React.Component {
30
30
  nl: require('./locales/nl.json')
31
31
  });
32
32
 
33
+ addFontList([
34
+ {
35
+ name: 'InputTextFontAwesome',
36
+ source: require('./fonts/Font-Awesome.ttf')
37
+ }
38
+ ]);
39
+
33
40
  this.state = {
34
41
  fieldError: false,
35
42
  requiredError: false,
@@ -41,24 +48,11 @@ export default class InputText extends React.Component {
41
48
  customizedError: false,
42
49
  customizedErrorMessage: undefined,
43
50
  inputFont: props.inputFont,
44
- noteFont: props.noteFont,
45
- fontLoaded: false
51
+ noteFont: props.noteFont
46
52
  };
47
53
  }
48
54
 
49
55
  async componentDidMount() {
50
- await addFontList([
51
- {
52
- name: 'InputTextRegular',
53
- source: require('./fonts/Poppins/Poppins-Regular.ttf')
54
- },
55
- {
56
- name: 'InputTextFontAwesome',
57
- source: require('./fonts/Font-Awesome.ttf')
58
- }
59
- ]);
60
- this.setState({ fontLoaded: true });
61
-
62
56
  if (this.props.autoFocus) {
63
57
  setTimeout(() => this.input.focus(), 100);
64
58
  }
@@ -225,73 +219,70 @@ export default class InputText extends React.Component {
225
219
 
226
220
  render() {
227
221
  return (
228
- this.state.fontLoaded ?
229
- <View
230
- style={[this.state.fieldError && this.props.label ? inputTextStyles.fieldErrorView : '', this.props.textContainerStyle]}
231
- ref={this.inputTextView}>
232
- {this.props.label || ((this.props.showErrorText == null || this.props.showErrorText) && this.state.fieldError) ?
233
- <View style={[this.props.label || this.state.fieldError ? { marginBottom: 10 } : '', this.props.inLineError ? inputTextStyles.row : '']}>
234
- {this.props.label ?
235
- <View style={inputTextStyles.row}>
236
- <OutputText style={[inputTextStyles.progressbarField, this.props.labelStyle]}>{this.props.label}</OutputText>
237
- {this.props.required ? <OutputText style={inputTextStyles.redText}> *</OutputText> : <OutputText />}
238
- </View>
239
- :
240
- <View />
241
- }
242
- {this.state.requiredError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('requiredField')}</OutputText> : null}
243
- {this.state.onlyNumbersError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('onlyNumbers')}</OutputText> : null}
244
- {this.state.maxValueError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('maxValueError', { maxValue: this.props.maxValue })}</OutputText> : null}
245
- {this.state.minValueError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('minValueError', { minValue: this.props.minValue })}</OutputText> : null}
246
- {this.state.emailBadFormat && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('emailBadFormat')}</OutputText> : null}
247
- {this.state.urlAllowingError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('urlAllowingError')}</OutputText> : null}
248
- {this.state.maxCharacters && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('maxCharacters', { maxCharacters: this.props.maxCharacters })}</OutputText> : null}
249
- {this.state.customizedError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {this.state.customizedErrorMessage}</OutputText> : null}
250
- </View>
251
- :
252
- <View style={{ marginTop: 10 }} />
253
- }
254
-
255
- <View style={(isRTL() && (this.props.language == null || this.props.language == 'AR')) || (!isRTL() && (this.props.language == null || this.props.language != 'AR')) ? inputTextStyles.row : inputTextStyles.rowReverse} collapsable={false}>
256
- <TextInput
257
- ref={(input) => { this.input = input; }}
258
- style={[inputTextStyles.textInputField, inputTextStyles.textField, this.props.style, { textAlign: (isRTL() && (this.props.language == null || this.props.language == 'AR')) || this.props.language == 'AR' ? 'right' : 'left' }, this.state.fieldError && !this.props.label ? inputTextStyles.fieldError : '', this.props.disabled ? inputTextStyles.disabled : '', this.props.multiline ? { paddingTop: 5 } : '']}
259
- underlineColorAndroid='transparent'
260
- keyboardType={this.props.keyboardType ? this.props.keyboardType : keyboardTypeMap[this.props.type ? this.props.type : 'default']}
261
- onChangeText={(text) => this.onChangeText(text)}
262
- onChange={(event) => this.onChange(event)}
263
- editable={this.props.disabled ? false : this.props.editable}
264
- value={this.props.value != null ? this.props.value.toString() : this.props.value}
265
- placeholder={this.props.placeholder ? (this.props.required && this.props.turnRequiredSign && isRTL() ? '* ' : '') + this.props.placeholder + (this.props.required && !this.props.turnRequiredSign ? ' *' : '') : ''}
266
- placeholderTextColor={this.props.placeholderTextColor ? this.props.placeholderTextColor : inputTextStyles.placeholderTextColor.color}
267
- returnKeyType={this.props.returnKeyType}
268
- onSubmitEditing={() => { this.onSubmitEditing() }}
269
- autoCapitalize={this.props.autoCapitalize ? this.props.autoCapitalize : null}
270
- secureTextEntry={this.props.secureTextEntry ? this.props.secureTextEntry : false}
271
- multiline={this.props.multiline}
272
- autoComplete={this.props.autoComplete}
273
- selection={this.props.selection}
274
- selectionColor={this.props.selectionColor}
275
- numberOfLines={this.props.numberOfLines}
276
- maxLength={this.props.maxLength}
277
- onFocus={this.props.onFocus}
278
- onBlur={this.props.onBlur} />
279
- {this.props.children}
280
-
281
- {this.props.value != null && !this.props.hideCancel ?
282
- this.props.disabled ?
283
- <View />
284
- :
285
- <TouchableOpacity style={[inputTextStyles.deleteTextInput, inputTextStyles.justifyCenter, this.props.iconContainerStyle]} onPress={() => { this.onChangeText('') }}>
286
- <FontAwesomeIcon style={[inputTextStyles.deleteTextIcon, this.props.iconStyle]} name='input-text-cancel' />
287
- </TouchableOpacity>
222
+ <View
223
+ style={[this.state.fieldError && this.props.label ? inputTextStyles.fieldErrorView : '', this.props.textContainerStyle]}
224
+ ref={this.inputTextView}>
225
+ {this.props.label || ((this.props.showErrorText == null || this.props.showErrorText) && this.state.fieldError) ?
226
+ <View style={[this.props.label || this.state.fieldError ? { marginBottom: 10 } : '', this.props.inLineError ? inputTextStyles.row : '']}>
227
+ {this.props.label ?
228
+ <View style={inputTextStyles.row}>
229
+ <OutputText style={[inputTextStyles.progressbarField, this.props.labelStyle]}>{this.props.label}</OutputText>
230
+ {this.props.required ? <OutputText style={inputTextStyles.redText}> *</OutputText> : <OutputText />}
231
+ </View>
288
232
  :
289
233
  <View />
290
234
  }
235
+ {this.state.requiredError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('requiredField')}</OutputText> : null}
236
+ {this.state.onlyNumbersError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('onlyNumbers')}</OutputText> : null}
237
+ {this.state.maxValueError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('maxValueError', { maxValue: this.props.maxValue })}</OutputText> : null}
238
+ {this.state.minValueError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('minValueError', { minValue: this.props.minValue })}</OutputText> : null}
239
+ {this.state.emailBadFormat && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('emailBadFormat')}</OutputText> : null}
240
+ {this.state.urlAllowingError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('urlAllowingError')}</OutputText> : null}
241
+ {this.state.maxCharacters && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {strings('maxCharacters', { maxCharacters: this.props.maxCharacters })}</OutputText> : null}
242
+ {this.state.customizedError && (this.props.showErrorText == null || this.props.showErrorText) ? <OutputText style={[inputTextStyles.subNote, inputTextStyles.redText]}> {this.state.customizedErrorMessage}</OutputText> : null}
291
243
  </View>
292
- </View >
293
- :
294
- <View />
244
+ :
245
+ <View style={{ marginTop: 10 }} />
246
+ }
247
+
248
+ <View style={(isRTL() && (this.props.language == null || this.props.language == 'AR')) || (!isRTL() && (this.props.language == null || this.props.language != 'AR')) ? inputTextStyles.row : inputTextStyles.rowReverse} collapsable={false}>
249
+ <TextInput
250
+ ref={(input) => { this.input = input; }}
251
+ style={[inputTextStyles.textInputField, inputTextStyles.textField, this.props.style, { textAlign: (isRTL() && (this.props.language == null || this.props.language == 'AR')) || this.props.language == 'AR' ? 'right' : 'left' }, this.state.fieldError && !this.props.label ? inputTextStyles.fieldError : '', this.props.disabled ? inputTextStyles.disabled : '', this.props.multiline ? { paddingTop: 5 } : '']}
252
+ underlineColorAndroid='transparent'
253
+ keyboardType={this.props.keyboardType ? this.props.keyboardType : keyboardTypeMap[this.props.type ? this.props.type : 'default']}
254
+ onChangeText={(text) => this.onChangeText(text)}
255
+ onChange={(event) => this.onChange(event)}
256
+ editable={this.props.disabled ? false : this.props.editable}
257
+ value={this.props.value != null ? this.props.value.toString() : this.props.value}
258
+ placeholder={this.props.placeholder ? (this.props.required && this.props.turnRequiredSign && isRTL() ? '* ' : '') + this.props.placeholder + (this.props.required && !this.props.turnRequiredSign ? ' *' : '') : ''}
259
+ placeholderTextColor={this.props.placeholderTextColor ? this.props.placeholderTextColor : inputTextStyles.placeholderTextColor.color}
260
+ returnKeyType={this.props.returnKeyType}
261
+ onSubmitEditing={() => { this.onSubmitEditing() }}
262
+ autoCapitalize={this.props.autoCapitalize ? this.props.autoCapitalize : null}
263
+ secureTextEntry={this.props.secureTextEntry ? this.props.secureTextEntry : false}
264
+ multiline={this.props.multiline}
265
+ autoComplete={this.props.autoComplete}
266
+ selection={this.props.selection}
267
+ selectionColor={this.props.selectionColor}
268
+ numberOfLines={this.props.numberOfLines}
269
+ maxLength={this.props.maxLength}
270
+ onFocus={this.props.onFocus}
271
+ onBlur={this.props.onBlur} />
272
+ {this.props.children}
273
+
274
+ {this.props.value != null && !this.props.hideCancel ?
275
+ this.props.disabled ?
276
+ <View />
277
+ :
278
+ <TouchableOpacity style={[inputTextStyles.deleteTextInput, inputTextStyles.justifyCenter, this.props.iconContainerStyle]} onPress={() => { this.onChangeText('') }}>
279
+ <FontAwesomeIcon style={[inputTextStyles.deleteTextIcon, this.props.iconStyle]} name='input-text-cancel' />
280
+ </TouchableOpacity>
281
+ :
282
+ <View />
283
+ }
284
+ </View>
285
+ </View >
295
286
  )
296
287
  }
297
288
  }
@@ -1,90 +1,90 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
3
  const Fonts = {
4
- Input: 'InputTextRegular',
5
- Note: 'InputTextRegular',
4
+ Input: 'Regular',
5
+ Note: 'Regular',
6
6
  }
7
7
 
8
8
  export const inputTextStyles = StyleSheet.create({
9
9
 
10
- row: {
11
- flexDirection: 'row'
12
- },
13
-
14
- rowReverse: {
15
- flexDirection: 'row-reverse'
16
- },
17
-
18
- progressbarField: {
19
- fontFamily: Fonts.Note,
20
- fontSize: 12,
21
- color: '#333',
22
- },
23
-
24
- redText: {
25
- color: '#cf1b1b'
26
- },
27
-
28
- subNote: {
29
- fontSize: 11,
30
- color: '#858585',
31
- fontFamily: Fonts.Note,
32
- textAlign: 'left'
33
- },
34
-
35
- fieldErrorView: {
36
- borderWidth: 2,
37
- borderColor: '#f1d8d8',
38
- borderRadius: 5,
39
- backgroundColor: '#f1d8d8'
40
- },
41
-
42
- fieldError: {
43
- borderWidth: 1,
44
- borderColor: '#ff0000'
45
- },
46
-
47
- disabled: {
48
- opacity: 0.4
49
- },
50
-
51
- placeholderTextColor: {
52
- color: '#bbbbbb'
53
- },
54
-
55
- deleteTextInput: {
56
- position: 'absolute',
57
- paddingRight: 10,
58
- paddingLeft: 10,
59
- right: 0,
60
- top: 8
61
- },
62
-
63
- deleteTextIcon: {
64
- fontSize: 16,
65
- color: '#858585'
66
- },
67
-
68
- justifyCenter: {
69
- justifyContent: 'center'
70
- },
71
-
72
- textField: {
73
- fontSize: 14,
74
- fontFamily: Fonts.Input,
75
- width: '100%',
76
- display: 'flex',
77
- height: 35,
78
- backgroundColor: '#eff0f1',
79
- color: '#333',
80
- paddingLeft: 15,
81
- borderRadius: 5,
82
- padding: 0
83
- },
84
-
85
- textInputField: {
86
- paddingRight: 25,
87
- }
10
+ row: {
11
+ flexDirection: 'row'
12
+ },
13
+
14
+ rowReverse: {
15
+ flexDirection: 'row-reverse'
16
+ },
17
+
18
+ progressbarField: {
19
+ fontFamily: Fonts.Note,
20
+ fontSize: 12,
21
+ color: '#333',
22
+ },
23
+
24
+ redText: {
25
+ color: '#cf1b1b'
26
+ },
27
+
28
+ subNote: {
29
+ fontSize: 11,
30
+ color: '#858585',
31
+ fontFamily: Fonts.Note,
32
+ textAlign: 'left'
33
+ },
34
+
35
+ fieldErrorView: {
36
+ borderWidth: 2,
37
+ borderColor: '#f1d8d8',
38
+ borderRadius: 5,
39
+ backgroundColor: '#f1d8d8'
40
+ },
41
+
42
+ fieldError: {
43
+ borderWidth: 1,
44
+ borderColor: '#ff0000'
45
+ },
46
+
47
+ disabled: {
48
+ opacity: 0.4
49
+ },
50
+
51
+ placeholderTextColor: {
52
+ color: '#bbbbbb'
53
+ },
54
+
55
+ deleteTextInput: {
56
+ position: 'absolute',
57
+ paddingRight: 10,
58
+ paddingLeft: 10,
59
+ right: 0,
60
+ top: 8
61
+ },
62
+
63
+ deleteTextIcon: {
64
+ fontSize: 16,
65
+ color: '#858585'
66
+ },
67
+
68
+ justifyCenter: {
69
+ justifyContent: 'center'
70
+ },
71
+
72
+ textField: {
73
+ fontSize: 14,
74
+ fontFamily: Fonts.Input,
75
+ width: '100%',
76
+ display: 'flex',
77
+ height: 35,
78
+ backgroundColor: '#eff0f1',
79
+ color: '#333',
80
+ paddingLeft: 15,
81
+ borderRadius: 5,
82
+ padding: 0
83
+ },
84
+
85
+ textInputField: {
86
+ paddingRight: 25,
87
+ }
88
88
  });
89
89
 
90
90
  export default inputTextStyles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-input-text",
3
- "version": "9.0.2",
3
+ "version": "9.0.3",
4
4
  "description": "Input text",
5
5
  "main": "InputText.js",
6
6
  "scripts": {
Binary file