Skip to content

Commit f25b469

Browse files
committed
EmojiPickerScreen: Use plain-old navigation.goBack()
We don't like using NavigationService (#4417), so this is nice to be able to do. Not *quite* NFC: if we somehow manage to have two consecutive EmojiPickerScreens at the top of the stack, we'll now just pop one of them instead of both, because we lose `navigateBack`'s special logic with its `sameRoutesCount` value. But that logic is designed for `ChatScreen` -- we do expect to have multiple of `ChatScreen`s at the top of the stack sometimes. We don't expect that with `EmojiPickerScreen`s.
1 parent 4304dea commit f25b469

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/emoji/EmojiPickerScreen.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import { FlatList } from 'react-native';
77
import { TranslationContext } from '../boot/TranslationProvider';
88
import type { RouteProp } from '../react-navigation';
99
import type { AppNavigationProp } from '../nav/AppNavigator';
10-
import * as NavigationService from '../nav/NavigationService';
1110
import * as api from '../api';
1211
import Screen from '../common/Screen';
1312
import EmojiRow from './EmojiRow';
1413
import { getFilteredEmojis, reactionTypeFromEmojiType } from './data';
1514
import { useSelector } from '../react-redux';
1615
import { getAuth, getActiveImageEmojiByName } from '../selectors';
17-
import { navigateBack } from '../nav/navActions';
1816
import * as logging from '../utils/logging';
1917
import { showToast } from '../utils/info';
2018

@@ -24,7 +22,7 @@ type Props = $ReadOnly<{|
2422
|}>;
2523

2624
export default function EmojiPickerScreen(props: Props): Node {
27-
const { route } = props;
25+
const { navigation, route } = props;
2826
const { messageId } = route.params;
2927

3028
const _ = useContext(TranslationContext);
@@ -46,9 +44,9 @@ export default function EmojiPickerScreen(props: Props): Node {
4644
logging.error('Error adding reaction emoji', err);
4745
showToast(_('Failed to add reaction'));
4846
});
49-
NavigationService.dispatch(navigateBack());
47+
navigation.goBack();
5048
},
51-
[auth, messageId, _],
49+
[auth, messageId, _, navigation],
5250
);
5351

5452
const emojiNames = getFilteredEmojis(filter, activeImageEmojiByName);

0 commit comments

Comments
 (0)