forked from ZeusLN/zeus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigation.ts
155 lines (138 loc) · 3.86 KB
/
Navigation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import { createStackNavigator, createAppContainer } from 'react-navigation';
// Views
import Transaction from './views/Transaction';
import Wallet from './views/Wallet/Wallet';
import Send from './views/Send';
import Receive from './views/Receive';
import PaymentRequest from './views/PaymentRequest';
import AddressQRScanner from './views/AddressQRScanner';
import NodeQRScanner from './views/NodeQRScanner';
import OpenChannel from './views/OpenChannel';
import SendingOnChain from './views/SendingOnChain';
import SendingLightning from './views/SendingLightning';
import Channel from './views/Channel';
import Payment from './views/Payment';
import Invoice from './views/Invoice';
import BTCPayConfigQRScanner from './views/BTCPayConfigQRScanner';
import LNDConnectConfigQRScanner from './views/LNDConnectConfigQRScanner';
import NodeInfo from './views/NodeInfo';
import Lockscreen from './views/Lockscreen';
// Settings views
import Settings from './views/Settings';
import AddEditNode from './views/Settings/AddEditNode';
const AppScenes = {
Lockscreen: {
screen: Lockscreen
},
Wallet: {
screen: Wallet
},
AddressQRCodeScanner : {
screen: AddressQRScanner
},
NodeQRCodeScanner : {
screen: NodeQRScanner
},
Settings: {
screen: Settings
},
AddEditNode: {
screen: AddEditNode
},
Transaction: {
screen: Transaction
},
Channel: {
screen: Channel
},
Payment: {
screen: Payment
},
Invoice: {
screen: Invoice
},
Send: {
screen: Send
},
Receive: {
screen: Receive
},
PaymentRequest: {
screen: PaymentRequest
},
OpenChannel: {
screen: OpenChannel
},
SendingOnChain: {
screen: SendingOnChain
},
SendingLightning: {
screen: SendingLightning
},
BTCPayConfigQRScanner: {
screen: BTCPayConfigQRScanner
},
LNDConnectConfigQRScanner: {
screen: LNDConnectConfigQRScanner
},
NodeInfo: {
screen: NodeInfo
}
}
const PopUpTransition = (index: number, position: any) => {
const opacity = position.interpolate({
inputRange: [index - 1, index, index + 0.999, index + 1],
outputRange: [ 0, 1, 1, 0]
});
const translateY = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [150, 0, 0]
});
return {
opacity,
transform: [
{translateY}
]
}
};
const SlideFromRightTransition = (index: number, position: any, layout: any) => {
const opacity = position.interpolate({
inputRange: [index - 1, index, index + 0.999, index + 1],
outputRange: [ 0, 1, 1, 0]
});
const width = layout.initWidth
const translateX = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [width, 0, 0]
})
return {
opacity,
transform: [
{translateX}
]
}
};
const TransitionConfiguration = () => {
return {
// Define scene interpolation, eq. custom transition
screenInterpolator: (sceneProps: any) => {
const { position, scene, layout } = sceneProps;
const { index } = scene;
const routeName = scene.route.routeName;
if (routeName === 'Transaction' || routeName === 'Channel' || routeName === 'Invoice' || routeName === 'Payment') {
return SlideFromRightTransition(index, position, layout);
}
return PopUpTransition(index, position);
}
}
};
const AppNavigator = createStackNavigator(AppScenes, {
headerMode: 'none',
mode: 'modal',
defaultNavigationOptions: {
gesturesEnabled: false
},
transitionConfig: TransitionConfiguration
});
const Navigation = createAppContainer(AppNavigator);
export default Navigation;