@@ -187,10 +187,38 @@ function EditTokenSceneComponent(props: Props) {
187
187
}
188
188
} )
189
189
190
+ const renderCustomTokenTemplateRows = ( ) => {
191
+ return customTokenTemplate
192
+ . sort ( ( a , b ) => ( a . key === 'contractAddress' ? - 1 : 1 ) )
193
+ . map ( item => {
194
+ if ( item . type === 'nativeAmount' ) return null
195
+ return (
196
+ < FilledTextInput
197
+ key = { item . key }
198
+ aroundRem = { 0.5 }
199
+ autoCapitalize = "none"
200
+ autoCorrect = { false }
201
+ autoFocus = { false }
202
+ placeholder = { translateDescription ( item . displayName ) }
203
+ keyboardType = { item . type === 'number' ? 'numeric' : 'default' }
204
+ value = { location . get ( item . key ) ?? '' }
205
+ onChangeText = { value =>
206
+ setLocation ( location => {
207
+ const out = new Map ( location )
208
+ out . set ( item . key , value . replace ( / \s / g, '' ) )
209
+ return out
210
+ } )
211
+ }
212
+ />
213
+ )
214
+ } )
215
+ }
216
+
190
217
return (
191
218
< SceneWrapper avoidKeyboard >
192
219
< SceneHeader title = { tokenId == null ? lstrings . title_add_token : lstrings . title_edit_token } underline />
193
220
< ScrollView style = { styles . scroll } contentContainerStyle = { styles . scrollContainer } scrollIndicatorInsets = { SCROLL_INDICATOR_INSET_FIX } >
221
+ { renderCustomTokenTemplateRows ( ) }
194
222
< FilledTextInput
195
223
aroundRem = { 0.5 }
196
224
autoCapitalize = "characters"
@@ -209,28 +237,6 @@ function EditTokenSceneComponent(props: Props) {
209
237
value = { displayName }
210
238
onChangeText = { setDisplayName }
211
239
/>
212
- { customTokenTemplate . map ( item => {
213
- if ( item . type === 'nativeAmount' ) return null
214
- return (
215
- < FilledTextInput
216
- key = { item . key }
217
- aroundRem = { 0.5 }
218
- autoCapitalize = "none"
219
- autoCorrect = { false }
220
- autoFocus = { false }
221
- placeholder = { translateDescription ( item . displayName ) }
222
- keyboardType = { item . type === 'number' ? 'numeric' : 'default' }
223
- value = { location . get ( item . key ) ?? '' }
224
- onChangeText = { value =>
225
- setLocation ( location => {
226
- const out = new Map ( location )
227
- out . set ( item . key , value . replace ( / \s / g, '' ) )
228
- return out
229
- } )
230
- }
231
- />
232
- )
233
- } ) }
234
240
< FilledTextInput
235
241
aroundRem = { 0.5 }
236
242
autoCorrect = { false }
0 commit comments