Skip to content

Commit 9283cc2

Browse files
committed
refactor(ui): bottom sheets
1 parent 27e15f7 commit 9283cc2

File tree

113 files changed

+2224
-2601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2224
-2601
lines changed

e2e/backup.e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ d('Backup', () => {
6666
await rpc.generateToAddress(1, await rpc.getNewAddress());
6767
await electrum?.waitForSync();
6868

69-
await waitFor(element(by.id('NewTxPrompt')))
69+
await waitFor(element(by.id('ReceivedTransaction')))
7070
.toBeVisible()
7171
.withTimeout(10000);
72-
await element(by.id('NewTxPrompt')).swipe('down'); // close Receive screen
72+
await element(by.id('ReceivedTransaction')).swipe('down'); // close Receive screen
7373
await sleep(200); // animation
7474

7575
// set tag to new tx
@@ -92,7 +92,7 @@ d('Backup', () => {
9292
await element(by.id('NavigationClose')).atIndex(0).tap();
9393

9494
// remove 2 default widgets, leave PriceWidget
95-
await element(by.id('HomeScrollView')).scroll(200, 'down', 0);
95+
await element(by.id('HomeScrollView')).scroll(200, 'down', 0, 0.5);
9696
await element(by.id('WidgetsEdit')).tap();
9797
for (const w of ['NewsWidget', 'BlocksWidget']) {
9898
await element(by.id('WidgetActionDelete').withAncestor(by.id(w))).tap();
@@ -122,7 +122,7 @@ d('Backup', () => {
122122
await sleep(200); // animation
123123

124124
// check widgets
125-
await element(by.id('HomeScrollView')).scroll(300, 'down', 0);
125+
await element(by.id('HomeScrollView')).scroll(300, 'down', 0, 0.5);
126126
await expect(element(by.id('PriceWidget'))).toExist();
127127
await expect(element(by.id('NewsWidget'))).not.toExist();
128128
await expect(element(by.id('BlocksWidget'))).not.toExist();

e2e/boost.e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ d('Boost', () => {
6767
await rpc.sendToAddress(wAddress, '0.001');
6868
await rpc.generateToAddress(1, await rpc.getNewAddress());
6969
await electrum?.waitForSync();
70-
await waitFor(element(by.id('NewTxPrompt')))
70+
await waitFor(element(by.id('ReceivedTransaction')))
7171
.toBeVisible()
7272
.withTimeout(10000);
73-
await element(by.id('NewTxPromptButton')).tap();
73+
await element(by.id('ReceivedTransactionButton')).tap();
7474
await expect(
7575
element(by.id('MoneyText').withAncestor(by.id('TotalBalance'))),
7676
).toHaveText('100 000');
@@ -178,10 +178,10 @@ d('Boost', () => {
178178
await rpc.sendToAddress(wAddress, '0.001');
179179
await rpc.generateToAddress(1, await rpc.getNewAddress());
180180
await electrum?.waitForSync();
181-
await waitFor(element(by.id('NewTxPrompt')))
181+
await waitFor(element(by.id('ReceivedTransaction')))
182182
.toBeVisible()
183183
.withTimeout(10000);
184-
await element(by.id('NewTxPromptButton')).tap();
184+
await element(by.id('ReceivedTransactionButton')).tap();
185185
await expect(
186186
element(by.id('MoneyText').withAncestor(by.id('TotalBalance'))),
187187
).toHaveText('100 000');

e2e/helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ export const receiveOnchainFunds = async (rpc, amount = '0.001') => {
138138
await rpc.sendToAddress(wAddress, amount);
139139
await rpc.generateToAddress(1, await rpc.getNewAddress());
140140

141-
await waitFor(element(by.id('NewTxPrompt')))
141+
await waitFor(element(by.id('ReceivedTransaction')))
142142
.toBeVisible()
143143
.withTimeout(10000);
144-
await element(by.id('NewTxPrompt')).swipe('down');
144+
await element(by.id('ReceivedTransaction')).swipe('down');
145145
await sleep(1000);
146146
};
147147

e2e/lightning.e2e.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ d('Lightning', () => {
131131
let { label: invoice1 } = await element(by.id('QRCode')).getAttributes();
132132
invoice1 = invoice1.replaceAll(/bitcoin.*=/gi, '').toLowerCase();
133133
await lnd.sendPaymentSync({ paymentRequest: invoice1, amt: 50000 });
134-
await waitFor(element(by.id('NewTxPrompt')))
134+
await waitFor(element(by.id('ReceivedTransaction')))
135135
.toBeVisible()
136136
.withTimeout(10000);
137-
await element(by.id('NewTxPrompt')).swipe('down');
137+
await element(by.id('ReceivedTransaction')).swipe('down');
138138
await waitFor(
139139
element(by.id('MoneyText').withAncestor(by.id('TotalBalance'))),
140140
)
@@ -153,20 +153,21 @@ d('Lightning', () => {
153153
const note1 = 'note 111';
154154
await element(by.id('ReceiveNote')).typeText(note1);
155155
await element(by.id('ReceiveNote')).tapReturnKey();
156-
await sleep(200);
156+
await sleep(300); // wait for keyboard to hide
157157
await element(by.id('TagsAdd')).tap();
158158
await element(by.id('TagInputReceive')).typeText('rtag');
159159
await element(by.id('TagInputReceive')).tapReturnKey();
160+
await sleep(300); // wait for keyboard to hide
160161
await element(by.id('ShowQrReceive')).tap();
161162
await element(by.id('QRCode')).swipe('left');
162163
const { label: invoice2 } = await element(
163164
by.id('ReceiveLightningInvoice'),
164165
).getAttributes();
165166
await lnd.sendPaymentSync({ paymentRequest: invoice2 });
166-
await waitFor(element(by.id('NewTxPrompt')))
167+
await waitFor(element(by.id('ReceivedTransaction')))
167168
.toBeVisible()
168169
.withTimeout(10000);
169-
await element(by.id('NewTxPrompt')).swipe('down');
170+
await element(by.id('ReceivedTransaction')).swipe('down');
170171
await waitFor(
171172
element(by.id('MoneyText').withAncestor(by.id('TotalBalance'))),
172173
)
@@ -232,7 +233,7 @@ d('Lightning', () => {
232233
.withTimeout(10000);
233234

234235
// check tx history
235-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
236+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
236237
await expect(
237238
element(by.text('1 000').withAncestor(by.id('ActivityShort-1'))),
238239
).toBeVisible();
@@ -324,7 +325,7 @@ d('Lightning', () => {
324325
.withTimeout(10000);
325326

326327
// check tx history
327-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
328+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
328329
await expect(
329330
element(by.text('111').withAncestor(by.id('ActivityShort-2'))),
330331
).toBeVisible();
@@ -360,10 +361,10 @@ d('Lightning', () => {
360361

361362
// TODO: for some reason this doen't work on github actions
362363
// wait for onchain payment to arrive
363-
// await waitFor(element(by.id('NewTxPrompt')))
364+
// await waitFor(element(by.id('ReceivedTransaction')))
364365
// .toBeVisible()
365366
// .withTimeout(60000);
366-
// await element(by.id('NewTxPrompt')).swipe('down');
367+
// await element(by.id('ReceivedTransaction')).swipe('down');
367368
// await expect(
368369
// element(by.id('MoneySign').withAncestor(by.id('ActivityShort-1'))),
369370
// ).toHaveText('+');

e2e/lnurl.e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ d('LNURL', () => {
261261
await element(by.id('DialogConfirm')).tap();
262262
await element(by.id('ContinueAmount')).tap();
263263
await element(by.id('WithdrawConfirmButton')).tap();
264-
await waitFor(element(by.id('NewTxPrompt')))
264+
await waitFor(element(by.id('ReceivedTransaction')))
265265
.toBeVisible()
266266
.withTimeout(10000);
267-
await element(by.id('NewTxPrompt')).swipe('down');
267+
await element(by.id('ReceivedTransaction')).swipe('down');
268268

269269
// test lnurl-withdraw, with min !== max amount
270270
const withdrawRequest2 = await lnurl.generateNewUrl('withdrawRequest', {
@@ -277,10 +277,10 @@ d('LNURL', () => {
277277
await element(by.id('QRInput')).replaceText(withdrawRequest2.encoded);
278278
await element(by.id('DialogConfirm')).tap();
279279
await element(by.id('WithdrawConfirmButton')).tap();
280-
await waitFor(element(by.id('NewTxPrompt')))
280+
await waitFor(element(by.id('ReceivedTransaction')))
281281
.toBeVisible()
282282
.withTimeout(10000);
283-
await element(by.id('NewTxPrompt')).swipe('down');
283+
await element(by.id('ReceivedTransaction')).swipe('down');
284284

285285
// test lnurl-auth
286286
const loginRequest1 = await lnurl.generateNewUrl('login');

e2e/onchain.e2e.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ d('Onchain', () => {
6767
await element(by.id('TagsAdd')).tap();
6868
await element(by.id('TagInputReceive')).typeText(`rtag${i}`);
6969
await element(by.id('TagInputReceive')).tapReturnKey();
70+
await sleep(300); // wait for keyboard to hide
7071
await element(by.id('ShowQrReceive')).tap();
7172

7273
await rpc.sendToAddress(wAddress, '1');
7374
await rpc.generateToAddress(1, await rpc.getNewAddress());
7475
await electrum?.waitForSync();
7576

76-
await waitFor(element(by.id('NewTxPrompt')))
77+
await waitFor(element(by.id('ReceivedTransaction')))
7778
.toBeVisible()
7879
.withTimeout(10000);
79-
await element(by.id('NewTxPrompt')).swipe('down'); // close Receive screen
80+
await element(by.id('ReceivedTransaction')).swipe('down'); // close Receive screen
8081
await sleep(1000); // animation
8182
}
8283

@@ -140,7 +141,7 @@ d('Onchain', () => {
140141
).toHaveText('0');
141142

142143
// check Activity
143-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
144+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
144145
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
145146
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
146147
await expect(element(by.id('ActivityShort-3'))).toBeVisible();
@@ -200,7 +201,7 @@ d('Onchain', () => {
200201
await element(by.id('Tag-stag-delete')).tap();
201202

202203
// calendar, previous month, 0 transactions
203-
await element(by.id('TimeRangePrompt')).tap();
204+
await element(by.id('DatePicker')).tap();
204205
await expect(element(by.id('Today'))).toBeVisible();
205206
await element(by.id('PrevMonth')).tap();
206207
await expect(element(by.id('Today'))).not.toExist();
@@ -210,7 +211,7 @@ d('Onchain', () => {
210211
await expect(element(by.id('Activity-1'))).not.toExist();
211212

212213
// calendar, current date, 3 transactions
213-
await element(by.id('TimeRangePrompt')).tap();
214+
await element(by.id('DatePicker')).tap();
214215
await element(by.id('CalendarClearButton')).tap();
215216
await element(by.id('NextMonth')).tap();
216217
await element(by.id('Today')).tap();
@@ -237,10 +238,10 @@ d('Onchain', () => {
237238
// await rpc.generateToAddress(1, await rpc.getNewAddress());
238239
// await electrum?.waitForSync();
239240

240-
await waitFor(element(by.id('NewTxPrompt')))
241+
await waitFor(element(by.id('ReceivedTransaction')))
241242
.toBeVisible()
242243
.withTimeout(10000);
243-
await element(by.id('NewTxPrompt')).swipe('down'); // close Receive screen
244+
await element(by.id('ReceivedTransaction')).swipe('down'); // close Receive screen
244245
await sleep(1000); // animation
245246

246247
const coreAddress = await rpc.getNewAddress();
@@ -307,7 +308,7 @@ d('Onchain', () => {
307308
).toHaveText('0');
308309

309310
// check number of outputs for send tx
310-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
311+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
311312
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
312313
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
313314
await element(by.id('ActivityShowAll')).tap();

e2e/receive.e2e.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ d('Receive', () => {
8888
const note = 'iPhone Refurbished';
8989
await element(by.id('ReceiveNote')).typeText(note);
9090
await element(by.id('ReceiveNote')).tapReturnKey();
91-
await sleep(200);
91+
await sleep(300); // wait for keyboard to hide
9292

9393
// Tags
9494
const tag = 'test123';
9595
await element(by.id('TagsAdd')).tap();
9696
await element(by.id('TagInputReceive')).typeText(tag);
9797
await element(by.id('ReceiveTagsSubmit')).tap();
98+
await sleep(300); // wait for keyboard to hide
9899

99100
// Show QR
100101
await element(by.id('ShowQrReceive')).tap();

e2e/security.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ d('Settings Security And Privacy', () => {
132132
await rpc.sendToAddress(wAddress, '1');
133133
await rpc.generateToAddress(1, await rpc.getNewAddress());
134134
await electrum?.waitForSync();
135-
await waitFor(element(by.id('NewTxPrompt')))
135+
await waitFor(element(by.id('ReceivedTransaction')))
136136
.toBeVisible()
137137
.withTimeout(10000);
138-
await element(by.id('NewTxPrompt')).swipe('down'); // close Receive screen
138+
await element(by.id('ReceivedTransaction')).swipe('down'); // close Receive screen
139139

140140
// send, using FaceID
141141
const coreAddress = await rpc.getNewAddress();

e2e/send.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ d('Send', () => {
245245
let { label: receive } = await element(by.id('QRCode')).getAttributes();
246246
receive = receive.replaceAll(/bitcoin.*=/gi, '').toLowerCase();
247247
await lnd.sendPaymentSync({ paymentRequest: receive, amt: 50000 });
248-
await waitFor(element(by.id('NewTxPrompt')))
248+
await waitFor(element(by.id('ReceivedTransaction')))
249249
.toBeVisible()
250250
.withTimeout(10000);
251-
await element(by.id('NewTxPrompt')).swipe('down');
251+
await element(by.id('ReceivedTransaction')).swipe('down');
252252

253253
await waitFor(
254254
element(by.id('MoneyText').withAncestor(by.id('TotalBalance'))),

e2e/settings.e2e.js

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ d('Settings', () => {
193193
await expect(element(by.text(tag))).not.toBeVisible();
194194
await element(by.id('TagInputReceive')).typeText(tag);
195195
await element(by.id('ReceiveTagsSubmit')).tap();
196+
await sleep(300); // wait for keyboard to hide
196197
await expect(element(by.text(tag))).toBeVisible();
197198
await element(by.id('ReceiveScreen')).swipe('down');
198199
await sleep(1000);

e2e/slashtags.e2e.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ d('Profile and Contacts', () => {
143143
await element(by.id('NavigationBack')).tap();
144144
await element(by.id('NavigationBack')).tap();
145145

146-
if (device.getPlatform() === 'ios') {
147-
// FIXME: this bottom sheet should not appear
148-
// Tap on background to dismiss
149-
await element(by.label('Close')).atIndex(0).tap({ x: 10, y: 10 });
150-
}
151-
152146
// Hal
153147
await element(by.id('AddContact')).tap();
154148
await element(by.id('ContactURLInput')).typeText(hal.url);
@@ -206,10 +200,10 @@ d('Profile and Contacts', () => {
206200
await rpc.sendToAddress(wAddress, '1');
207201
await rpc.generateToAddress(1, await rpc.getNewAddress());
208202
await electrum?.waitForSync();
209-
await waitFor(element(by.id('NewTxPrompt')))
203+
await waitFor(element(by.id('ReceivedTransaction')))
210204
.toBeVisible()
211205
.withTimeout(10000);
212-
await element(by.id('NewTxPrompt')).swipe('down');
206+
await element(by.id('ReceivedTransaction')).swipe('down');
213207
await element(by.id('ActivitySavings')).tap();
214208
await element(by.id('Activity-1')).tap();
215209
await element(by.id('ActivityAssign')).tap();

e2e/transfer.e2e.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ d('Transfer', () => {
7575
await rpc.generateToAddress(1, await rpc.getNewAddress());
7676
await electrum?.waitForSync();
7777

78-
await waitFor(element(by.id('NewTxPrompt')))
78+
await waitFor(element(by.id('ReceivedTransaction')))
7979
.toBeVisible()
8080
.withTimeout(20000);
81-
await element(by.id('NewTxPrompt')).swipe('down'); // close Receive screen
81+
await element(by.id('ReceivedTransaction')).swipe('down'); // close Receive screen
8282

8383
// switch to USD
8484
await element(by.id('HeaderMenu')).tap();
@@ -261,10 +261,10 @@ d('Transfer', () => {
261261
await rpc.sendToAddress(wAddress, '0.001');
262262
await rpc.generateToAddress(1, await rpc.getNewAddress());
263263

264-
await waitFor(element(by.id('NewTxPrompt')))
264+
await waitFor(element(by.id('ReceivedTransaction')))
265265
.toBeVisible()
266266
.withTimeout(20000);
267-
await element(by.id('NewTxPrompt')).swipe('down');
267+
await element(by.id('ReceivedTransaction')).swipe('down');
268268

269269
// Get LDK node id
270270
await element(by.id('HeaderMenu')).tap();

e2e/widgets.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ d('Widgets', () => {
3535
}
3636

3737
// add price widget
38-
await element(by.id('HomeScrollView')).scroll(300, 'down', 0);
38+
await element(by.id('HomeScrollView')).scroll(300, 'down', 0, 0.5);
3939
await element(by.id('WidgetsAdd')).tap();
4040
await element(by.id('WidgetsOnboarding-button')).tap();
4141
await element(by.id('WidgetListItem-price')).tap();
@@ -50,7 +50,7 @@ d('Widgets', () => {
5050
await element(by.id('WidgetEditField-showSource')).tap();
5151
await element(by.id('WidgetEditPreview')).tap();
5252
await element(by.id('WidgetSave')).tap();
53-
await element(by.id('HomeScrollView')).scroll(200, 'down', 0);
53+
await element(by.id('HomeScrollView')).scroll(200, 'down', 0, 0.5);
5454
await expect(element(by.id('PriceWidget'))).toBeVisible();
5555
await expect(element(by.id('PriceWidgetRow-BTC/EUR'))).toBeVisible();
5656
await expect(element(by.id('PriceWidgetSource'))).toBeVisible();
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/node_modules/@gorhom/bottom-sheet/lib/typescript/types.d.ts b/node_modules/@gorhom/bottom-sheet/lib/typescript/types.d.ts
2+
index 27f39a1..914efc6 100644
3+
--- a/node_modules/@gorhom/bottom-sheet/lib/typescript/types.d.ts
4+
+++ b/node_modules/@gorhom/bottom-sheet/lib/typescript/types.d.ts
5+
@@ -91,6 +91,10 @@ export interface BottomSheetModalMethods extends BottomSheetMethods {
6+
* @see {WithTimingConfig}
7+
*/
8+
dismiss: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
9+
+ /**
10+
+ * Check if the bottom sheet modal is open.
11+
+ */
12+
+ isOpen: () => boolean;
13+
}
14+
//#endregion
15+
16+
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
17+
index 275ce50..2d5ea19 100644
18+
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
19+
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
20+
@@ -363,6 +363,10 @@ const BottomSheetModalComponent = forwardRef<
21+
// internal
22+
minimize: handleMinimize,
23+
restore: handleRestore,
24+
+ isOpen: () => {
25+
+ // If animateOnMount is disabled, the sheet is open if it's mounted
26+
+ return animateOnMount ? currentIndexRef.current !== -1 : mounted.current;
27+
+ },
28+
}));
29+
//#endregion
30+

0 commit comments

Comments
 (0)