From 35dc711a505f69dfc43fd806bd162cab078c4a51 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 14:22:17 +0800 Subject: [PATCH 1/7] Fix: Inbox - Blue frame on search icon after returning from finder with device back button --- src/components/Search/SearchRouter/SearchButton.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index 90699e951998..b74fc5288874 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import type {StyleProp, ViewStyle} from 'react-native'; +import React, {useRef} from 'react'; +import type {StyleProp, View, ViewStyle} from 'react-native'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import {PressableWithoutFeedback} from '@components/Pressable'; @@ -22,6 +22,7 @@ function SearchButton({style}: SearchButtonProps) { const theme = useTheme(); const {translate} = useLocalize(); const {openSearchRouter} = useSearchRouterContext(); + const pressableRef = useRef(null); return ( @@ -30,6 +31,7 @@ function SearchButton({style}: SearchButtonProps) { accessibilityLabel={translate('common.search')} style={[styles.flexRow, styles.touchableButtonImage, style]} onPress={Session.checkIfActionIsAllowed(() => { + pressableRef?.current?.blur(); Timing.start(CONST.TIMING.OPEN_SEARCH); Performance.markStart(CONST.TIMING.OPEN_SEARCH); From b9ddd7404bb3af419c4ba76bed0bd030915c46f6 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 16:27:04 +0800 Subject: [PATCH 2/7] minor fix --- src/components/Search/SearchRouter/SearchButton.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index b74fc5288874..532a6ae6c0a6 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -27,11 +27,14 @@ function SearchButton({style}: SearchButtonProps) { return ( { - pressableRef?.current?.blur(); + if (pressableRef.current) { + pressableRef.current.blur(); + } Timing.start(CONST.TIMING.OPEN_SEARCH); Performance.markStart(CONST.TIMING.OPEN_SEARCH); From 3befd90c20aeca239d51c7a336a755e3216e56c4 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 16:36:07 +0800 Subject: [PATCH 3/7] minor fix --- .../Search/SearchRouter/SearchButton.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index 532a6ae6c0a6..3c5ec74b434b 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -24,6 +24,17 @@ function SearchButton({style}: SearchButtonProps) { const {openSearchRouter} = useSearchRouterContext(); const pressableRef = useRef(null); + const handleOnPress = () => { + if (pressableRef.current) { + pressableRef.current.blur(); + } + + Timing.start(CONST.TIMING.OPEN_SEARCH); + Performance.markStart(CONST.TIMING.OPEN_SEARCH); + + openSearchRouter(); + }; + return ( { - if (pressableRef.current) { - pressableRef.current.blur(); - } - Timing.start(CONST.TIMING.OPEN_SEARCH); - Performance.markStart(CONST.TIMING.OPEN_SEARCH); - - openSearchRouter(); - })} + onPress={Session.checkIfActionIsAllowed(handleOnPress)} > Date: Fri, 22 Nov 2024 16:39:16 +0800 Subject: [PATCH 4/7] minor fix --- src/components/Search/SearchRouter/SearchButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index 3c5ec74b434b..8ad9d691c129 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -28,7 +28,7 @@ function SearchButton({style}: SearchButtonProps) { if (pressableRef.current) { pressableRef.current.blur(); } - + Timing.start(CONST.TIMING.OPEN_SEARCH); Performance.markStart(CONST.TIMING.OPEN_SEARCH); From 5bc0fadad84deb87aeaff7526f9bb9d24b10da12 Mon Sep 17 00:00:00 2001 From: I Nyoman Jyotisa Date: Fri, 22 Nov 2024 16:52:20 +0800 Subject: [PATCH 5/7] minor fix --- .../Search/SearchRouter/SearchButton.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index 8ad9d691c129..ea500da0c2b1 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -24,17 +24,6 @@ function SearchButton({style}: SearchButtonProps) { const {openSearchRouter} = useSearchRouterContext(); const pressableRef = useRef(null); - const handleOnPress = () => { - if (pressableRef.current) { - pressableRef.current.blur(); - } - - Timing.start(CONST.TIMING.OPEN_SEARCH); - Performance.markStart(CONST.TIMING.OPEN_SEARCH); - - openSearchRouter(); - }; - return ( { + pressableRef?.current?.blur(); + + Timing.start(CONST.TIMING.OPEN_SEARCH); + Performance.markStart(CONST.TIMING.OPEN_SEARCH); + + openSearchRouter(); + })} > Date: Fri, 22 Nov 2024 21:40:10 +0800 Subject: [PATCH 6/7] lint fix --- src/components/Search/SearchRouter/SearchButton.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index ea500da0c2b1..e94af31b7c5c 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -31,14 +31,18 @@ function SearchButton({style}: SearchButtonProps) { nativeID="searchButton" accessibilityLabel={translate('common.search')} style={[styles.flexRow, styles.touchableButtonImage, style]} - onPress={Session.checkIfActionIsAllowed(() => { + onPress={() => { + if (!Session.checkIfActionIsAllowed(() => true)) { + return; + } + pressableRef?.current?.blur(); Timing.start(CONST.TIMING.OPEN_SEARCH); Performance.markStart(CONST.TIMING.OPEN_SEARCH); openSearchRouter(); - })} + }} > Date: Tue, 26 Nov 2024 10:38:04 +0800 Subject: [PATCH 7/7] ESLint fix --- src/components/Search/SearchRouter/SearchButton.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index e94af31b7c5c..e69a11c30da2 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -31,18 +31,15 @@ function SearchButton({style}: SearchButtonProps) { nativeID="searchButton" accessibilityLabel={translate('common.search')} style={[styles.flexRow, styles.touchableButtonImage, style]} - onPress={() => { - if (!Session.checkIfActionIsAllowed(() => true)) { - return; - } - + // eslint-disable-next-line react-compiler/react-compiler + onPress={Session.checkIfActionIsAllowed(() => { pressableRef?.current?.blur(); Timing.start(CONST.TIMING.OPEN_SEARCH); Performance.markStart(CONST.TIMING.OPEN_SEARCH); openSearchRouter(); - }} + })} >