diff --git a/app/components/tutorial_highlight/index.tsx b/app/components/tutorial_highlight/index.tsx
index e83fcfa84b..182ad6e6e6 100644
--- a/app/components/tutorial_highlight/index.tsx
+++ b/app/components/tutorial_highlight/index.tsx
@@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
-import React, {useEffect, useState} from 'react';
+import React, {useCallback} from 'react';
import {Modal, StyleSheet, useWindowDimensions, View} from 'react-native';
import HighlightItem from './item';
@@ -11,45 +11,43 @@ type Props = {
itemBounds: TutorialItemBounds;
itemBorderRadius?: number;
onDismiss: () => void;
+ onLayout: () => void;
onShow?: () => void;
}
-const TutorialHighlight = ({children, itemBounds, itemBorderRadius, onDismiss, onShow}: Props) => {
+const TutorialHighlight = ({children, itemBounds, itemBorderRadius, onDismiss, onLayout, 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);
- }, []);
+ const handleShowTutorial = useCallback(() => {
+ if (onShow) {
+ setTimeout(onShow, 1000);
+ }
+ }, [itemBounds]);
return (
+ {itemBounds.endX > 0 &&
+ }
{children}
);
diff --git a/app/components/tutorial_highlight/item.tsx b/app/components/tutorial_highlight/item.tsx
index de98bb12ae..dc96f45f50 100644
--- a/app/components/tutorial_highlight/item.tsx
+++ b/app/components/tutorial_highlight/item.tsx
@@ -14,22 +14,24 @@ type Props = {
height: number;
itemBounds: TutorialItemBounds;
onDismiss: () => void;
+ onLayout: () => void;
width: number;
}
-const HighlightItem = ({height, itemBounds, onDismiss, borderRadius = 0, width}: Props) => {
+const HighlightItem = ({height, itemBounds, onDismiss, onLayout, borderRadius = 0, width}: Props) => {
const theme = useTheme();
const isDark = tinyColor(theme.centerChannelBg).isDark();
const pathD = useMemo(() => {
const parent = {startX: 0, startY: 0, endX: width, endY: height};
return constructRectangularPathWithBorderRadius(parent, itemBounds, borderRadius);
- }, [borderRadius, itemBounds, width]);
+ }, [borderRadius, itemBounds, width, height]);
return (