1
1
import { useDispatch , useSelector } from 'react-redux' ;
2
2
import Animated , { SlideInDown , SlideOutDown } from 'react-native-reanimated' ;
3
- import { View } from 'react-native' ;
4
3
5
4
import { A } from '@mobily/ts-belt' ;
6
5
import { useNavigation } from '@react-navigation/native' ;
7
- import { LinearGradient } from 'expo-linear-gradient' ;
8
6
9
- import { Screen , useHandleHardwareBackNavigation } from '@suite-native/navigation' ;
7
+ import {
8
+ Screen ,
9
+ ScreenFooterGradient ,
10
+ useHandleHardwareBackNavigation ,
11
+ } from '@suite-native/navigation' ;
10
12
import { Box , Button , Text , VStack } from '@suite-native/atoms' ;
11
13
import {
12
14
applyDiscoveryChangesThunk ,
13
15
selectDeviceEnabledDiscoveryNetworkSymbols ,
14
16
setIsCoinEnablingInitFinished ,
15
17
} from '@suite-native/discovery' ;
16
18
import { Translation } from '@suite-native/intl' ;
17
- import { prepareNativeStyle , useNativeStyles } from '@trezor/styles' ;
18
19
import { analytics , EventType } from '@suite-native/analytics' ;
19
- import { hexToRgba } from '@suite-common/suite-utils' ;
20
20
21
21
import { DiscoveryCoinsFilter } from '../components/DiscoveryCoinsFilter' ;
22
22
23
- const BOTTOM_OFFSET = 12 ;
24
- const BUTTON_HEIGHT = 48 ;
25
-
26
- const contentStyle = prepareNativeStyle ( _ => ( {
27
- paddingBottom : BOTTOM_OFFSET ,
28
- } ) ) ;
29
-
30
- const gradientBackgroundBottomStyle = prepareNativeStyle < { showButton : boolean } > (
31
- ( utils , { showButton } ) => ( {
32
- width : '100%' ,
33
- height : utils . spacings . sp16 ,
34
- position : 'absolute' ,
35
- bottom : - BOTTOM_OFFSET ,
36
- pointerEvents : 'none' ,
37
- extend : [ { condition : showButton , style : { bottom : BUTTON_HEIGHT } } ] ,
38
- } ) ,
39
- ) ;
40
-
41
- const buttonWrapperStyle = prepareNativeStyle ( utils => ( {
42
- bottom : BOTTOM_OFFSET ,
43
- backgroundColor : utils . colors . backgroundSurfaceElevation0 ,
44
- width : '100%' ,
45
- } ) ) ;
46
-
47
- const buttonStyle = prepareNativeStyle ( utils => ( {
48
- paddingHorizontal : utils . spacings . sp16 ,
49
- } ) ) ;
50
-
51
23
export const CoinEnablingInitScreen = ( ) => {
52
24
const dispatch = useDispatch ( ) ;
53
25
const navigation = useNavigation ( ) ;
54
26
useHandleHardwareBackNavigation ( ) ;
55
27
56
- const { applyStyle, utils } = useNativeStyles ( ) ;
57
28
const enabledNetworkSymbols = useSelector ( selectDeviceEnabledDiscoveryNetworkSymbols ) ;
58
29
59
30
const handleSave = ( ) => {
@@ -69,9 +40,6 @@ export const CoinEnablingInitScreen = () => {
69
40
}
70
41
} ;
71
42
72
- // 'transparent' color is not working in context of LinearGradient on iOS. RGBA has to be used instead.
73
- const transparentColor = hexToRgba ( utils . colors . backgroundSurfaceElevation0 , 0.01 ) ;
74
-
75
43
const canBeSaved = A . isNotEmpty ( enabledNetworkSymbols ) ;
76
44
77
45
return (
@@ -87,29 +55,19 @@ export const CoinEnablingInitScreen = () => {
87
55
</ VStack >
88
56
}
89
57
footer = {
90
- < View style = { applyStyle ( buttonWrapperStyle ) } >
91
- < LinearGradient
92
- dither = { false }
93
- colors = { [ transparentColor , utils . colors . backgroundSurfaceElevation0 ] }
94
- style = { applyStyle ( gradientBackgroundBottomStyle , {
95
- showButton : canBeSaved ,
96
- } ) }
97
- />
98
- { canBeSaved && (
99
- < Animated . View
100
- entering = { SlideInDown }
101
- exiting = { SlideOutDown }
102
- style = { applyStyle ( buttonStyle ) }
103
- >
58
+ canBeSaved && (
59
+ < Animated . View entering = { SlideInDown } exiting = { SlideOutDown } >
60
+ < ScreenFooterGradient />
61
+ < Box marginHorizontal = "sp16" >
104
62
< Button onPress = { handleSave } testID = "@coin-enabling/button-save" >
105
63
< Translation id = "moduleSettings.coinEnabling.initialSetup.button" />
106
64
</ Button >
107
- </ Animated . View >
108
- ) }
109
- </ View >
65
+ </ Box >
66
+ </ Animated . View >
67
+ )
110
68
}
111
69
>
112
- < Box style = { applyStyle ( contentStyle ) } >
70
+ < Box >
113
71
< DiscoveryCoinsFilter allowDeselectLastCoin = { true } allowChangeAnalytics = { false } />
114
72
</ Box >
115
73
</ Screen >
0 commit comments