Skip to content

Commit 1fdec3f

Browse files
committed
Integrate KavButton into FiatPluginEnterAmountScene
1 parent 43dbfd7 commit 1fdec3f

File tree

2 files changed

+122
-133
lines changed

2 files changed

+122
-133
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Unreleased (develop)
44

55
- added: Additional user information fields for Kado OTC orders
6+
- added: KeyboardAccessoryView-based `KavButton`
7+
- changed: `FiatPluginEnterAmountScene` next button to use `KavButton`
68

79
## 4.29.0 (staging)
810

src/plugins/gui/scenes/FiatPluginEnterAmountScene.tsx

Lines changed: 120 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import { Image, TextStyle, View } from 'react-native'
55

66
import { ButtonsView } from '../../../components/buttons/ButtonsView'
77
import { PoweredByCard } from '../../../components/cards/PoweredByCard'
8-
import { EdgeAnim, fadeInDown30, fadeInDown60, fadeInDown90, fadeInUp30, fadeInUp60, fadeInUp90 } from '../../../components/common/EdgeAnim'
8+
import { EdgeAnim, fadeInDown30, fadeInDown60, fadeInUp30, fadeInUp60 } from '../../../components/common/EdgeAnim'
99
import { SceneWrapper } from '../../../components/common/SceneWrapper'
10-
import { SectionView } from '../../../components/layout/SectionView'
10+
import { KavButton } from '../../../components/keyboard/KavButton'
11+
import { SceneContainer } from '../../../components/layout/SceneContainer'
1112
import { showError } from '../../../components/services/AirshipInstance'
1213
import { cacheStyles, Theme, useTheme } from '../../../components/services/ThemeContext'
1314
import { EdgeText } from '../../../components/themed/EdgeText'
1415
import { FilledTextInput } from '../../../components/themed/FilledTextInput'
15-
import { MainButton } from '../../../components/themed/MainButton'
16-
import { SceneHeader } from '../../../components/themed/SceneHeader'
1716
import { useHandler } from '../../../hooks/useHandler'
1817
import { useWatch } from '../../../hooks/useWatch'
1918
import { lstrings } from '../../../locales/strings'
@@ -187,133 +186,126 @@ export const FiatPluginEnterAmountScene = React.memo((props: Props) => {
187186
const poweredByIconPath = poweredBy != null ? getPartnerIconUri(poweredBy.poweredByIcon) : undefined
188187

189188
return (
190-
<SceneWrapper scroll keyboardShouldPersistTaps="handled" hasNotifications hasTabs>
191-
<EdgeAnim enter={fadeInUp90}>
192-
<SceneHeader style={styles.sceneHeader} title={headerTitle} underline withTopMargin>
193-
{headerIcon}
194-
</SceneHeader>
195-
</EdgeAnim>
196-
<SectionView>
197-
<View style={styles.container}>
198-
{swapInputLocations ? (
199-
<View style={styles.textFields}>
200-
<EdgeAnim enter={fadeInUp60}>
201-
<FilledTextInput
202-
disabled={disableInput === 2}
203-
numeric
204-
maxDecimals={6}
205-
autoCorrect={false}
206-
autoFocus
207-
autoCapitalize="none"
208-
keyboardType="decimal-pad"
209-
placeholder={label2}
210-
onChangeText={handleChangeText2}
211-
onSubmitEditing={handleSubmit}
212-
returnKeyType="done"
213-
showSpinner={spinner2}
214-
textsizeRem={1.5}
215-
value={value2 ?? '0'}
216-
verticalRem={0.5}
217-
/>
218-
</EdgeAnim>
219-
<EdgeAnim enter={fadeInUp30}>
220-
<FilledTextInput
221-
disabled={disableInput === 1}
222-
numeric
223-
maxDecimals={2}
224-
autoCorrect={false}
225-
autoFocus={false}
226-
autoCapitalize="none"
227-
keyboardType="decimal-pad"
228-
placeholder={label1}
229-
onChangeText={handleChangeText1}
230-
onSubmitEditing={handleSubmit}
231-
returnKeyType="done"
232-
showSpinner={spinner1}
233-
textsizeRem={1.5}
234-
value={value1 ?? '0'}
235-
verticalRem={0.5}
236-
/>
237-
</EdgeAnim>
238-
{onMax != null ? (
239-
<View style={styles.maxButton}>
240-
<ButtonsView
241-
tertiary={{
242-
label: lstrings.string_max_cap,
243-
onPress: handleMax
244-
}}
189+
<>
190+
<SceneWrapper scroll keyboardShouldPersistTaps="handled" hasNotifications hasTabs>
191+
<SceneContainer headerTitle={headerTitle} headerTitleChildren={headerIcon}>
192+
<View style={styles.container}>
193+
{swapInputLocations ? (
194+
<View style={styles.textFields}>
195+
<EdgeAnim enter={fadeInUp60}>
196+
<FilledTextInput
197+
disabled={disableInput === 2}
198+
numeric
199+
maxDecimals={6}
200+
autoCorrect={false}
201+
autoFocus
202+
autoCapitalize="none"
203+
keyboardType="decimal-pad"
204+
placeholder={label2}
205+
onChangeText={handleChangeText2}
206+
onSubmitEditing={handleSubmit}
207+
returnKeyType="done"
208+
showSpinner={spinner2}
209+
textsizeRem={1.5}
210+
value={value2 ?? '0'}
211+
verticalRem={0.5}
212+
/>
213+
</EdgeAnim>
214+
<EdgeAnim enter={fadeInUp30}>
215+
<FilledTextInput
216+
disabled={disableInput === 1}
217+
numeric
218+
maxDecimals={2}
219+
autoCorrect={false}
220+
autoFocus={false}
221+
autoCapitalize="none"
222+
keyboardType="decimal-pad"
223+
placeholder={label1}
224+
onChangeText={handleChangeText1}
225+
onSubmitEditing={handleSubmit}
226+
returnKeyType="done"
227+
showSpinner={spinner1}
228+
textsizeRem={1.5}
229+
value={value1 ?? '0'}
230+
verticalRem={0.5}
231+
/>
232+
</EdgeAnim>
233+
{onMax != null ? (
234+
<View style={styles.maxButton}>
235+
<ButtonsView
236+
tertiary={{
237+
label: lstrings.string_max_cap,
238+
onPress: handleMax
239+
}}
240+
/>
241+
</View>
242+
) : null}
243+
</View>
244+
) : (
245+
<View style={styles.textFields}>
246+
<EdgeAnim enter={fadeInUp60}>
247+
<FilledTextInput
248+
disabled={disableInput === 1}
249+
numeric
250+
maxDecimals={2}
251+
autoCorrect={false}
252+
autoFocus
253+
autoCapitalize="none"
254+
keyboardType="decimal-pad"
255+
placeholder={label1}
256+
onChangeText={handleChangeText1}
257+
returnKeyType="done"
258+
showSpinner={spinner1}
259+
textsizeRem={1.5}
260+
value={value1 ?? '0'}
261+
verticalRem={0.5}
245262
/>
246-
</View>
247-
) : null}
248-
</View>
249-
) : (
250-
<View style={styles.textFields}>
251-
<EdgeAnim enter={fadeInUp60}>
252-
<FilledTextInput
253-
disabled={disableInput === 1}
254-
numeric
255-
maxDecimals={2}
256-
autoCorrect={false}
257-
autoFocus
258-
autoCapitalize="none"
259-
keyboardType="decimal-pad"
260-
placeholder={label1}
261-
onChangeText={handleChangeText1}
262-
onSubmitEditing={handleSubmit}
263-
returnKeyType="done"
264-
showSpinner={spinner1}
265-
textsizeRem={1.5}
266-
value={value1 ?? '0'}
267-
verticalRem={0.5}
268-
/>
263+
</EdgeAnim>
264+
<EdgeAnim enter={fadeInUp30}>
265+
<FilledTextInput
266+
disabled={disableInput === 2}
267+
numeric
268+
maxDecimals={6}
269+
autoCorrect={false}
270+
autoFocus={false}
271+
autoCapitalize="none"
272+
keyboardType="decimal-pad"
273+
placeholder={label2}
274+
onChangeText={handleChangeText2}
275+
returnKeyType="done"
276+
showSpinner={spinner2}
277+
textsizeRem={1.5}
278+
value={value2 ?? '0'}
279+
verticalRem={0.5}
280+
/>
281+
</EdgeAnim>
282+
{onMax != null ? (
283+
<View style={styles.maxButton}>
284+
<ButtonsView
285+
tertiary={{
286+
label: lstrings.string_max_cap,
287+
onPress: handleMax
288+
}}
289+
/>
290+
</View>
291+
) : null}
292+
</View>
293+
)}
294+
<>
295+
<EdgeAnim enter={fadeInDown30}>
296+
<EdgeText numberOfLines={2} style={statusTextStyle}>
297+
{statusText.content}
298+
</EdgeText>
269299
</EdgeAnim>
270-
<EdgeAnim enter={fadeInUp30}>
271-
<FilledTextInput
272-
disabled={disableInput === 2}
273-
numeric
274-
maxDecimals={6}
275-
autoCorrect={false}
276-
autoFocus={false}
277-
autoCapitalize="none"
278-
keyboardType="decimal-pad"
279-
placeholder={label2}
280-
onChangeText={handleChangeText2}
281-
onSubmitEditing={handleSubmit}
282-
returnKeyType="done"
283-
showSpinner={spinner2}
284-
textsizeRem={1.5}
285-
value={value2 ?? '0'}
286-
verticalRem={0.5}
287-
/>
300+
<EdgeAnim enter={fadeInDown60}>
301+
<PoweredByCard iconUri={poweredByIconPath} poweredByText={poweredBy?.poweredByText ?? ''} onPress={handlePoweredByPress} />
288302
</EdgeAnim>
289-
{onMax != null ? (
290-
<View style={styles.maxButton}>
291-
<ButtonsView
292-
tertiary={{
293-
label: lstrings.string_max_cap,
294-
onPress: handleMax
295-
}}
296-
/>
297-
</View>
298-
) : null}
299-
</View>
300-
)}
301-
<>
302-
<EdgeAnim enter={fadeInDown30}>
303-
<EdgeText numberOfLines={2} style={statusTextStyle}>
304-
{statusText.content}
305-
</EdgeText>
306-
</EdgeAnim>
307-
<EdgeAnim enter={fadeInDown60}>
308-
<PoweredByCard iconUri={poweredByIconPath} poweredByText={poweredBy?.poweredByText ?? ''} onPress={handlePoweredByPress} />
309-
</EdgeAnim>
310-
<EdgeAnim enter={fadeInDown90}>
311-
<MainButton disabled={spinner1 || spinner2} label={lstrings.string_next_capitalized} marginRem={[0.5, 0]} onPress={handleSubmit} />
312-
</EdgeAnim>
313-
</>
314-
</View>
315-
</SectionView>
316-
</SceneWrapper>
303+
</>
304+
</View>
305+
</SceneContainer>
306+
</SceneWrapper>
307+
<KavButton disabled={spinner1 || spinner2} label={lstrings.string_next_capitalized} onPress={handleSubmit} hasTabs hasNotifications />
308+
</>
317309
)
318310
})
319311

@@ -325,11 +317,6 @@ const getStyles = cacheStyles((theme: Theme) => {
325317
includeFontPadding: false
326318
}
327319
return {
328-
sceneHeader: {
329-
flexDirection: 'row',
330-
justifyContent: 'flex-start',
331-
alignItems: 'center'
332-
},
333320
container: {
334321
alignItems: 'center',
335322
paddingTop: theme.rem(0.5),

0 commit comments

Comments
 (0)