Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3c51964
Remove manual memoization that prevents React Compiler optimization
roryabraham Feb 18, 2026
e6ce892
Add no-inline-useOnyx-selector to React Compiler compat processor
roryabraham Feb 18, 2026
1c0e325
Remove redundant no-inline-useOnyx-selector eslint-disable comments
roryabraham Feb 18, 2026
f7f0c69
Remove unnecessary effect in InviteReceiptPartnerPolicyPage
roryabraham Feb 18, 2026
fd86926
Remove redundant manual memoization
roryabraham Feb 18, 2026
59c32e0
Clean up NavigationTabBar
roryabraham Feb 18, 2026
13e2320
Remove unnecessary effects from NavigationTabBar
roryabraham Feb 18, 2026
c6a9c4c
Remove unnecessary usePrevious and useEffect from MoneyRequestView
roryabraham Feb 18, 2026
230d5cd
Suppress exhaustive-deps rules that suggest useCallback in compiled f…
roryabraham Feb 19, 2026
e3a589a
Remove unnecessary useEffect from SelectCountryStep
roryabraham Feb 19, 2026
2323d5c
Add useCallback and useMemo to the dictionary
roryabraham Feb 19, 2026
f3f113e
Reduce max warnings for all the fixed warnings
roryabraham Feb 19, 2026
b919582
Add React import
roryabraham Feb 19, 2026
7aef17f
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 19, 2026
bd139ee
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 19, 2026
b0fe4c8
Refactor NavigationTabBar components for React Compiler compliance
roryabraham Feb 19, 2026
cb0d953
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 21, 2026
16f29cf
Fix one-time preselection in InviteReceiptPartnerPolicyPage
roryabraham Feb 21, 2026
be6843c
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 23, 2026
f544cc6
Fix accidental package version drift in package.json
roryabraham Feb 23, 2026
0261c23
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 23, 2026
e3d55e0
Merge remote-tracking branch 'origin/main' into Rory-ReactCompilerBatch2
roryabraham Feb 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@
"USAA",
"USDVBBA",
"useAutolayout",
"useCallback",
"useMemo",
"usernotifications",
"utilise",
"Valuska",
Expand Down
22 changes: 18 additions & 4 deletions eslint-plugin-react-compiler-compat/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
import {transformSync} from '@babel/core';
import _ from 'lodash';

// Rules that are unnecessary when React Compiler successfully compiles all
// functions in a file. Add more rules here as needed.
const RULES_SUPPRESSED_BY_REACT_COMPILER = new Set(['react/jsx-no-constructed-context-values']);
// Rules that are entirely unnecessary when React Compiler successfully compiles
// all functions in a file. Add more rules here as needed.
const RULES_SUPPRESSED_BY_REACT_COMPILER = new Set(['react/jsx-no-constructed-context-values', 'rulesdir/no-inline-useOnyx-selector']);

// react-hooks/exhaustive-deps warnings that suggest useCallback/useMemo are
// false positives in compiled files, since React Compiler auto-memoizes.
// We only suppress the "wrap in useCallback/useMemo" suggestions, NOT warnings
// about genuinely missing dependencies.
const EXHAUSTIVE_DEPS_USECALLBACK_USEMEMO_PATTERN = /\buseCallback\(\) Hook\b|\buseMemo\(\) Hook\b/;

// Mirror the compiler config from babel.config.js (excluding `sources`,
// which is only relevant for the Babel build pipeline, not for our analysis).
Expand Down Expand Up @@ -109,7 +115,15 @@ const plugin = {
compilationResults.delete(filename);

if (allCompiled) {
return _.filter(messages[0], (msg) => !RULES_SUPPRESSED_BY_REACT_COMPILER.has(msg.ruleId));
return _.filter(messages[0], (msg) => {
if (RULES_SUPPRESSED_BY_REACT_COMPILER.has(msg.ruleId)) {
return false;
}
if (msg.ruleId === 'react-hooks/exhaustive-deps' && EXHAUSTIVE_DEPS_USECALLBACK_USEMEMO_PATTERN.test(msg.message)) {
return false;
}
return true;
});
}

return messages[0];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=424 --cache --cache-location=node_modules/.cache/eslint --cache-strategy content --concurrency=auto",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=381 --cache --cache-location=node_modules/.cache/eslint --cache-strategy content --concurrency=auto",
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
"check-lazy-loading": "ts-node scripts/checkLazyLoading.ts",
"lint-watch": "npx eslint-watch --watch --changed",
Expand Down
68 changes: 16 additions & 52 deletions src/components/Navigation/NavigationTabBar/SearchTabButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import React from 'react';
import type {ValueOf} from 'type-fest';
import Icon from '@components/Icon';
import {PressableWithFeedback} from '@components/Pressable';
import Text from '@components/Text';
import useDefaultSearchQuery from '@hooks/useDefaultSearchQuery';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import clearSelectedText from '@libs/clearSelectedText/clearSelectedText';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
Expand All @@ -17,34 +13,32 @@ import {buildCannedSearchQuery, buildSearchQueryJSON, buildSearchQueryString} fr
import {startSpan} from '@libs/telemetry/activeSpans';
import navigationRef from '@navigation/navigationRef';
import type {SearchFullscreenNavigatorParamList} from '@navigation/types';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import getLastRoute from './getLastRoute';
import getTabIconFill from './getTabIconFill';
import NAVIGATION_TABS from './NAVIGATION_TABS';
import TabBarItem from './TabBarItem';

type SearchTabButtonProps = {
selectedTab: ValueOf<typeof NAVIGATION_TABS>;
isWideLayout: boolean;
};

function SearchTabButton({selectedTab, isWideLayout}: SearchTabButtonProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const expensifyIcons = useMemoizedLazyExpensifyIcons(['MoneySearch']);
const defaultSearchQuery = useDefaultSearchQuery();
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES);
const [lastSearchParams] = useOnyx(ONYXKEYS.REPORT_NAVIGATION_LAST_SEARCH_QUERY);

const searchAccessibilityState = useMemo(() => ({selected: selectedTab === NAVIGATION_TABS.SEARCH}), [selectedTab]);
const searchAccessibilityState = {selected: selectedTab === NAVIGATION_TABS.SEARCH};
const lastQueryJSON = lastSearchParams?.queryJSON;

const navigateToSearch = useCallback(() => {
const navigateToSearch = () => {
if (selectedTab === NAVIGATION_TABS.SEARCH) {
return;
}
Expand Down Expand Up @@ -83,7 +77,7 @@ function SearchTabButton({selectedTab, isWideLayout}: SearchTabButtonProps) {
const lastQueryFromOnyx = lastQueryJSON ? buildSearchQueryString(lastQueryJSON) : undefined;
Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: lastQueryFromOnyx ?? defaultSearchQuery ?? savedSearchQuery ?? buildCannedSearchQuery()}));
});
}, [selectedTab, defaultSearchQuery, savedSearches, lastQueryJSON]);
};

if (isWideLayout) {
return (
Expand All @@ -96,28 +90,12 @@ function SearchTabButton({selectedTab, isWideLayout}: SearchTabButtonProps) {
sentryLabel={CONST.SENTRY_LABEL.NAVIGATION_TAB_BAR.REPORTS}
>
{({hovered}) => (
<>
<View>
<Icon
src={expensifyIcons.MoneySearch}
fill={getTabIconFill(theme, {isSelected: selectedTab === NAVIGATION_TABS.SEARCH, isHovered: hovered})}
width={variables.iconBottomBar}
height={variables.iconBottomBar}
/>
</View>
<Text
numberOfLines={2}
style={[
styles.textSmall,
styles.textAlignCenter,
styles.mt1Half,
selectedTab === NAVIGATION_TABS.SEARCH ? styles.textBold : styles.textSupporting,
styles.navigationTabBarLabel,
]}
>
{translate('common.reports')}
</Text>
</>
<TabBarItem
icon={expensifyIcons.MoneySearch}
label={translate('common.reports')}
isSelected={selectedTab === NAVIGATION_TABS.SEARCH}
isHovered={hovered}
/>
)}
</PressableWithFeedback>
);
Expand All @@ -133,26 +111,12 @@ function SearchTabButton({selectedTab, isWideLayout}: SearchTabButtonProps) {
style={styles.navigationTabBarItem}
sentryLabel={CONST.SENTRY_LABEL.NAVIGATION_TAB_BAR.REPORTS}
>
<View>
<Icon
src={expensifyIcons.MoneySearch}
fill={selectedTab === NAVIGATION_TABS.SEARCH ? theme.iconMenu : theme.icon}
width={variables.iconBottomBar}
height={variables.iconBottomBar}
/>
</View>
<Text
<TabBarItem
icon={expensifyIcons.MoneySearch}
label={translate('common.reports')}
isSelected={selectedTab === NAVIGATION_TABS.SEARCH}
numberOfLines={1}
style={[
styles.textSmall,
styles.textAlignCenter,
styles.mt1Half,
selectedTab === NAVIGATION_TABS.SEARCH ? styles.textBold : styles.textSupporting,
styles.navigationTabBarLabel,
]}
>
{translate('common.reports')}
</Text>
/>
</PressableWithFeedback>
);
}
Expand Down
56 changes: 56 additions & 0 deletions src/components/Navigation/NavigationTabBar/TabBarItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import {View} from 'react-native';
import Icon from '@components/Icon';
import Text from '@components/Text';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
import type IconAsset from '@src/types/utils/IconAsset';

type TabBarItemProps = {
icon: IconAsset;
label: string;
isSelected: boolean;
isHovered?: boolean;
statusIndicatorColor?: string;
numberOfLines?: number;
};

function getIconFill(isSelected: boolean, isHovered: boolean, theme: ReturnType<typeof useTheme>) {
if (isSelected) {
return theme.iconMenu;
}
if (isHovered) {
return theme.success;
}
return theme.icon;
}

function TabBarItem({icon, label, isSelected, isHovered = false, statusIndicatorColor, numberOfLines = 2}: TabBarItemProps) {
const theme = useTheme();
const styles = useThemeStyles();

return (
<>
<View>
<Icon
src={icon}
fill={getIconFill(isSelected, isHovered, theme)}
width={variables.iconBottomBar}
height={variables.iconBottomBar}
/>
{!!statusIndicatorColor && (
<View style={[styles.navigationTabBarStatusIndicator, styles.statusIndicatorColor(statusIndicatorColor), isHovered && {borderColor: theme.sidebarHover}]} />
)}
</View>
<Text
numberOfLines={numberOfLines}
style={[styles.textSmall, styles.textAlignCenter, styles.mt1Half, isSelected ? styles.textBold : styles.textSupporting, styles.navigationTabBarLabel]}
>
{label}
</Text>
</>
);
}

export default TabBarItem;
Loading
Loading