Refactor how keyboard tracking is resumed & paused (#6822)

* Refactor how keyboard tracking is resumed & paused

* Rector as a hook
This commit is contained in:
Elias Nahum
2022-12-05 12:02:15 +02:00
committed by GitHub
parent dc294eddd3
commit da5b877297
7 changed files with 46 additions and 40 deletions

View File

@@ -58,8 +58,6 @@ function registerNavigationListeners() {
function screenWillAppear({componentId}: ComponentDidAppearEvent) {
if (componentId === Screens.HOME) {
DeviceEventEmitter.emit(Events.TAB_BAR_VISIBLE, true);
} else if ([Screens.EDIT_POST, Screens.THREAD].includes(componentId)) {
DeviceEventEmitter.emit(Events.PAUSE_KEYBOARD_TRACKING_VIEW, true);
}
}
@@ -71,10 +69,6 @@ function screenDidAppearListener({componentId, componentType}: ComponentDidAppea
function screenDidDisappearListener({componentId}: ComponentDidDisappearEvent) {
if (componentId !== Screens.HOME) {
if ([Screens.EDIT_POST, Screens.THREAD].includes(componentId)) {
DeviceEventEmitter.emit(Events.PAUSE_KEYBOARD_TRACKING_VIEW, false);
}
if (NavigationStore.getNavigationTopComponentId() === Screens.HOME) {
DeviceEventEmitter.emit(Events.TAB_BAR_VISIBLE, true);
}