forked from Ivasoft/mattermost-mobile
* Gallery screen (ground work) * Open the gallery from posts * Open the gallery from post draft * feedback review * Feedback review 2 * do not remove dm channel names and localization fix * update to the latest network-client * do not override file width, height and imageThumbail if received file does not have it set * bring back ScrollView wrapper for message component * Remove Text wrapper for markdown paragraph * Fix YouTube play icon placeholder * Make video file play button container round * Add gif image placeholder * Save images & videos to camera roll * Feedback review 3 * load video thumbnail when post is in viewport * simplify prefix
29 lines
920 B
TypeScript
29 lines
920 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {useEffect, useState} from 'react';
|
|
import {DeviceEventEmitter, Platform} from 'react-native';
|
|
|
|
import {Events} from '@constants';
|
|
|
|
const useFreeze = () => {
|
|
const [freeze, setFreeze] = useState(false);
|
|
const [backgroundColor, setBackgroundColor] = useState('#000');
|
|
|
|
useEffect(() => {
|
|
const freezeListener = DeviceEventEmitter.addListener(Events.FREEZE_SCREEN, (shouldFreeze: boolean, color = '#000') => {
|
|
// kept until this https://github.com/software-mansion/react-freeze/issues/7 is fixed
|
|
if (Platform.OS === 'ios') {
|
|
setFreeze(shouldFreeze);
|
|
setBackgroundColor(color);
|
|
}
|
|
});
|
|
|
|
return () => freezeListener.remove();
|
|
});
|
|
|
|
return {freeze, backgroundColor};
|
|
};
|
|
|
|
export default useFreeze;
|