Fix ios keyboard tracking and profile status theme (#6859)

* add listener when screen is popped

* Fix profile status theme
This commit is contained in:
Elias Nahum
2022-12-13 09:14:39 +02:00
committed by GitHub
parent ec7066ad06
commit 917ea371a0
2 changed files with 15 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ const Status = ({author, statusSize, statusStyle, theme}: Props) => {
styles.statusWrapper,
statusStyle,
{borderRadius: statusSize / 2},
]), [statusStyle]);
]), [statusStyle, styles]);
const isBot = author && (('isBot' in author) ? author.isBot : author.is_bot);
if (author?.status && !isBot) {
return (

View File

@@ -11,6 +11,14 @@ export const useKeyboardTrackingPaused = (keyboardTrackingRef: RefObject<Keyboar
const isPostDraftPaused = useRef(false);
useEffect(() => {
const onCommandComplete = () => {
const id = NavigationStore.getVisibleScreen();
if (screens.includes(id) && isPostDraftPaused.current) {
isPostDraftPaused.current = false;
keyboardTrackingRef.current?.resumeTracking(trackerId);
}
};
const commandListener = Navigation.events().registerCommandListener(() => {
if (!isPostDraftPaused.current) {
isPostDraftPaused.current = true;
@@ -19,16 +27,17 @@ export const useKeyboardTrackingPaused = (keyboardTrackingRef: RefObject<Keyboar
});
const commandCompletedListener = Navigation.events().registerCommandCompletedListener(() => {
const id = NavigationStore.getVisibleScreen();
if (screens.includes(id) && isPostDraftPaused.current) {
isPostDraftPaused.current = false;
keyboardTrackingRef.current?.resumeTracking(trackerId);
}
onCommandComplete();
});
const popListener = Navigation.events().registerScreenPoppedListener(() => {
onCommandComplete();
});
return () => {
commandListener.remove();
commandCompletedListener.remove();
popListener.remove();
};
}, [trackerId]);
};