Skip to content

Commit 44072fe

Browse files
committed
refactor(ui): bottom sheets
1 parent 0dc52f9 commit 44072fe

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

e2e/backup.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -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/lightning.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ d('Lightning', () => {
232232
.withTimeout(10000);
233233

234234
// check tx history
235-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
235+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
236236
await expect(
237237
element(by.text('1 000').withAncestor(by.id('ActivityShort-1'))),
238238
).toBeVisible();
@@ -324,7 +324,7 @@ d('Lightning', () => {
324324
.withTimeout(10000);
325325

326326
// check tx history
327-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
327+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
328328
await expect(
329329
element(by.text('111').withAncestor(by.id('ActivityShort-2'))),
330330
).toBeVisible();

e2e/onchain.e2e.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ d('Onchain', () => {
141141
).toHaveText('0');
142142

143143
// check Activity
144-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
144+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
145145
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
146146
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
147147
await expect(element(by.id('ActivityShort-3'))).toBeVisible();
@@ -308,7 +308,7 @@ d('Onchain', () => {
308308
).toHaveText('0');
309309

310310
// check number of outputs for send tx
311-
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
311+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0, 0.5);
312312
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
313313
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
314314
await element(by.id('ActivityShowAll')).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();

src/screens/Activity/ActivityTagsPrompt.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import SafeAreaInset from '../../components/SafeAreaInset';
77
import Tag from '../../components/Tag';
88
import Button from '../../components/buttons/Button';
99
import { useSnapPoints } from '../../hooks/bottomSheet';
10+
import { Keyboard } from '../../hooks/keyboard';
1011
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
1112
import { useSheetRef } from '../../navigation/bottom-sheet/SheetRefsProvider';
1213
import { lastUsedTagsSelector } from '../../store/reselect/metadata';
@@ -32,7 +33,8 @@ const ActivityTagsPrompt = (): ReactElement => {
3233
setText('');
3334
};
3435

35-
const closeBottomSheet = (): void => {
36+
const closeBottomSheet = async (): Promise<void> => {
37+
await Keyboard.dismiss();
3638
sheetRef.current?.close();
3739
resetText();
3840
};

src/screens/Contacts/AddContact.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ const AddContact = ({
6060
};
6161

6262
const onSuccess = async (): Promise<void> => {
63-
await Keyboard.dismiss();
6463
navigation.navigate('ContactEdit', { url });
6564
setUrl('');
6665
};

src/screens/Profile/ProfileLink.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import LabeledInput from '../../components/LabeledInput';
77
import SafeAreaInset from '../../components/SafeAreaInset';
88
import Button from '../../components/buttons/Button';
99
import { useAppDispatch, useAppSelector } from '../../hooks/redux';
10+
import { useSheetRef } from '../../navigation/bottom-sheet/SheetRefsProvider';
1011
import { ProfileLinkScreenProps } from '../../navigation/types';
1112
import { profileLinkSelector } from '../../store/reselect/ui';
1213
import { addLink } from '../../store/slices/slashtags';
1314
import { updateProfileLink } from '../../store/slices/ui';
14-
import { closeSheet } from '../../store/utils/ui';
1515
import { BodyS, BodySB } from '../../styles/text';
1616
import { suggestions } from './ProfileLinkSuggestions';
1717

@@ -20,10 +20,11 @@ const ProfileLink = ({
2020
}: ProfileLinkScreenProps<'ProfileLink'>): ReactElement => {
2121
const { t } = useTranslation('slashtags');
2222
const dispatch = useAppDispatch();
23+
const sheetRef = useSheetRef('profileAddDataForm');
2324
const form = useAppSelector(profileLinkSelector);
2425

25-
const onSave = async (): Promise<void> => {
26-
closeSheet('profileAddDataForm');
26+
const onSave = (): void => {
27+
sheetRef.current?.close();
2728
dispatch(addLink(form));
2829
dispatch(updateProfileLink({ title: '', url: '' }));
2930
};

0 commit comments

Comments
 (0)