@@ -2,15 +2,15 @@ import React, {Component} from 'react';
2
2
import { ScrollView , StyleSheet , Alert } from 'react-native' ;
3
3
import { Colors , Typography , View , Text , TextField , TextArea , Modal , Button } from 'react-native-ui-lib' ; //eslint-disable-line
4
4
import { KeyboardAwareInsetsView } from 'react-native-keyboard-tracking-view' ;
5
+ import { Navigation } from 'react-native-navigation' ;
5
6
6
-
7
- const richText = require ( '../../assets/icons/richText.png' ) ;
8
- const dropDown = require ( '../../assets/icons/chevronDown.png' ) ;
9
- const star = require ( '../../assets/icons/star.png' ) ;
7
+ const richText = require ( '../../../assets/icons/richText.png' ) ;
8
+ const dropDown = require ( '../../../assets/icons/chevronDown.png' ) ;
9
+ const star = require ( '../../../assets/icons/star.png' ) ;
10
10
const LONG_TEXT =
11
11
'Concept, edition and design direction for the editorial piece “La Forma Bruta” by the photographer' +
12
12
'Martín Bollati. In this piece' ;
13
- const transformPrice = ( value ) => {
13
+ const transformPrice = value => {
14
14
let cleanValue ;
15
15
let priceText = '' ;
16
16
if ( value ) {
@@ -27,12 +27,11 @@ export default class InputsScreen extends Component {
27
27
28
28
this . state = {
29
29
error : '' ,
30
- topError : false ,
31
30
customExpandableValue : 'Custom Expandable'
32
31
} ;
33
32
}
34
33
35
- onChangeText = ( text ) => {
34
+ onChangeText = text => {
36
35
let message = '' ;
37
36
if ( text === '' ) {
38
37
message = 'This field is mandatory' ;
@@ -41,22 +40,17 @@ export default class InputsScreen extends Component {
41
40
message = 'Please enter a valid text' ;
42
41
}
43
42
this . setState ( { error : message } ) ;
44
- }
45
-
46
- onButtonPressed = ( ) => {
47
- const { topError} = this . state ;
48
- this . setState ( { topError : ! topError } ) ;
49
- }
43
+ } ;
50
44
51
45
onPressInfo = ( ) => {
52
46
Alert . alert ( 'Info button pressed' ) ;
53
- }
47
+ } ;
54
48
55
49
onPress = ( ) => {
56
50
this . setState ( { customExpandableValue : 'New Value' } , ( ) => {
57
51
this . input . toggleExpandableModal ( false ) ;
58
52
} ) ;
59
- }
53
+ } ;
60
54
61
55
renderExpandable = ( ) => {
62
56
return (
@@ -65,20 +59,13 @@ export default class InputsScreen extends Component {
65
59
< Text marginB-20 text50 >
66
60
Do Whatever you want here
67
61
</ Text >
68
- < Button
69
- label = "Close Me"
70
- onPress = { this . onPress }
71
- />
62
+ < Button label = "Close Me" onPress = { this . onPress } />
72
63
</ View >
73
64
</ Modal >
74
65
) ;
75
- }
66
+ } ;
76
67
77
68
render ( ) {
78
- const { topError} = this . state ;
79
- const state = topError ? 'On' : 'Off' ;
80
- const btnLabel = `Top Errors: ${ state } ` ;
81
-
82
69
return (
83
70
< View flex >
84
71
< ScrollView
@@ -90,23 +77,13 @@ export default class InputsScreen extends Component {
90
77
< Text style = { { marginBottom : 20 , marginRight : 20 } } text40 >
91
78
Inputs
92
79
</ Text >
93
- < Button
94
- style = { { height : 28 , alignSelf : 'flex-start' , marginBottom : 20 } }
95
- outline = { ! topError }
96
- size = "small"
97
- label = { btnLabel }
98
- onPress = { this . onButtonPressed }
99
- />
100
80
101
81
< TextField
102
82
text70
103
83
containerStyle = { { marginBottom : INPUT_SPACING } }
104
84
floatingPlaceholder
105
- placeholder = "FloatingPlaceholder & validator "
85
+ placeholder = "FloatingPlaceholder"
106
86
onChangeText = { this . onChangeText }
107
- validate = { 'required' }
108
- errorMessage = { 'Required field!' }
109
- useTopErrors = { this . state . topError }
110
87
floatOnFocus
111
88
/>
112
89
@@ -130,8 +107,6 @@ export default class InputsScreen extends Component {
130
107
placeholder = "With helperText"
131
108
helperText = "this is an helper text"
132
109
onChangeText = { this . onChangeText }
133
- error = { this . state . error }
134
- useTopErrors = { this . state . topError }
135
110
/>
136
111
137
112
< TextField
@@ -151,8 +126,6 @@ export default class InputsScreen extends Component {
151
126
maxLength = { 3 }
152
127
showCharacterCounter
153
128
onChangeText = { this . onChangeText }
154
- error = { this . state . error }
155
- useTopErrors = { this . state . topError }
156
129
/>
157
130
158
131
< TextField
@@ -162,11 +135,9 @@ export default class InputsScreen extends Component {
162
135
titleStyle = { { fontSize : Typography . text70 . fontSize } }
163
136
placeholder = "Multiline & titleStyle"
164
137
multiline
165
- maxLength = { 32 }
138
+ maxLength = { 150 }
166
139
showCharacterCounter
167
140
onChangeText = { this . onChangeText }
168
- error = { this . state . error }
169
- useTopErrors = { this . state . topError }
170
141
autoCapitalize = "words"
171
142
/>
172
143
@@ -189,7 +160,6 @@ export default class InputsScreen extends Component {
189
160
placeholder = "Underline colors & error"
190
161
onChangeText = { this . onChangeText }
191
162
error = { this . state . error }
192
- useTopErrors = { this . state . topError }
193
163
underlineColor = { { focus : Colors . purple50 , error : Colors . yellow60 } }
194
164
/>
195
165
@@ -213,7 +183,7 @@ export default class InputsScreen extends Component {
213
183
containerStyle = { { marginBottom : INPUT_SPACING } }
214
184
placeholder = "Share your story"
215
185
value = {
216
- " Share Your Story exists to provide spaces to hear people's stories, in order to inspire us to" +
186
+ ' Share Your Story exists to provide spaces to hear people\ 's stories, in order to inspire us to' +
217
187
'live better ones ourselves.'
218
188
}
219
189
multiline
@@ -262,7 +232,7 @@ export default class InputsScreen extends Component {
262
232
multiline
263
233
rightButtonProps = { { iconSource : richText , onPress : this . onPressInfo , iconColor : Colors . red30 } }
264
234
/>
265
-
235
+
266
236
< TextField
267
237
text70
268
238
containerStyle = { { marginBottom : INPUT_SPACING } }
@@ -280,7 +250,9 @@ export default class InputsScreen extends Component {
280
250
rightIconSource = { dropDown }
281
251
/>
282
252
283
- < Text dark10 marginB-5 > Text Area</ Text >
253
+ < Text dark10 marginB-5 >
254
+ Text Area
255
+ </ Text >
284
256
< View
285
257
style = { {
286
258
height : 150 ,
@@ -343,3 +315,5 @@ const styles = StyleSheet.create({
343
315
marginVertical : 20
344
316
}
345
317
} ) ;
318
+
319
+ Navigation . registerComponent ( 'unicorn.components.InputsScreen' , ( ) => InputsScreen ) ;
0 commit comments