forked from Ivasoft/mattermost-mobile
Fix ios keyboard tracking and profile status theme (#6859)
* add listener when screen is popped * Fix profile status theme
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user