Files
mattermost-mobile/app/components/tutorial_highlight/index.tsx
Elias Nahum 5b9492356b Gekidou MultiServers second part (#5963)
* Edit Server display name

* Lock iPhone to portrait and iPad to landscape

* Create actions for app global to store device token and multi server tutorial

* Add MutliServer tutorial on first use

* WebSocket reconnection priority

* have isRecordGlobalEqualToRaw to not check for value

* Return early on edit server if error is found

* Prepopulate server screen with last logged out server address and name

* Add CompassIcon to circleCI asset generation
2022-02-17 10:42:06 -03:00

58 lines
1.6 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useEffect, useState} from 'react';
import {Modal, StyleSheet, useWindowDimensions, View} from 'react-native';
import HighlightItem from './item';
type Props = {
children?: React.ReactNode;
itemBounds: TutorialItemBounds;
itemBorderRadius?: number;
onDismiss: () => void;
onShow: () => void;
}
const TutorialHighlight = ({children, itemBounds, itemBorderRadius, onDismiss, onShow}: Props) => {
const {width, height} = useWindowDimensions();
const [visible, setIsVisible] = useState(false);
const isLandscape = width > height;
const supportedOrientations = isLandscape ? 'landscape' : 'portrait';
useEffect(() => {
const t = setTimeout(() => {
setIsVisible(true);
}, 500);
return () => clearTimeout(t);
}, []);
return (
<Modal
visible={visible}
transparent={true}
animationType='fade'
onShow={onShow}
onDismiss={onDismiss}
onRequestClose={onDismiss}
supportedOrientations={[supportedOrientations]}
>
<View
style={StyleSheet.absoluteFill}
pointerEvents='box-none'
/>
<HighlightItem
borderRadius={itemBorderRadius}
itemBounds={itemBounds}
height={height}
onDismiss={onDismiss}
width={width}
/>
{children}
</Modal>
);
};
export default TutorialHighlight;