diff --git a/src/components/AddPlaidBankAccount.js b/src/components/AddPlaidBankAccount.js
index 566b6c709423..ec4ddd623929 100644
--- a/src/components/AddPlaidBankAccount.js
+++ b/src/components/AddPlaidBankAccount.js
@@ -9,8 +9,8 @@ import useNetwork from '@hooks/useNetwork';
import KeyboardShortcut from '@libs/KeyboardShortcut';
import Log from '@libs/Log';
import {plaidDataPropTypes} from '@pages/ReimbursementAccount/plaidDataPropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as App from '@userActions/App';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
@@ -83,6 +83,8 @@ function AddPlaidBankAccount({
allowDebit,
isPlaidDisabled,
}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const subscribedKeyboardShortcuts = useRef([]);
const previousNetworkState = useRef();
@@ -186,7 +188,7 @@ function AddPlaidBankAccount({
{lodashGet(plaidData, 'isLoading') && (
diff --git a/src/components/AddressSearch/CurrentLocationButton.js b/src/components/AddressSearch/CurrentLocationButton.js
index 326b82d31e8f..3c7feb8fb70c 100644
--- a/src/components/AddressSearch/CurrentLocationButton.js
+++ b/src/components/AddressSearch/CurrentLocationButton.js
@@ -7,8 +7,8 @@ import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
import useLocalize from '@hooks/useLocalize';
import getButtonState from '@libs/getButtonState';
import colors from '@styles/colors';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Callback that runs when location button is clicked */
@@ -24,6 +24,7 @@ const defaultProps = {
};
function CurrentLocationButton({onPress, isDisabled}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/components/AddressSearch/index.js b/src/components/AddressSearch/index.js
index 61460a93650e..73472beeb48d 100644
--- a/src/components/AddressSearch/index.js
+++ b/src/components/AddressSearch/index.js
@@ -14,9 +14,9 @@ import * as ApiUtils from '@libs/ApiUtils';
import compose from '@libs/compose';
import getCurrentPosition from '@libs/getCurrentPosition';
import * as GooglePlacesUtils from '@libs/GooglePlacesUtils';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import CurrentLocationButton from './CurrentLocationButton';
@@ -144,6 +144,8 @@ const defaultProps = {
// Relevant thread: https://expensify.slack.com/archives/C03TQ48KC/p1634088400387400
// Reference: https://github.com/FaridSafi/react-native-google-places-autocomplete/issues/609#issuecomment-886133839
function AddressSearch(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const [displayListViewBorder, setDisplayListViewBorder] = useState(false);
const [isTyping, setIsTyping] = useState(false);
const [isFocused, setIsFocused] = useState(false);
@@ -392,7 +394,7 @@ function AddressSearch(props) {
listLoaderComponent={
@@ -489,8 +491,8 @@ function AddressSearch(props) {
}}
numberOfLines={2}
isRowScrollable={false}
- listHoverColor={themeColors.border}
- listUnderlayColor={themeColors.buttonPressedBG}
+ listHoverColor={theme.border}
+ listUnderlayColor={theme.buttonPressedBG}
onLayout={(event) => {
// We use the height of the element to determine if we should hide the border of the listView dropdown
// to prevent a lingering border when there are no address suggestions.
diff --git a/src/components/AmountTextInput.js b/src/components/AmountTextInput.js
index 43fd5e6a1b98..bd88712432a8 100644
--- a/src/components/AmountTextInput.js
+++ b/src/components/AmountTextInput.js
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import refPropTypes from './refPropTypes';
import TextInput from './TextInput';
@@ -39,6 +39,7 @@ const defaultProps = {
};
function AmountTextInput(props) {
+ const styles = useThemeStyles();
return (
() => {
ReportActionContextMenu.hideContextMenu();
diff --git a/src/components/AnonymousReportFooter.js b/src/components/AnonymousReportFooter.js
index 2dc4159d1627..387e2ab01930 100644
--- a/src/components/AnonymousReportFooter.js
+++ b/src/components/AnonymousReportFooter.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {Text, View} from 'react-native';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Session from '@userActions/Session';
import AvatarWithDisplayName from './AvatarWithDisplayName';
import Button from './Button';
@@ -29,6 +29,7 @@ const defaultProps = {
};
function AnonymousReportFooter(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/ArchivedReportFooter.js b/src/components/ArchivedReportFooter.js
index 52484355a242..b1fac827d273 100644
--- a/src/components/ArchivedReportFooter.js
+++ b/src/components/ArchivedReportFooter.js
@@ -9,7 +9,7 @@ import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import Banner from './Banner';
@@ -50,6 +50,7 @@ const defaultProps = {
};
function ArchivedReportFooter(props) {
+ const styles = useThemeStyles();
const archiveReason = lodashGet(props.reportClosedAction, 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);
let displayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetails, [props.report.ownerAccountID, 'displayName']);
diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js
index f82fec156f9f..a541950d063d 100755
--- a/src/components/AttachmentModal.js
+++ b/src/components/AttachmentModal.js
@@ -19,9 +19,9 @@ import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import useNativeDriver from '@libs/useNativeDriver';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import * as Policy from '@userActions/Policy';
import CONST from '@src/CONST';
@@ -111,6 +111,8 @@ const defaultProps = {
};
function AttachmentModal(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const onModalHideCallbackRef = useRef(null);
const [isModalOpen, setIsModalOpen] = useState(props.defaultOpen);
const [shouldLoadAttachment, setShouldLoadAttachment] = useState(false);
@@ -411,7 +413,7 @@ function AttachmentModal(props) {
onSubmit={submitAndClose}
onClose={closeModal}
isVisible={isModalOpen}
- backgroundColor={themeColors.componentBG}
+ backgroundColor={theme.componentBG}
onModalShow={() => {
props.onModalShow();
setShouldLoadAttachment(true);
diff --git a/src/components/AttachmentPicker/index.native.js b/src/components/AttachmentPicker/index.native.js
index 0e723d4cf048..5b955ee69dd3 100644
--- a/src/components/AttachmentPicker/index.native.js
+++ b/src/components/AttachmentPicker/index.native.js
@@ -14,7 +14,7 @@ import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
import useLocalize from '@hooks/useLocalize';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as FileUtils from '@libs/fileDownload/FileUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import {defaultProps as baseDefaultProps, propTypes as basePropTypes} from './attachmentPickerPropTypes';
import launchCamera from './launchCamera';
@@ -101,6 +101,7 @@ const getDataForUpload = (fileData) => {
* @returns {JSX.Element}
*/
function AttachmentPicker({type, children, shouldHideCameraOption}) {
+ const styles = useThemeStyles();
const [isVisible, setIsVisible] = useState(false);
const completeAttachmentSelection = useRef();
diff --git a/src/components/Attachments/AttachmentCarousel/AttachmentCarouselCellRenderer.js b/src/components/Attachments/AttachmentCarousel/AttachmentCarouselCellRenderer.js
index 673bb7c224e2..dd2713a38b2b 100644
--- a/src/components/Attachments/AttachmentCarousel/AttachmentCarouselCellRenderer.js
+++ b/src/components/Attachments/AttachmentCarousel/AttachmentCarouselCellRenderer.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {PixelRatio, View} from 'react-native';
import useWindowDimensions from '@hooks/useWindowDimensions';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Cell Container styles */
@@ -14,6 +14,7 @@ const defaultProps = {
};
function AttachmentCarouselCellRenderer(props) {
+ const styles = useThemeStyles();
const {windowWidth, isSmallScreenWidth} = useWindowDimensions();
const modalStyles = styles.centeredModalStyles(isSmallScreenWidth, true);
const style = [props.style, styles.h100, {width: PixelRatio.roundToNearestPixel(windowWidth - (modalStyles.marginHorizontal + modalStyles.borderWidth) * 2)}];
diff --git a/src/components/Attachments/AttachmentCarousel/CarouselButtons.js b/src/components/Attachments/AttachmentCarousel/CarouselButtons.js
index f11bbcc9b187..14a6ea268468 100644
--- a/src/components/Attachments/AttachmentCarousel/CarouselButtons.js
+++ b/src/components/Attachments/AttachmentCarousel/CarouselButtons.js
@@ -8,8 +8,8 @@ import * as Expensicons from '@components/Icon/Expensicons';
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import useWindowDimensions from '@hooks/useWindowDimensions';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Where the arrows should be visible */
@@ -36,6 +36,8 @@ const defaultProps = {
};
function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward, cancelAutoHideArrow, autoHideArrow}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const isBackDisabled = page === 0;
const isForwardDisabled = page === _.size(attachments) - 1;
@@ -51,7 +53,7 @@ function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward
small
innerStyles={[styles.arrowIcon]}
icon={Expensicons.BackArrow}
- iconFill={themeColors.text}
+ iconFill={theme.text}
iconStyles={[styles.mr0]}
onPress={onBack}
onPressIn={cancelAutoHideArrow}
@@ -67,7 +69,7 @@ function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward
small
innerStyles={[styles.arrowIcon]}
icon={Expensicons.ArrowRight}
- iconFill={themeColors.text}
+ iconFill={theme.text}
iconStyles={[styles.mr0]}
onPress={onForward}
onPressIn={cancelAutoHideArrow}
diff --git a/src/components/Attachments/AttachmentCarousel/CarouselItem.js b/src/components/Attachments/AttachmentCarousel/CarouselItem.js
index 38f70057be61..b6cc0cbf21a4 100644
--- a/src/components/Attachments/AttachmentCarousel/CarouselItem.js
+++ b/src/components/Attachments/AttachmentCarousel/CarouselItem.js
@@ -9,7 +9,7 @@ import SafeAreaConsumer from '@components/SafeAreaConsumer';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import ReportAttachmentsContext from '@pages/home/report/ReportAttachmentsContext';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -49,6 +49,7 @@ const defaultProps = {
};
function CarouselItem({item, isFocused, onPress}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {isAttachmentHidden} = useContext(ReportAttachmentsContext);
// eslint-disable-next-line es/no-nullish-coalescing-operators
diff --git a/src/components/Attachments/AttachmentCarousel/Pager/ImageTransformer.js b/src/components/Attachments/AttachmentCarousel/Pager/ImageTransformer.js
index 0839462d4f23..cc1e20cb44e0 100644
--- a/src/components/Attachments/AttachmentCarousel/Pager/ImageTransformer.js
+++ b/src/components/Attachments/AttachmentCarousel/Pager/ImageTransformer.js
@@ -15,7 +15,7 @@ import Animated, {
withDecay,
withSpring,
} from 'react-native-reanimated';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import AttachmentCarouselPagerContext from './AttachmentCarouselPagerContext';
import ImageWrapper from './ImageWrapper';
@@ -60,6 +60,7 @@ const imageTransformerDefaultProps = {
};
function ImageTransformer({imageWidth, imageHeight, imageScaleX, imageScaleY, scaledImageWidth, scaledImageHeight, isActive, children}) {
+ const styles = useThemeStyles();
const {canvasWidth, canvasHeight, onTap, onSwipe, onSwipeSuccess, pagerRef, shouldPagerScroll, isScrolling, onPinchGestureChange} = useContext(AttachmentCarouselPagerContext);
const minImageScale = useMemo(() => Math.min(imageScaleX, imageScaleY), [imageScaleX, imageScaleY]);
diff --git a/src/components/Attachments/AttachmentCarousel/Pager/ImageWrapper.js b/src/components/Attachments/AttachmentCarousel/Pager/ImageWrapper.js
index 3a27d80c5509..b0a8b1f0d083 100644
--- a/src/components/Attachments/AttachmentCarousel/Pager/ImageWrapper.js
+++ b/src/components/Attachments/AttachmentCarousel/Pager/ImageWrapper.js
@@ -2,13 +2,14 @@ import PropTypes from 'prop-types';
import React from 'react';
import {StyleSheet} from 'react-native';
import Animated from 'react-native-reanimated';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const imageWrapperPropTypes = {
children: PropTypes.node.isRequired,
};
function ImageWrapper({children}) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.js b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.js
index c024b025c80e..27790121aab0 100644
--- a/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.js
+++ b/src/components/AutoCompleteSuggestions/BaseAutoCompleteSuggestions.js
@@ -3,8 +3,8 @@ import React, {useEffect, useRef} from 'react';
import {FlatList} from 'react-native-gesture-handler';
import Animated, {Easing, FadeOutDown, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import {propTypes} from './autoCompleteSuggestionsPropTypes';
@@ -29,6 +29,7 @@ const measureHeightOfSuggestionRows = (numRows, isSuggestionPickerLarge) => {
};
function BaseAutoCompleteSuggestions(props) {
+ const styles = useThemeStyles();
const rowHeight = useSharedValue(0);
const scrollRef = useRef(null);
/**
diff --git a/src/components/AutoEmailLink.js b/src/components/AutoEmailLink.js
index eece1a16ca5a..bffd2493aa5d 100644
--- a/src/components/AutoEmailLink.js
+++ b/src/components/AutoEmailLink.js
@@ -2,7 +2,7 @@ import {CONST} from 'expensify-common/lib/CONST';
import PropTypes from 'prop-types';
import React from 'react';
import _ from 'underscore';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Text from './Text';
import TextLink from './TextLink';
@@ -22,6 +22,7 @@ const defaultProps = {
*/
function AutoEmailLink(props) {
+ const styles = useThemeStyles();
return (
{_.map(props.text.split(CONST.REG_EXP.EXTRACT_EMAIL), (str, index) => {
diff --git a/src/components/AutoUpdateTime.js b/src/components/AutoUpdateTime.js
index c85f14ed2c29..1970839ec320 100644
--- a/src/components/AutoUpdateTime.js
+++ b/src/components/AutoUpdateTime.js
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';
import DateUtils from '@libs/DateUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Text from './Text';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
@@ -23,6 +23,7 @@ const propTypes = {
};
function AutoUpdateTime(props) {
+ const styles = useThemeStyles();
/**
* @returns {Date} Returns the locale Date object
*/
diff --git a/src/components/Avatar.js b/src/components/Avatar.js
index 5e414486cc70..0052400bf51a 100644
--- a/src/components/Avatar.js
+++ b/src/components/Avatar.js
@@ -5,9 +5,9 @@ import _ from 'underscore';
import useNetwork from '@hooks/useNetwork';
import * as ReportUtils from '@libs/ReportUtils';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
@@ -55,13 +55,15 @@ const defaultProps = {
iconAdditionalStyles: [],
containerStyles: [],
size: CONST.AVATAR_SIZE.DEFAULT,
- fill: themeColors.icon,
+ fill: undefined,
fallbackIcon: Expensicons.FallbackAvatar,
type: CONST.ICON_TYPE_AVATAR,
name: '',
};
function Avatar(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const [imageError, setImageError] = useState(false);
useNetwork({onReconnect: () => setImageError(false)});
@@ -84,7 +86,7 @@ function Avatar(props) {
const iconStyle = props.imageStyles && props.imageStyles.length ? [StyleUtils.getAvatarStyle(props.size), styles.bgTransparent, ...props.imageStyles] : undefined;
- const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(props.name).fill : props.fill;
+ const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(props.name).fill : props.fill || theme.icon;
const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(props.name) : props.fallbackIcon || Expensicons.FallbackAvatar;
return (
@@ -95,11 +97,11 @@ function Avatar(props) {
src={imageError ? fallbackAvatar : props.source}
height={iconSize}
width={iconSize}
- fill={imageError ? themeColors.offline : iconFillColor}
+ fill={imageError ? theme.offline : iconFillColor}
additionalStyles={[
StyleUtils.getAvatarBorderStyle(props.size, props.type),
isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(props.name) : {},
- imageError ? StyleUtils.getBackgroundColorStyle(themeColors.fallbackIconColor) : {},
+ imageError ? StyleUtils.getBackgroundColorStyle(theme.fallbackIconColor) : {},
...props.iconAdditionalStyles,
]}
/>
diff --git a/src/components/AvatarCropModal/AvatarCropModal.js b/src/components/AvatarCropModal/AvatarCropModal.js
index 9b2b92aa9cee..a37f228a0d0d 100644
--- a/src/components/AvatarCropModal/AvatarCropModal.js
+++ b/src/components/AvatarCropModal/AvatarCropModal.js
@@ -17,9 +17,9 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
import cropOrRotateImage from '@libs/cropOrRotateImage';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ImageCropView from './ImageCropView';
import Slider from './Slider';
@@ -61,6 +61,8 @@ const defaultProps = {
// This component can't be written using class since reanimated API uses hooks.
function AvatarCropModal(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const originalImageWidth = useSharedValue(CONST.AVATAR_CROP_MODAL.INITIAL_SIZE);
const originalImageHeight = useSharedValue(CONST.AVATAR_CROP_MODAL.INITIAL_SIZE);
const translateY = useSharedValue(0);
@@ -381,7 +383,7 @@ function AvatarCropModal(props) {
{/* To avoid layout shift we should hide this component until the image container & image is initialized */}
{!isImageInitialized || !isImageContainerInitialized ? (
@@ -402,8 +404,9 @@ function AvatarCropModal(props) {
+
diff --git a/src/components/AvatarCropModal/ImageCropView.js b/src/components/AvatarCropModal/ImageCropView.js
index cb135cc76c69..a50409da64f4 100644
--- a/src/components/AvatarCropModal/ImageCropView.js
+++ b/src/components/AvatarCropModal/ImageCropView.js
@@ -6,8 +6,8 @@ import Animated, {interpolate, useAnimatedStyle} from 'react-native-reanimated';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import ControlSelection from '@libs/ControlSelection';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import gestureHandlerPropTypes from './gestureHandlerPropTypes';
const propTypes = {
@@ -50,6 +50,7 @@ const defaultProps = {
};
function ImageCropView(props) {
+ const styles = useThemeStyles();
const containerStyle = StyleUtils.getWidthAndHeightStyle(props.containerSize, props.containerSize);
const originalImageHeight = props.originalImageHeight;
diff --git a/src/components/AvatarCropModal/Slider.js b/src/components/AvatarCropModal/Slider.js
index 4281da1e7b99..9df6ac3c0498 100644
--- a/src/components/AvatarCropModal/Slider.js
+++ b/src/components/AvatarCropModal/Slider.js
@@ -6,7 +6,7 @@ import Animated, {useAnimatedStyle} from 'react-native-reanimated';
import Tooltip from '@components/Tooltip';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import ControlSelection from '@libs/ControlSelection';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import gestureHandlerPropTypes from './gestureHandlerPropTypes';
const propTypes = {
@@ -26,6 +26,7 @@ const defaultProps = {
// This component can't be written using class since reanimated API uses hooks.
function Slider(props) {
+ const styles = useThemeStyles();
const sliderValue = props.sliderValue;
const [tooltipIsVisible, setTooltipIsVisible] = useState(true);
diff --git a/src/components/AvatarSkeleton.js b/src/components/AvatarSkeleton.js
index 2a633833f228..d2706447f756 100644
--- a/src/components/AvatarSkeleton.js
+++ b/src/components/AvatarSkeleton.js
@@ -1,15 +1,16 @@
import React from 'react';
import {Circle} from 'react-native-svg';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
import SkeletonViewContentLoader from './SkeletonViewContentLoader';
function AvatarSkeleton() {
+ const theme = useTheme();
return (
{
};
function AvatarWithDisplayName(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const title = ReportUtils.getReportName(props.report);
const subtitle = ReportUtils.getChatRoomSubtitle(props.report);
const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(props.report);
@@ -99,7 +101,7 @@ function AvatarWithDisplayName(props) {
const shouldShowSubscriptAvatar = ReportUtils.shouldReportShowSubscript(props.report);
const isExpenseRequest = ReportUtils.isExpenseRequest(props.report);
const defaultSubscriptSize = isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : props.size;
- const avatarBorderColor = props.isAnonymous ? themeColors.highlightBG : themeColors.componentBG;
+ const avatarBorderColor = props.isAnonymous ? theme.highlightBG : theme.componentBG;
const headerView = (
diff --git a/src/components/AvatarWithImagePicker.js b/src/components/AvatarWithImagePicker.js
index 87bd382e806b..893a02288e77 100644
--- a/src/components/AvatarWithImagePicker.js
+++ b/src/components/AvatarWithImagePicker.js
@@ -9,8 +9,6 @@ import * as FileUtils from '@libs/fileDownload/FileUtils';
import getImageResolution from '@libs/fileDownload/getImageResolution';
import SpinningIndicatorAnimation from '@styles/animation/SpinningIndicatorAnimation';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import AttachmentModal from './AttachmentModal';
@@ -26,6 +24,8 @@ import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import Tooltip from './Tooltip/PopoverAnchorTooltip';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import withNavigationFocus from './withNavigationFocus';
+import withTheme, {withThemePropTypes} from './withTheme';
+import withThemeStyles, {withThemeStylesPropTypes} from './withThemeStyles';
const propTypes = {
/** Avatar source to display */
@@ -95,6 +95,8 @@ const propTypes = {
isFocused: PropTypes.bool.isRequired,
...withLocalizePropTypes,
+ ...withThemeStylesPropTypes,
+ ...withThemePropTypes,
};
const defaultProps = {
@@ -253,8 +255,8 @@ class AvatarWithImagePicker extends React.Component {
const additionalStyles = _.isArray(this.props.style) ? this.props.style : [this.props.style];
return (
-
-
+
+
{this.props.source ? (
)}
-
+
@@ -364,7 +366,7 @@ class AvatarWithImagePicker extends React.Component {
{this.state.validationError && (
@@ -386,4 +388,4 @@ class AvatarWithImagePicker extends React.Component {
AvatarWithImagePicker.propTypes = propTypes;
AvatarWithImagePicker.defaultProps = defaultProps;
-export default compose(withLocalize, withNavigationFocus)(AvatarWithImagePicker);
+export default compose(withLocalize, withNavigationFocus, withThemeStyles, withTheme)(AvatarWithImagePicker);
diff --git a/src/components/AvatarWithIndicator.js b/src/components/AvatarWithIndicator.js
index 05ca65fc64da..f3607b69a73f 100644
--- a/src/components/AvatarWithIndicator.js
+++ b/src/components/AvatarWithIndicator.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import * as UserUtils from '@libs/UserUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Avatar from './Avatar';
import AvatarSkeleton from './AvatarSkeleton';
import * as Expensicons from './Icon/Expensicons';
@@ -30,6 +30,7 @@ const defaultProps = {
};
function AvatarWithIndicator(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx
index 2ccd41575073..22c056dfdfc4 100644
--- a/src/components/Badge.tsx
+++ b/src/components/Badge.tsx
@@ -1,7 +1,7 @@
import React, {useCallback} from 'react';
import {GestureResponderEvent, PressableStateCallbackType, StyleProp, TextStyle, View, ViewStyle} from 'react-native';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import Text from './Text';
@@ -33,12 +33,13 @@ type BadgeProps = {
};
function Badge({success = false, error = false, pressable = false, text, environment = CONST.ENVIRONMENT.DEV, badgeStyles, textStyles, onPress = () => {}}: BadgeProps) {
+ const styles = useThemeStyles();
const textColorStyles = success || error ? styles.textWhite : undefined;
const Wrapper = pressable ? PressableWithoutFeedback : View;
const wrapperStyles: (state: PressableStateCallbackType) => StyleProp = useCallback(
({pressed}) => [styles.badge, styles.ml2, StyleUtils.getBadgeColorStyle(success, error, pressed, environment === CONST.ENVIRONMENT.ADHOC), badgeStyles],
- [success, error, environment, badgeStyles],
+ [styles.badge, styles.ml2, success, error, environment, badgeStyles],
);
return (
diff --git a/src/components/Banner.js b/src/components/Banner.js
index 23226e21eb51..2fcb866334e0 100644
--- a/src/components/Banner.js
+++ b/src/components/Banner.js
@@ -3,8 +3,8 @@ import React, {memo} from 'react';
import {View} from 'react-native';
import compose from '@libs/compose';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import Hoverable from './Hoverable';
import Icon from './Icon';
@@ -56,6 +56,7 @@ const defaultProps = {
};
function Banner(props) {
+ const styles = useThemeStyles();
return (
{(isHovered) => {
diff --git a/src/components/BaseMiniContextMenuItem.js b/src/components/BaseMiniContextMenuItem.js
index b8d7a4a7484b..04a569ba7f36 100644
--- a/src/components/BaseMiniContextMenuItem.js
+++ b/src/components/BaseMiniContextMenuItem.js
@@ -5,8 +5,8 @@ import _ from 'underscore';
import DomUtils from '@libs/DomUtils';
import getButtonState from '@libs/getButtonState';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import Tooltip from './Tooltip/PopoverAnchorTooltip';
@@ -50,6 +50,7 @@ const defaultProps = {
* @returns {JSX.Element}
*/
function BaseMiniContextMenuItem(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/BlockingViews/FullPageNotFoundView.js b/src/components/BlockingViews/FullPageNotFoundView.js
index 5232b5eca8dd..b82474aa0694 100644
--- a/src/components/BlockingViews/FullPageNotFoundView.js
+++ b/src/components/BlockingViews/FullPageNotFoundView.js
@@ -5,7 +5,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Illustrations from '@components/Icon/Illustrations';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import ROUTES from '@src/ROUTES';
import BlockingView from './BlockingView';
@@ -53,6 +53,7 @@ const defaultProps = {
// eslint-disable-next-line rulesdir/no-negated-variables
function FullPageNotFoundView({children, shouldShow, titleKey, subtitleKey, linkKey, onBackButtonPress, shouldShowLink, shouldShowBackButton, onLinkPress}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
if (shouldShow) {
return (
diff --git a/src/components/Button/index.js b/src/components/Button/index.js
index 5fe7dd1fe812..b9aaf8868924 100644
--- a/src/components/Button/index.js
+++ b/src/components/Button/index.js
@@ -10,9 +10,9 @@ import Text from '@components/Text';
import withNavigationFallback from '@components/withNavigationFallback';
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
import HapticFeedback from '@libs/HapticFeedback';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import validateSubmitShortcut from './validateSubmitShortcut';
@@ -127,7 +127,7 @@ const defaultProps = {
shouldShowRightIcon: false,
icon: null,
iconRight: Expensicons.ArrowRight,
- iconFill: themeColors.textLight,
+ iconFill: undefined,
iconStyles: [],
iconRightStyles: [],
isLoading: false,
@@ -201,6 +201,8 @@ function Button({
accessibilityLabel,
forwardedRef,
}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const isFocused = useIsFocused();
const keyboardShortcutCallback = useCallback(
@@ -254,7 +256,7 @@ function Button({
@@ -265,7 +267,7 @@ function Button({
@@ -334,7 +336,7 @@ function Button({
{renderContent()}
{isLoading && (
)}
diff --git a/src/components/ButtonWithDropdownMenu.js b/src/components/ButtonWithDropdownMenu.js
index 7c88d9202b78..15f2e2f4d6de 100644
--- a/src/components/ButtonWithDropdownMenu.js
+++ b/src/components/ButtonWithDropdownMenu.js
@@ -3,9 +3,9 @@ import React, {useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import _ from 'underscore';
import useWindowDimensions from '@hooks/useWindowDimensions';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import Button from './Button';
import Icon from './Icon';
@@ -72,6 +72,8 @@ const defaultProps = {
};
function ButtonWithDropdownMenu(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const [selectedItemIndex, setSelectedItemIndex] = useState(0);
const [isMenuVisible, setIsMenuVisible] = useState(false);
const [popoverAnchorPosition, setPopoverAnchorPosition] = useState(null);
@@ -134,7 +136,7 @@ function ButtonWithDropdownMenu(props) {
diff --git a/src/components/CardPreview.js b/src/components/CardPreview.js
index 9f59ca140ce5..df944d930a92 100644
--- a/src/components/CardPreview.js
+++ b/src/components/CardPreview.js
@@ -4,7 +4,7 @@ import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import ExpensifyCardImage from '@assets/images/expensify-card.svg';
import usePrivatePersonalDetails from '@hooks/usePrivatePersonalDetails';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import ONYXKEYS from '@src/ONYXKEYS';
import Text from './Text';
@@ -33,6 +33,7 @@ const defaultProps = {
};
function CardPreview({privatePersonalDetails: {legalFirstName, legalLastName}, session: {email}}) {
+ const styles = useThemeStyles();
usePrivatePersonalDetails();
const cardHolder = legalFirstName && legalLastName ? `${legalFirstName} ${legalLastName}` : email;
diff --git a/src/components/CategoryPicker/index.js b/src/components/CategoryPicker/index.js
index 156007aea76e..ff7087df91dd 100644
--- a/src/components/CategoryPicker/index.js
+++ b/src/components/CategoryPicker/index.js
@@ -5,12 +5,13 @@ import _ from 'underscore';
import OptionsSelector from '@components/OptionsSelector';
import useLocalize from '@hooks/useLocalize';
import * as OptionsListUtils from '@libs/OptionsListUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {defaultProps, propTypes} from './categoryPickerPropTypes';
function CategoryPicker({selectedCategory, policyCategories, policyRecentlyUsedCategories, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const [searchValue, setSearchValue] = useState('');
diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js
index 5734ad2fed26..4b9ce922aacb 100644
--- a/src/components/Checkbox.js
+++ b/src/components/Checkbox.js
@@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
@@ -67,6 +67,8 @@ const defaultProps = {
};
function Checkbox(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const handleSpaceKey = (event) => {
if (event.code !== 'Space') {
return;
@@ -115,7 +117,7 @@ function Checkbox(props) {
{props.isChecked && (
diff --git a/src/components/CheckboxWithLabel.js b/src/components/CheckboxWithLabel.js
index 86dba1d2a932..0a90a9be46e2 100644
--- a/src/components/CheckboxWithLabel.js
+++ b/src/components/CheckboxWithLabel.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React, {useState} from 'react';
import {View} from 'react-native';
import _ from 'underscore';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import Checkbox from './Checkbox';
import FormHelpMessage from './FormHelpMessage';
@@ -83,6 +83,7 @@ const defaultProps = {
};
function CheckboxWithLabel(props) {
+ const styles = useThemeStyles();
// We need to pick the first value that is strictly a boolean
// https://github.com/Expensify/App/issues/16885#issuecomment-1520846065
const [isChecked, setIsChecked] = useState(() => _.find([props.value, props.defaultValue, props.isChecked], (value) => _.isBoolean(value)));
diff --git a/src/components/CommunicationsLink.js b/src/components/CommunicationsLink.js
index f09fecea5239..dbbe5737b3aa 100644
--- a/src/components/CommunicationsLink.js
+++ b/src/components/CommunicationsLink.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import Clipboard from '@libs/Clipboard';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import ContextMenuItem from './ContextMenuItem';
import * as Expensicons from './Icon/Expensicons';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
@@ -26,6 +26,7 @@ const defaultProps = {
};
function CommunicationsLink(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/Composer/index.js b/src/components/Composer/index.js
index d02fdd2563b1..4c61a5b5bba5 100755
--- a/src/components/Composer/index.js
+++ b/src/components/Composer/index.js
@@ -16,9 +16,9 @@ import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullCompo
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -57,7 +57,7 @@ const propTypes = {
isDisabled: PropTypes.bool,
/** Set focus to this component the first time it renders.
- Override this in case you need to set focus on one field out of many, or when you want to disable autoFocus */
+ Override this in case you need to set focus on one field out of many, or when you want to disable autoFocus */
autoFocus: PropTypes.bool,
/** Update selection position on change */
@@ -169,6 +169,8 @@ function Composer({
isComposerFullSize,
...props
}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {windowWidth} = useWindowDimensions();
const textRef = useRef(null);
const textInput = useRef(null);
@@ -448,7 +450,8 @@ function Composer({
StyleUtils.getComposeTextAreaPadding(numberOfLines, isComposerFullSize),
Browser.isMobileSafari() || Browser.isSafari() ? styles.rtlTextRenderForSafari : {},
],
- [style, maxLines, numberOfLines, isComposerFullSize],
+
+ [numberOfLines, maxLines, styles.overflowHidden, styles.rtlTextRenderForSafari, style, isComposerFullSize],
);
return (
@@ -456,7 +459,7 @@ function Composer({
(textInput.current = el)}
selection={selection}
style={inputStyleMemo}
diff --git a/src/components/ConfirmContent.js b/src/components/ConfirmContent.js
index 6142322848d0..ff8ee4f861a4 100644
--- a/src/components/ConfirmContent.js
+++ b/src/components/ConfirmContent.js
@@ -4,7 +4,7 @@ import {View} from 'react-native';
import _ from 'underscore';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import Button from './Button';
import Header from './Header';
@@ -87,6 +87,7 @@ const defaultProps = {
};
function ConfirmContent(props) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {isOffline} = useNetwork();
diff --git a/src/components/ConfirmationPage.js b/src/components/ConfirmationPage.js
index 22e29dca519d..ac56ea3d22e9 100644
--- a/src/components/ConfirmationPage.js
+++ b/src/components/ConfirmationPage.js
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Button from './Button';
import FixedFooter from './FixedFooter';
import Lottie from './Lottie';
@@ -39,6 +39,7 @@ const defaultProps = {
};
function ConfirmationPage(props) {
+ const styles = useThemeStyles();
return (
<>
diff --git a/src/components/ConnectBankAccountButton.js b/src/components/ConnectBankAccountButton.js
index 2c66bcc200da..6afd3d57d4e6 100644
--- a/src/components/ConnectBankAccountButton.js
+++ b/src/components/ConnectBankAccountButton.js
@@ -3,7 +3,7 @@ import React from 'react';
import {View} from 'react-native';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as ReimbursementAccount from '@userActions/ReimbursementAccount';
import Button from './Button';
import * as Expensicons from './Icon/Expensicons';
@@ -30,6 +30,7 @@ const defaultProps = {
};
function ConnectBankAccountButton(props) {
+ const styles = useThemeStyles();
const activeRoute = Navigation.getActiveRouteWithoutParams();
return props.network.isOffline ? (
diff --git a/src/components/ContextMenuItem.js b/src/components/ContextMenuItem.js
index 80d4855392a4..d0a43badc5e3 100644
--- a/src/components/ContextMenuItem.js
+++ b/src/components/ContextMenuItem.js
@@ -4,8 +4,8 @@ import useThrottledButtonState from '@hooks/useThrottledButtonState';
import useWindowDimensions from '@hooks/useWindowDimensions';
import getButtonState from '@libs/getButtonState';
import getContextMenuItemStyles from '@styles/getContextMenuItemStyles';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import BaseMiniContextMenuItem from './BaseMiniContextMenuItem';
import Icon from './Icon';
import MenuItem from './MenuItem';
@@ -53,6 +53,7 @@ const defaultProps = {
};
function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini, description, isAnonymousAction, isFocused, innerRef}) {
+ const styles = useThemeStyles();
const {windowWidth} = useWindowDimensions();
const [isThrottledButtonActive, setThrottledButtonInactive] = useThrottledButtonState();
diff --git a/src/components/CountrySelector.js b/src/components/CountrySelector.js
index c2426c5b7b0b..13fc215f1d8c 100644
--- a/src/components/CountrySelector.js
+++ b/src/components/CountrySelector.js
@@ -3,7 +3,7 @@ import React, {useEffect} from 'react';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import ROUTES from '@src/ROUTES';
import FormHelpMessage from './FormHelpMessage';
import MenuItemWithTopDescription from './MenuItemWithTopDescription';
@@ -33,6 +33,7 @@ const defaultProps = {
};
function CountrySelector({errorText, value: countryCode, onInputChange, forwardedRef}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const title = countryCode ? translate(`allCountries.${countryCode}`) : '';
diff --git a/src/components/CurrencySymbolButton.js b/src/components/CurrencySymbolButton.js
index ca7816a9f117..4d43ec3d93e0 100644
--- a/src/components/CurrencySymbolButton.js
+++ b/src/components/CurrencySymbolButton.js
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
import Text from './Text';
@@ -16,6 +16,7 @@ const propTypes = {
};
function CurrencySymbolButton({onCurrencyButtonPress, currencySymbol}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx
index 3a87702b48e4..685db8031330 100644
--- a/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx
+++ b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx
@@ -3,9 +3,9 @@ import {View} from 'react-native';
import {Circle, Rect} from 'react-native-svg';
import {ValueOf} from 'type-fest';
import SkeletonViewContentLoader from '@components/SkeletonViewContentLoader';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
@@ -23,12 +23,9 @@ type CurrentUserPersonalDetailsSkeletonViewProps = {
foregroundColor?: string;
};
-function CurrentUserPersonalDetailsSkeletonView({
- shouldAnimate = true,
- avatarSize = CONST.AVATAR_SIZE.LARGE,
- backgroundColor = themeColors.highlightBG,
- foregroundColor = themeColors.border,
-}: CurrentUserPersonalDetailsSkeletonViewProps) {
+function CurrentUserPersonalDetailsSkeletonView({shouldAnimate = true, avatarSize = CONST.AVATAR_SIZE.LARGE, backgroundColor, foregroundColor}: CurrentUserPersonalDetailsSkeletonViewProps) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const avatarPlaceholderSize = StyleUtils.getAvatarSize(avatarSize);
const avatarPlaceholderRadius = avatarPlaceholderSize / 2;
const spaceBetweenAvatarAndHeadline = styles.mb3.marginBottom + styles.mt1.marginTop + (variables.lineHeightXXLarge - variables.fontSizeXLarge) / 2;
@@ -39,8 +36,8 @@ function CurrentUserPersonalDetailsSkeletonView({
{formattedBalance};
}
diff --git a/src/components/CustomStatusBar/index.js b/src/components/CustomStatusBar/index.js
index 2ffd763bf088..a724c71059ef 100644
--- a/src/components/CustomStatusBar/index.js
+++ b/src/components/CustomStatusBar/index.js
@@ -1,23 +1,24 @@
import React, {useEffect} from 'react';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
import StatusBar from '@libs/StatusBar';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
function CustomStatusBar() {
+ const theme = useTheme();
useEffect(() => {
Navigation.isNavigationReady().then(() => {
// Set the status bar colour depending on the current route.
// If we don't have any colour defined for a route, fall back to
// appBG color.
const currentRoute = navigationRef.getCurrentRoute();
- let currentScreenBackgroundColor = themeColors.appBG;
- if (currentRoute && 'name' in currentRoute && currentRoute.name in themeColors.PAGE_BACKGROUND_COLORS) {
- currentScreenBackgroundColor = themeColors.PAGE_BACKGROUND_COLORS[currentRoute.name];
+ let currentScreenBackgroundColor = theme.appBG;
+ if (currentRoute && 'name' in currentRoute && currentRoute.name in theme.PAGE_BACKGROUND_COLORS) {
+ currentScreenBackgroundColor = theme.PAGE_BACKGROUND_COLORS[currentRoute.name];
}
StatusBar.setBarStyle('light-content', true);
StatusBar.setBackgroundColor(currentScreenBackgroundColor);
});
- }, []);
+ }, [theme.PAGE_BACKGROUND_COLORS, theme.appBG]);
return ;
}
diff --git a/src/components/DatePicker/index.android.js b/src/components/DatePicker/index.android.js
index 17d1e2e14e71..5e7086fb78ad 100644
--- a/src/components/DatePicker/index.android.js
+++ b/src/components/DatePicker/index.android.js
@@ -3,11 +3,12 @@ import {format, parseISO} from 'date-fns';
import React, {forwardRef, useCallback, useImperativeHandle, useRef, useState} from 'react';
import {Keyboard} from 'react-native';
import TextInput from '@components/TextInput';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import {defaultProps, propTypes} from './datepickerPropTypes';
const DatePicker = forwardRef(({value, defaultValue, label, placeholder, errorText, containerStyles, disabled, onBlur, onInputChange, maxDate, minDate}, outerRef) => {
+ const styles = useThemeStyles();
const ref = useRef();
const [isPickerVisible, setIsPickerVisible] = useState(false);
diff --git a/src/components/DatePicker/index.ios.js b/src/components/DatePicker/index.ios.js
index 8b884c29b07f..44a825aa8183 100644
--- a/src/components/DatePicker/index.ios.js
+++ b/src/components/DatePicker/index.ios.js
@@ -7,12 +7,14 @@ import Popover from '@components/Popover';
import TextInput from '@components/TextInput';
import useKeyboardState from '@hooks/useKeyboardState';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import {defaultProps, propTypes} from './datepickerPropTypes';
function DatePicker({value, defaultValue, innerRef, onInputChange, preferredLocale, minDate, maxDate, label, disabled, onBlur, placeholder, containerStyles, errorText}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const dateValue = value || defaultValue;
const [isPickerVisible, setIsPickerVisible] = useState(false);
const [selectedDate, setSelectedDate] = useState(dateValue ? new Date(dateValue) : new Date());
@@ -104,12 +106,13 @@ function DatePicker({value, defaultValue, innerRef, onInputChange, preferredLoca
+
diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.js b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.js
index 671744a3d59c..3c7366949ac1 100644
--- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.js
+++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.js
@@ -10,8 +10,8 @@ import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -33,6 +33,8 @@ const defaultProps = {
};
function DeeplinkRedirectLoadingIndicator({translate, openLinkInBrowser, session}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
return (
@@ -56,7 +58,7 @@ function DeeplinkRedirectLoadingIndicator({translate, openLinkInBrowser, session
diff --git a/src/components/DisplayNames/DisplayNamesTooltipItem.tsx b/src/components/DisplayNames/DisplayNamesTooltipItem.tsx
index 45cdb340cc98..82f9c5799b78 100644
--- a/src/components/DisplayNames/DisplayNamesTooltipItem.tsx
+++ b/src/components/DisplayNames/DisplayNamesTooltipItem.tsx
@@ -3,7 +3,7 @@ import {Text as RNText, StyleProp, TextStyle} from 'react-native';
import Text from '@components/Text';
import UserDetailsTooltip from '@components/UserDetailsTooltip';
import {AvatarSource} from '@libs/UserUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
type DisplayNamesTooltipItemProps = {
index?: number;
@@ -40,6 +40,7 @@ function DisplayNamesTooltipItem({
textStyles = [],
childRefs = {current: []},
}: DisplayNamesTooltipItemProps) {
+ const styles = useThemeStyles();
const tooltipIndexBridge = useCallback(() => getTooltipShiftX(index), [getTooltipShiftX, index]);
return (
diff --git a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx
index 43cfab23d46f..8c8720c7c99f 100644
--- a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx
+++ b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx
@@ -2,13 +2,14 @@ import React, {Fragment, useCallback, useRef} from 'react';
import {Text as RNText, View} from 'react-native';
import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import DisplayNamesTooltipItem from './DisplayNamesTooltipItem';
import DisplayNamesProps from './types';
type HTMLElementWithText = HTMLElement & RNText;
function DisplayNamesWithToolTip({shouldUseFullTitle, fullTitle, displayNamesWithTooltips, textStyles = [], numberOfLines = 1}: DisplayNamesProps) {
+ const styles = useThemeStyles();
const containerRef = useRef(null);
const childRefs = useRef([]);
const isEllipsisActive = !!containerRef.current?.offsetWidth && !!containerRef.current?.scrollWidth && containerRef.current.offsetWidth < containerRef.current.scrollWidth;
diff --git a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx
index 8779a58cf4d6..1854ebe2353d 100644
--- a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx
+++ b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import {StyleProp, TextStyle} from 'react-native';
import Text from '@components/Text';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
type DisplayNamesWithoutTooltipProps = {
/** The full title of the DisplayNames component (not split up) */
@@ -15,6 +15,7 @@ type DisplayNamesWithoutTooltipProps = {
};
function DisplayNamesWithoutTooltip({textStyles = [], numberOfLines = 1, fullTitle = ''}: DisplayNamesWithoutTooltipProps) {
+ const styles = useThemeStyles();
return (
+
{translate('eReceipt.guaranteed')}
diff --git a/src/components/DistanceMapView/index.android.js b/src/components/DistanceMapView/index.android.js
index 358b2f483a2b..848167de653d 100644
--- a/src/components/DistanceMapView/index.android.js
+++ b/src/components/DistanceMapView/index.android.js
@@ -6,11 +6,12 @@ import * as Expensicons from '@components/Icon/Expensicons';
import MapView from '@components/MapView';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as distanceMapViewPropTypes from './distanceMapViewPropTypes';
function DistanceMapView(props) {
+ const styles = useThemeStyles();
const [isMapReady, setIsMapReady] = useState(false);
const {isOffline} = useNetwork();
const {translate} = useLocalize();
diff --git a/src/components/DistanceRequest/DistanceRequestFooter.js b/src/components/DistanceRequest/DistanceRequestFooter.js
index 4d4335781b72..f53fadb8ab87 100644
--- a/src/components/DistanceRequest/DistanceRequestFooter.js
+++ b/src/components/DistanceRequest/DistanceRequestFooter.js
@@ -13,8 +13,8 @@ import transactionPropTypes from '@components/transactionPropTypes';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import * as TransactionUtils from '@libs/TransactionUtils';
-import styles from '@styles/styles';
-import theme from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -55,6 +55,8 @@ const defaultProps = {
transaction: {},
};
function DistanceRequestFooter({waypoints, transaction, mapboxAccessToken, navigateToWaypointEditPage}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {isOffline} = useNetwork();
const {translate} = useLocalize();
@@ -94,7 +96,7 @@ function DistanceRequestFooter({waypoints, transaction, mapboxAccessToken, navig
}),
(waypoint) => waypoint,
),
- [waypoints, lastWaypointIndex],
+ [waypoints, lastWaypointIndex, theme.icon],
);
return (
diff --git a/src/components/DistanceRequest/DistanceRequestRenderItem.js b/src/components/DistanceRequest/DistanceRequestRenderItem.js
index 0ee45febb21a..1735e244a347 100644
--- a/src/components/DistanceRequest/DistanceRequestRenderItem.js
+++ b/src/components/DistanceRequest/DistanceRequestRenderItem.js
@@ -5,7 +5,7 @@ import _ from 'underscore';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import useLocalize from '@hooks/useLocalize';
-import theme from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
const propTypes = {
/** The waypoints for the distance request */
@@ -48,6 +48,7 @@ const defaultProps = {
};
function DistanceRequestRenderItem({waypoints, item, onSecondaryInteraction, getIndex, isActive, onPress, disabled}) {
+ const theme = useTheme();
const {translate} = useLocalize();
const numberOfWaypoints = _.size(waypoints);
const lastWaypointIndex = numberOfWaypoints - 1;
diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js
index e702ab111921..6fa5dfede620 100644
--- a/src/components/DistanceRequest/index.js
+++ b/src/components/DistanceRequest/index.js
@@ -19,7 +19,7 @@ import * as IOUUtils from '@libs/IOUUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as TransactionUtils from '@libs/TransactionUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as MapboxToken from '@userActions/MapboxToken';
import * as Transaction from '@userActions/Transaction';
@@ -65,6 +65,7 @@ const defaultProps = {
};
function DistanceRequest({transactionID, report, transaction, route, isEditingRequest, onSubmit}) {
+ const styles = useThemeStyles();
const {isOffline} = useNetwork();
const {translate} = useLocalize();
diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js
index 26e01f0eee8a..ac0ac15f437d 100644
--- a/src/components/DotIndicatorMessage.js
+++ b/src/components/DotIndicatorMessage.js
@@ -4,9 +4,9 @@ import {View} from 'react-native';
import _ from 'underscore';
import * as Localize from '@libs/Localize';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import Text from './Text';
@@ -39,6 +39,8 @@ const defaultProps = {
};
function DotIndicatorMessage(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
if (_.isEmpty(props.messages)) {
return null;
}
@@ -65,7 +67,7 @@ function DotIndicatorMessage(props) {
diff --git a/src/components/DragAndDrop/NoDropZone/index.tsx b/src/components/DragAndDrop/NoDropZone/index.tsx
index 5c914b646e0c..9f2c700b8918 100644
--- a/src/components/DragAndDrop/NoDropZone/index.tsx
+++ b/src/components/DragAndDrop/NoDropZone/index.tsx
@@ -1,10 +1,11 @@
import React, {useRef} from 'react';
import {View} from 'react-native';
import useDragAndDrop from '@hooks/useDragAndDrop';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import type NoDropZoneProps from './types';
function NoDropZone({children}: NoDropZoneProps) {
+ const styles = useThemeStyles();
const noDropZone = useRef(null);
useDragAndDrop({
diff --git a/src/components/DragAndDrop/Provider/index.tsx b/src/components/DragAndDrop/Provider/index.tsx
index fbf9ffd30e80..761c512497ac 100644
--- a/src/components/DragAndDrop/Provider/index.tsx
+++ b/src/components/DragAndDrop/Provider/index.tsx
@@ -3,7 +3,7 @@ import Str from 'expensify-common/lib/str';
import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import {View} from 'react-native';
import useDragAndDrop from '@hooks/useDragAndDrop';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import type {DragAndDropContextParams, DragAndDropProviderProps, SetOnDropHandlerCallback} from './types';
const DragAndDropContext = React.createContext({});
@@ -13,6 +13,7 @@ function shouldAcceptDrop(event: DragEvent): boolean {
}
function DragAndDropProvider({children, isDisabled = false, setIsDraggingOver = () => {}}: DragAndDropProviderProps) {
+ const styles = useThemeStyles();
const dropZone = useRef(null);
const dropZoneID = useRef(Str.guid('drag-n-drop'));
diff --git a/src/components/DraggableList/index.native.tsx b/src/components/DraggableList/index.native.tsx
index d7e42a5f5525..e7ff058234b7 100644
--- a/src/components/DraggableList/index.native.tsx
+++ b/src/components/DraggableList/index.native.tsx
@@ -1,10 +1,11 @@
import React from 'react';
import DraggableFlatList from 'react-native-draggable-flatlist';
import {FlatList} from 'react-native-gesture-handler';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import type {DraggableListProps} from './types';
function DraggableList({renderClone, shouldUsePortal, ...viewProps}: DraggableListProps, ref: React.ForwardedRef>) {
+ const styles = useThemeStyles();
return (
(
}: DraggableListProps,
ref: React.ForwardedRef,
) {
+ const styles = useThemeStyles();
/**
* Function to be called when the user finishes dragging an item
* It will reorder the list and call the callback function
diff --git a/src/components/EReceipt.js b/src/components/EReceipt.js
index 7c186216a1fa..85c753c7ccb3 100644
--- a/src/components/EReceipt.js
+++ b/src/components/EReceipt.js
@@ -6,8 +6,8 @@ import useLocalize from '@hooks/useLocalize';
import * as CardUtils from '@libs/CardUtils';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -30,6 +30,7 @@ const defaultProps = {
};
function EReceipt({transaction, transactionID}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
// Get receipt colorway, or default to Yellow.
diff --git a/src/components/EReceiptThumbnail.js b/src/components/EReceiptThumbnail.js
index fc69601983f8..f54e246b8b1e 100644
--- a/src/components/EReceiptThumbnail.js
+++ b/src/components/EReceiptThumbnail.js
@@ -3,8 +3,8 @@ import React, {useState} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -42,6 +42,7 @@ function getBackgroundImage(transaction) {
}
function EReceiptThumbnail({transaction}) {
+ const styles = useThemeStyles();
// Get receipt colorway, or default to Yellow.
const {backgroundColor: primaryColor, color: secondaryColor} = StyleUtils.getEReceiptColorStyles(StyleUtils.getEReceiptColorCode(transaction));
diff --git a/src/components/EmojiPicker/CategoryShortcutBar.js b/src/components/EmojiPicker/CategoryShortcutBar.js
index bab1e344da40..c0c9fb8ea161 100644
--- a/src/components/EmojiPicker/CategoryShortcutBar.js
+++ b/src/components/EmojiPicker/CategoryShortcutBar.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import _ from 'underscore';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CategoryShortcutButton from './CategoryShortcutButton';
const propTypes = {
@@ -20,6 +20,7 @@ const propTypes = {
};
function CategoryShortcutBar(props) {
+ const styles = useThemeStyles();
return (
{_.map(props.headerEmojis, (headerEmoji, i) => (
diff --git a/src/components/EmojiPicker/CategoryShortcutButton.js b/src/components/EmojiPicker/CategoryShortcutButton.js
index 3b12afce0d08..6ced702b316c 100644
--- a/src/components/EmojiPicker/CategoryShortcutButton.js
+++ b/src/components/EmojiPicker/CategoryShortcutButton.js
@@ -5,9 +5,9 @@ import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeed
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
@@ -23,6 +23,8 @@ const propTypes = {
};
function CategoryShortcutButton(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const [isHighlighted, setIsHighlighted] = useState(false);
@@ -41,7 +43,7 @@ function CategoryShortcutButton(props) {
role={CONST.ACCESSIBILITY_ROLE.BUTTON}
>
{
+ const styles = useThemeStyles();
const [isEmojiPickerVisible, setIsEmojiPickerVisible] = useState(false);
const [emojiPopoverAnchorPosition, setEmojiPopoverAnchorPosition] = useState({
horizontal: 0,
diff --git a/src/components/EmojiPicker/EmojiPickerButton.js b/src/components/EmojiPicker/EmojiPickerButton.js
index ddfa6b89c899..440f5e3beff1 100644
--- a/src/components/EmojiPicker/EmojiPickerButton.js
+++ b/src/components/EmojiPicker/EmojiPickerButton.js
@@ -8,8 +8,8 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withNavigationFocus from '@components/withNavigationFocus';
import compose from '@libs/compose';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as EmojiPickerAction from '@userActions/EmojiPickerAction';
const propTypes = {
@@ -32,6 +32,7 @@ const defaultProps = {
};
function EmojiPickerButton(props) {
+ const styles = useThemeStyles();
const emojiPopoverAnchor = useRef(null);
useEffect(() => EmojiPickerAction.resetEmojiPopoverAnchor, []);
diff --git a/src/components/EmojiPicker/EmojiPickerButtonDropdown.js b/src/components/EmojiPicker/EmojiPickerButtonDropdown.js
index bf0527c67768..7b4f4066593c 100644
--- a/src/components/EmojiPicker/EmojiPickerButtonDropdown.js
+++ b/src/components/EmojiPicker/EmojiPickerButtonDropdown.js
@@ -8,8 +8,8 @@ import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as EmojiPickerAction from '@userActions/EmojiPickerAction';
import CONST from '@src/CONST';
@@ -25,6 +25,7 @@ const defaultProps = {
};
function EmojiPickerButtonDropdown(props) {
+ const styles = useThemeStyles();
const emojiPopoverAnchor = useRef(null);
useEffect(() => EmojiPickerAction.resetEmojiPopoverAnchor, []);
diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js
index 8a4653dc307e..772c32ff4a88 100644
--- a/src/components/EmojiPicker/EmojiPickerMenu/index.native.js
+++ b/src/components/EmojiPicker/EmojiPickerMenu/index.native.js
@@ -15,8 +15,8 @@ import useSingleExecution from '@hooks/useSingleExecution';
import useWindowDimensions from '@hooks/useWindowDimensions';
import compose from '@libs/compose';
import * as EmojiUtils from '@libs/EmojiUtils';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -42,6 +42,7 @@ const defaultProps = {
};
function EmojiPickerMenu({preferredLocale, onEmojiSelected, preferredSkinTone, translate, frequentlyUsedEmojis}) {
+ const styles = useThemeStyles();
const emojiList = useAnimatedRef();
// eslint-disable-next-line react-hooks/exhaustive-deps
const allEmojis = useMemo(() => EmojiUtils.mergeEmojisWithFrequentlyUsedEmojis(emojis), [frequentlyUsedEmojis]);
diff --git a/src/components/EmojiPicker/EmojiPickerMenuItem/index.js b/src/components/EmojiPicker/EmojiPickerMenuItem/index.js
index 451e2e939a09..24f876841ff7 100644
--- a/src/components/EmojiPicker/EmojiPickerMenuItem/index.js
+++ b/src/components/EmojiPicker/EmojiPickerMenuItem/index.js
@@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Text from '@components/Text';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import * as Browser from '@libs/Browser';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
import CONST from '@src/CONST';
@@ -32,6 +32,7 @@ const propTypes = {
/** Whether the menu item should be highlighted or not */
isHighlighted: PropTypes.bool,
+ ...withThemeStylesPropTypes,
};
class EmojiPickerMenuItem extends PureComponent {
@@ -94,15 +95,15 @@ class EmojiPickerMenuItem extends PureComponent {
onBlur={this.props.onBlur}
ref={(ref) => (this.ref = ref)}
style={({pressed}) => [
- this.props.isFocused ? styles.emojiItemKeyboardHighlighted : {},
- this.state.isHovered || this.props.isHighlighted ? styles.emojiItemHighlighted : {},
+ this.props.isFocused ? this.props.themeStyles.emojiItemKeyboardHighlighted : {},
+ this.state.isHovered || this.props.isHighlighted ? this.props.themeStyles.emojiItemHighlighted : {},
Browser.isMobile() && StyleUtils.getButtonBackgroundColorStyle(getButtonState(false, pressed)),
- styles.emojiItem,
+ this.props.themeStyles.emojiItem,
]}
accessibilityLabel={this.props.emoji}
role={CONST.ACCESSIBILITY_ROLE.BUTTON}
>
- {this.props.emoji}
+ {this.props.emoji}
);
}
@@ -120,7 +121,9 @@ EmojiPickerMenuItem.defaultProps = {
// Significantly speeds up re-renders of the EmojiPickerMenu's FlatList
// by only re-rendering at most two EmojiPickerMenuItems that are highlighted/un-highlighted per user action.
-export default React.memo(
- EmojiPickerMenuItem,
- (prevProps, nextProps) => prevProps.isFocused === nextProps.isFocused && prevProps.isHighlighted === nextProps.isHighlighted && prevProps.emoji === nextProps.emoji,
+export default withThemeStyles(
+ React.memo(
+ EmojiPickerMenuItem,
+ (prevProps, nextProps) => prevProps.isFocused === nextProps.isFocused && prevProps.isHighlighted === nextProps.isHighlighted && prevProps.emoji === nextProps.emoji,
+ ),
);
diff --git a/src/components/EmojiPicker/EmojiPickerMenuItem/index.native.js b/src/components/EmojiPicker/EmojiPickerMenuItem/index.native.js
index 6ebaa3391992..151fabf85be3 100644
--- a/src/components/EmojiPicker/EmojiPickerMenuItem/index.native.js
+++ b/src/components/EmojiPicker/EmojiPickerMenuItem/index.native.js
@@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Text from '@components/Text';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import getButtonState from '@libs/getButtonState';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
import CONST from '@src/CONST';
@@ -34,6 +34,7 @@ const propTypes = {
/** Whether the emoji is highlighted by the keyboard/mouse */
isUsingKeyboardMovement: PropTypes.bool,
+ ...withThemeStylesPropTypes,
};
class EmojiPickerMenuItem extends PureComponent {
@@ -72,14 +73,14 @@ class EmojiPickerMenuItem extends PureComponent {
ref={(ref) => (this.ref = ref)}
style={({pressed}) => [
StyleUtils.getButtonBackgroundColorStyle(getButtonState(false, pressed)),
- this.props.isHighlighted && this.props.isUsingKeyboardMovement ? styles.emojiItemKeyboardHighlighted : {},
- this.props.isHighlighted && !this.props.isUsingKeyboardMovement ? styles.emojiItemHighlighted : {},
- styles.emojiItem,
+ this.props.isHighlighted && this.props.isUsingKeyboardMovement ? this.props.themeStyles.emojiItemKeyboardHighlighted : {},
+ this.props.isHighlighted && !this.props.isUsingKeyboardMovement ? this.props.themeStyles.emojiItemHighlighted : {},
+ this.props.themeStyles.emojiItem,
]}
accessibilityLabel={this.props.emoji}
role={CONST.ACCESSIBILITY_ROLE.BUTTON}
>
- {this.props.emoji}
+ {this.props.emoji}
);
}
@@ -98,8 +99,10 @@ EmojiPickerMenuItem.defaultProps = {
// Significantly speeds up re-renders of the EmojiPickerMenu's FlatList
// by only re-rendering at most two EmojiPickerMenuItems that are highlighted/un-highlighted per user action.
-export default React.memo(
- EmojiPickerMenuItem,
- (prevProps, nextProps) =>
- prevProps.isHighlighted === nextProps.isHighlighted && prevProps.emoji === nextProps.emoji && prevProps.isUsingKeyboardMovement === nextProps.isUsingKeyboardMovement,
+export default withThemeStyles(
+ React.memo(
+ EmojiPickerMenuItem,
+ (prevProps, nextProps) =>
+ prevProps.isHighlighted === nextProps.isHighlighted && prevProps.emoji === nextProps.emoji && prevProps.isUsingKeyboardMovement === nextProps.isUsingKeyboardMovement,
+ ),
);
diff --git a/src/components/EmojiPicker/EmojiSkinToneList.js b/src/components/EmojiPicker/EmojiSkinToneList.js
index 29c39c335b14..25fc9ad0836a 100644
--- a/src/components/EmojiPicker/EmojiSkinToneList.js
+++ b/src/components/EmojiPicker/EmojiSkinToneList.js
@@ -6,7 +6,7 @@ import * as Emojis from '@assets/emojis';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import EmojiPickerMenuItem from './EmojiPickerMenuItem';
import getSkinToneEmojiFromIndex from './getSkinToneEmojiFromIndex';
@@ -23,6 +23,7 @@ const propTypes = {
};
function EmojiSkinToneList(props) {
+ const styles = useThemeStyles();
const [highlightedIndex, setHighlightedIndex] = useState(null);
const [isSkinToneListVisible, setIsSkinToneListVisible] = useState(false);
diff --git a/src/components/EmojiSuggestions.tsx b/src/components/EmojiSuggestions.tsx
index 8ab20cf13ad6..bb983a680af8 100644
--- a/src/components/EmojiSuggestions.tsx
+++ b/src/components/EmojiSuggestions.tsx
@@ -3,8 +3,8 @@ import {View} from 'react-native';
import type {SimpleEmoji} from '@libs/EmojiTrie';
import * as EmojiUtils from '@libs/EmojiUtils';
import getStyledTextArray from '@libs/GetStyledTextArray';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import AutoCompleteSuggestions from './AutoCompleteSuggestions';
import Text from './Text';
@@ -42,6 +42,7 @@ type EmojiSuggestionsProps = {
const keyExtractor = (item: SimpleEmoji, index: number): string => `${item.name}+${index}}`;
function EmojiSuggestions({emojis, onSelect, prefix, isEmojiPickerLarge, preferredSkinToneIndex, highlightedEmojiIndex = 0, measureParentContainer = () => {}}: EmojiSuggestionsProps) {
+ const styles = useThemeStyles();
/**
* Render an emoji suggestion menu item component.
*/
diff --git a/src/components/EnvironmentBadge.js b/src/components/EnvironmentBadge.js
index 674eaa5c2840..f32946f8bc25 100644
--- a/src/components/EnvironmentBadge.js
+++ b/src/components/EnvironmentBadge.js
@@ -1,7 +1,7 @@
import React from 'react';
import useEnvironment from '@hooks/useEnvironment';
import * as Environment from '@libs/Environment/Environment';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import pkg from '../../package.json';
import Badge from './Badge';
@@ -14,6 +14,7 @@ const ENVIRONMENT_SHORT_FORM = {
};
function EnvironmentBadge() {
+ const styles = useThemeStyles();
const {environment} = useEnvironment();
// If we are on production, don't show any badge
diff --git a/src/components/ExceededCommentLength.js b/src/components/ExceededCommentLength.js
index 43589be566ff..6353bdf40283 100644
--- a/src/components/ExceededCommentLength.js
+++ b/src/components/ExceededCommentLength.js
@@ -4,7 +4,7 @@ import React, {useEffect, useMemo, useState} from 'react';
import {withOnyx} from 'react-native-onyx';
import useLocalize from '@hooks/useLocalize';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import Text from './Text';
@@ -26,6 +26,7 @@ const defaultProps = {
};
function ExceededCommentLength(props) {
+ const styles = useThemeStyles();
const {numberFormat, translate} = useLocalize();
const [commentLength, setCommentLength] = useState(0);
const updateCommentLength = useMemo(
diff --git a/src/components/ExpensifyWordmark.js b/src/components/ExpensifyWordmark.js
index 1fe6aee91e67..efb3b20dbe87 100644
--- a/src/components/ExpensifyWordmark.js
+++ b/src/components/ExpensifyWordmark.js
@@ -7,9 +7,9 @@ import DevLogo from '@assets/images/expensify-logo--dev.svg';
import StagingLogo from '@assets/images/expensify-logo--staging.svg';
import ProductionLogo from '@assets/images/expensify-wordmark.svg';
import useEnvironment from '@hooks/useEnvironment';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';
@@ -32,6 +32,8 @@ const logoComponents = {
};
function ExpensifyWordmark(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {environment} = useEnvironment();
// PascalCase is required for React components, so capitalize the const here
@@ -46,7 +48,7 @@ function ExpensifyWordmark(props) {
...(_.isArray(props.style) ? props.style : [props.style]),
]}
>
-
+
>
);
diff --git a/src/components/FeatureList.js b/src/components/FeatureList.js
index 94bb309edc84..85195864cdc3 100644
--- a/src/components/FeatureList.js
+++ b/src/components/FeatureList.js
@@ -3,7 +3,7 @@ import React from 'react';
import {View} from 'react-native';
import _ from 'underscore';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import MenuItem from './MenuItem';
import menuItemPropTypes from './menuItemPropTypes';
import Text from './Text';
@@ -20,6 +20,7 @@ const propTypes = {
};
function FeatureList({menuItems, headline, description}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
<>
diff --git a/src/components/FixedFooter.tsx b/src/components/FixedFooter.tsx
index afda41f16d06..34bce2133a89 100644
--- a/src/components/FixedFooter.tsx
+++ b/src/components/FixedFooter.tsx
@@ -1,6 +1,6 @@
import React, {ReactNode} from 'react';
import {StyleProp, View, ViewStyle} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
type FixedFooterProps = {
/** Children to wrap in FixedFooter. */
@@ -11,6 +11,7 @@ type FixedFooterProps = {
};
function FixedFooter({style = [], children}: FixedFooterProps) {
+ const styles = useThemeStyles();
return {children};
}
diff --git a/src/components/FloatingActionButton.js b/src/components/FloatingActionButton.js
index c0e01cab2954..c49f69c336eb 100644
--- a/src/components/FloatingActionButton.js
+++ b/src/components/FloatingActionButton.js
@@ -1,14 +1,15 @@
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {Animated, Easing, View} from 'react-native';
-import styles from '@styles/styles';
+import compose from '@libs/compose';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import Tooltip from './Tooltip/PopoverAnchorTooltip';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
+import withTheme, {withThemePropTypes} from './withTheme';
+import withThemeStyles, {withThemeStylesPropTypes} from './withThemeStyles';
const AnimatedIcon = Animated.createAnimatedComponent(Icon);
AnimatedIcon.displayName = 'AnimatedIcon';
@@ -27,6 +28,8 @@ const propTypes = {
buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
...withLocalizePropTypes,
+ ...withThemeStylesPropTypes,
+ ...withThemePropTypes,
};
const defaultProps = {
@@ -70,17 +73,17 @@ class FloatingActionButton extends PureComponent {
const backgroundColor = this.animatedValue.interpolate({
inputRange: [0, 1],
- outputRange: [themeColors.success, themeColors.buttonDefaultBG],
+ outputRange: [this.props.theme.success, this.props.theme.buttonDefaultBG],
});
const fill = this.animatedValue.interpolate({
inputRange: [0, 1],
- outputRange: [themeColors.textLight, themeColors.textDark],
+ outputRange: [this.props.theme.textLight, this.props.theme.textDark],
});
return (
-
+
{
this.fabPressable = el;
@@ -97,7 +100,7 @@ class FloatingActionButton extends PureComponent {
this.props.onPress(e);
}}
onLongPress={() => {}}
- style={[styles.floatingActionButton, StyleUtils.getAnimatedFABStyle(rotate, backgroundColor)]}
+ style={[this.props.themeStyles.floatingActionButton, StyleUtils.getAnimatedFABStyle(rotate, backgroundColor)]}
>
FloatingActionButtonWithLocalizeWithRef.displayName = 'FloatingActionButtonWithLocalizeWithRef';
-export default FloatingActionButtonWithLocalizeWithRef;
+export default compose(withThemeStyles, withTheme)(FloatingActionButtonWithLocalizeWithRef);
diff --git a/src/components/Form.js b/src/components/Form.js
index 372c7a0c5d9b..28343691ea15 100644
--- a/src/components/Form.js
+++ b/src/components/Form.js
@@ -9,7 +9,7 @@ import * as ErrorUtils from '@libs/ErrorUtils';
import * as ValidationUtils from '@libs/ValidationUtils';
import Visibility from '@libs/Visibility';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as FormActions from '@userActions/FormActions';
import CONST from '@src/CONST';
import FormAlertWithSubmitButton from './FormAlertWithSubmitButton';
@@ -108,6 +108,7 @@ const defaultProps = {
};
function Form(props) {
+ const styles = useThemeStyles();
const [errors, setErrors] = useState({});
const [inputValues, setInputValues] = useState(() => ({...props.draftValues}));
const formRef = useRef(null);
@@ -458,24 +459,26 @@ function Form(props) {
)}
),
+
[
- childrenWrapperWithProps,
- errors,
- formContentRef,
- formRef,
- errorMessage,
- inputRefs,
- inputValues,
- submit,
props.style,
- children,
- props.formState,
- props.footerContent,
- props.enabledWhenOffline,
- props.isSubmitActionDangerous,
props.isSubmitButtonVisible,
props.submitButtonText,
+ props.formState.errorFields,
+ props.formState.isLoading,
+ props.footerContent,
props.submitButtonStyles,
+ props.enabledWhenOffline,
+ props.isSubmitActionDangerous,
+ submit,
+ childrenWrapperWithProps,
+ children,
+ inputValues,
+ errors,
+ errorMessage,
+ styles.mh0,
+ styles.mt5,
+ styles.flex1,
],
);
diff --git a/src/components/Form/FormWrapper.js b/src/components/Form/FormWrapper.js
index f82199d0f587..4f7346a94a2d 100644
--- a/src/components/Form/FormWrapper.js
+++ b/src/components/Form/FormWrapper.js
@@ -9,7 +9,7 @@ import SafeAreaConsumer from '@components/SafeAreaConsumer';
import ScrollViewWithContext from '@components/ScrollViewWithContext';
import * as ErrorUtils from '@libs/ErrorUtils';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import errorsPropType from './errorsPropType';
const propTypes = {
@@ -81,6 +81,7 @@ const defaultProps = {
};
function FormWrapper(props) {
+ const styles = useThemeStyles();
const {
onSubmit,
children,
@@ -169,6 +170,9 @@ function FormWrapper(props) {
isSubmitButtonVisible,
onSubmit,
style,
+ styles.flex1,
+ styles.mh0,
+ styles.mt5,
submitButtonStyles,
submitButtonText,
],
diff --git a/src/components/FormAlertWithSubmitButton.js b/src/components/FormAlertWithSubmitButton.js
index 1ffbf0d667e2..b16a4d2a08ee 100644
--- a/src/components/FormAlertWithSubmitButton.js
+++ b/src/components/FormAlertWithSubmitButton.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import _ from 'underscore';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Button from './Button';
import FormAlertWrapper from './FormAlertWrapper';
@@ -67,6 +67,7 @@ const defaultProps = {
};
function FormAlertWithSubmitButton(props) {
+ const styles = useThemeStyles();
const buttonStyles = [_.isEmpty(props.footerContent) ? {} : styles.mb3, ...props.buttonStyles];
return (
diff --git a/src/components/FormAlertWrapper.js b/src/components/FormAlertWrapper.js
index 87304ee5dc3e..c577048c0a1b 100644
--- a/src/components/FormAlertWrapper.js
+++ b/src/components/FormAlertWrapper.js
@@ -3,7 +3,7 @@ import React from 'react';
import {View} from 'react-native';
import _ from 'underscore';
import compose from '@libs/compose';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import FormHelpMessage from './FormHelpMessage';
import networkPropTypes from './networkPropTypes';
import {withNetwork} from './OnyxProvider';
@@ -51,6 +51,7 @@ const defaultProps = {
// This component takes other components as a child prop. It will then render any wrapped components as a function using "render props",
// and passes it a (bool) isOffline parameter. Child components can then use the isOffline variable to determine offline behavior.
function FormAlertWrapper(props) {
+ const styles = useThemeStyles();
let children;
if (_.isEmpty(props.message)) {
children = (
diff --git a/src/components/FormHelpMessage.js b/src/components/FormHelpMessage.js
index 717b9d9355b6..bec02c3d51f0 100644
--- a/src/components/FormHelpMessage.js
+++ b/src/components/FormHelpMessage.js
@@ -4,8 +4,8 @@ import {View} from 'react-native';
import _ from 'underscore';
import * as Localize from '@libs/Localize';
import stylePropTypes from '@styles/stylePropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import Text from './Text';
@@ -32,6 +32,8 @@ const defaultProps = {
};
function FormHelpMessage(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
if (_.isEmpty(props.message) && _.isEmpty(props.children)) {
return null;
}
@@ -42,9 +44,10 @@ function FormHelpMessage(props) {
{props.isError && (
)}
+
{props.children || {translatedMessage}}
diff --git a/src/components/FormScrollView.tsx b/src/components/FormScrollView.tsx
index e47d75f4fb26..c2f01e1d0511 100644
--- a/src/components/FormScrollView.tsx
+++ b/src/components/FormScrollView.tsx
@@ -1,6 +1,6 @@
import React, {ForwardedRef} from 'react';
import {ScrollView, ScrollViewProps} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
type FormScrollViewProps = ScrollViewProps & {
/** Form elements */
@@ -8,6 +8,7 @@ type FormScrollViewProps = ScrollViewProps & {
};
function FormScrollView({children, ...rest}: FormScrollViewProps, ref: ForwardedRef) {
+ const styles = useThemeStyles();
return (
;
};
function FullScreenLoadingIndicator({style}: FullScreenLoadingIndicatorProps) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
return (
diff --git a/src/components/GrowlNotification/GrowlNotificationContainer/index.js b/src/components/GrowlNotification/GrowlNotificationContainer/index.js
index c6614e371b6d..82672edb14c2 100644
--- a/src/components/GrowlNotification/GrowlNotificationContainer/index.js
+++ b/src/components/GrowlNotification/GrowlNotificationContainer/index.js
@@ -1,7 +1,7 @@
import React from 'react';
import {Animated} from 'react-native';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import growlNotificationContainerPropTypes from './growlNotificationContainerPropTypes';
const propTypes = {
@@ -10,6 +10,7 @@ const propTypes = {
};
function GrowlNotificationContainer(props) {
+ const styles = useThemeStyles();
return (
{(insets) => (
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js
index 52cbc88a6652..63973ea43e19 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js
@@ -9,7 +9,7 @@ import useEnvironment from '@hooks/useEnvironment';
import Navigation from '@libs/Navigation/Navigation';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import * as Url from '@libs/Url';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as Session from '@userActions/Session';
import CONFIG from '@src/CONFIG';
@@ -18,6 +18,7 @@ import ROUTES from '@src/ROUTES';
import htmlRendererPropTypes from './htmlRendererPropTypes';
function AnchorRenderer(props) {
+ const styles = useThemeStyles();
const htmlAttribs = props.tnode.attributes;
const {environmentURL} = useEnvironment();
// An auth token is needed to download Expensify chat attachments
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.js
index 03d3afe53d4e..e97d01808a6e 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.js
@@ -3,8 +3,8 @@ import _ from 'underscore';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import editedLabelStyles from '@styles/editedLabelStyles';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import htmlRendererPropTypes from './htmlRendererPropTypes';
@@ -15,6 +15,8 @@ const propTypes = {
};
function EditedRenderer(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style', 'tnode']);
const isPendingDelete = Boolean(props.tnode.attributes.deleted !== undefined);
return (
@@ -29,7 +31,7 @@ function EditedRenderer(props) {
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
fontSize={variables.fontSizeSmall}
- color={themeColors.textSupporting}
+ color={theme.textSupporting}
style={[editedLabelStyles, isPendingDelete && styles.offlineFeedback.deleted]}
>
{props.translate('reportActionCompose.edited')}
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
index 8461f714373b..7cbdf8d69831 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.js
@@ -8,7 +8,7 @@ import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -17,6 +17,7 @@ import htmlRendererPropTypes from './htmlRendererPropTypes';
const propTypes = {...htmlRendererPropTypes};
function ImageRenderer(props) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const htmlAttribs = props.tnode.attributes;
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js
index b7b7c43e7b58..a60be614d9bc 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js
@@ -14,8 +14,8 @@ import Navigation from '@libs/Navigation/Navigation';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import personalDetailsPropType from '@pages/personalDetailsPropType';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -32,6 +32,7 @@ const propTypes = {
};
function MentionUserRenderer(props) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']);
const htmlAttribAccountID = lodashGet(props.tnode.attributes, 'accountid');
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js
index 8edc7baeac65..a2b01059a63c 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer/BasePreRenderer.js
@@ -7,7 +7,7 @@ import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeed
import {ShowContextMenuContext, showContextMenuForReport} from '@components/ShowContextMenuContext';
import withLocalize from '@components/withLocalize';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -32,6 +32,7 @@ const defaultProps = {
};
const BasePreRenderer = forwardRef((props, ref) => {
+ const styles = useThemeStyles();
const TDefaultRenderer = props.TDefaultRenderer;
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'onPressIn', 'onPressOut', 'onLongPress']);
const isLast = props.renderIndex === props.renderLength - 1;
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index eb9a9b2c55c0..46fe1a25c920 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -1,6 +1,6 @@
import React, {ReactElement} from 'react';
import {StyleProp, TextStyle, View} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import EnvironmentBadge from './EnvironmentBadge';
import Text from './Text';
@@ -19,6 +19,7 @@ type HeaderProps = {
};
function Header({title = '', subtitle = '', textStyles = [], shouldShowEnvironmentBadge = false}: HeaderProps) {
+ const styles = useThemeStyles();
return (
diff --git a/src/components/HeaderGap/index.desktop.js b/src/components/HeaderGap/index.desktop.js
index 02918fbe3a51..2d583881cab6 100644
--- a/src/components/HeaderGap/index.desktop.js
+++ b/src/components/HeaderGap/index.desktop.js
@@ -1,17 +1,18 @@
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {View} from 'react-native';
-import styles from '@styles/styles';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
const propTypes = {
/** Styles to apply to the HeaderGap */
// eslint-disable-next-line react/forbid-prop-types
styles: PropTypes.arrayOf(PropTypes.object),
+ ...withThemeStylesPropTypes,
};
class HeaderGap extends PureComponent {
render() {
- return ;
+ return ;
}
}
@@ -19,4 +20,4 @@ HeaderGap.propTypes = propTypes;
HeaderGap.defaultProps = {
styles: [],
};
-export default HeaderGap;
+export default withThemeStyles(HeaderGap);
diff --git a/src/components/HeaderPageLayout.js b/src/components/HeaderPageLayout.js
index daacf197a672..260f98d208eb 100644
--- a/src/components/HeaderPageLayout.js
+++ b/src/components/HeaderPageLayout.js
@@ -5,9 +5,9 @@ import _ from 'underscore';
import useNetwork from '@hooks/useNetwork';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import FixedFooter from './FixedFooter';
import HeaderWithBackButton from './HeaderWithBackButton';
import headerWithBackButtonPropTypes from './HeaderWithBackButton/headerWithBackButtonPropTypes';
@@ -42,7 +42,7 @@ const propTypes = {
};
const defaultProps = {
- backgroundColor: themeColors.appBG,
+ backgroundColor: undefined,
header: null,
headerContainerStyles: [],
scrollViewContainerStyles: [],
@@ -51,20 +51,22 @@ const defaultProps = {
};
function HeaderPageLayout({backgroundColor, children, footer, headerContainerStyles, scrollViewContainerStyles, childrenContainerStyles, style, headerContent, ...propsToPassToHeader}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {windowHeight, isSmallScreenWidth} = useWindowDimensions();
const {isOffline} = useNetwork();
- const appBGColor = StyleUtils.getBackgroundColorStyle(themeColors.appBG);
+ const appBGColor = StyleUtils.getBackgroundColorStyle(theme.appBG);
const {titleColor, iconFill} = useMemo(() => {
- const isColorfulBackground = backgroundColor !== themeColors.appBG;
+ const isColorfulBackground = (backgroundColor || theme.appBG) !== theme.appBG;
return {
- titleColor: isColorfulBackground ? themeColors.textColorfulBackground : undefined,
- iconFill: isColorfulBackground ? themeColors.iconColorfulBackground : undefined,
+ titleColor: isColorfulBackground ? theme.textColorfulBackground : undefined,
+ iconFill: isColorfulBackground ? theme.iconColorfulBackground : undefined,
};
- }, [backgroundColor]);
+ }, [backgroundColor, theme.appBG, theme.iconColorfulBackground, theme.textColorfulBackground]);
return (
-
+
)}
@@ -90,8 +92,8 @@ function HeaderPageLayout({backgroundColor, children, footer, headerContainerSty
contentContainerStyle={[safeAreaPaddingBottomStyle, style, scrollViewContainerStyles]}
offlineIndicatorStyle={[appBGColor]}
>
- {!Browser.isSafari() && }
-
+ {!Browser.isSafari() && }
+
{headerContent}
{children}
diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js
index 6a8f630d1e78..1371e6a36b97 100755
--- a/src/components/HeaderWithBackButton/index.js
+++ b/src/components/HeaderWithBackButton/index.js
@@ -14,8 +14,8 @@ import useThrottledButtonState from '@hooks/useThrottledButtonState';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import getButtonState from '@libs/getButtonState';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import headerWithBackButtonPropTypes from './headerWithBackButtonPropTypes';
@@ -54,6 +54,7 @@ function HeaderWithBackButton({
shouldOverlay = false,
singleExecution = (func) => func,
}) {
+ const styles = useThemeStyles();
const [isDownloadButtonActive, temporarilyDisableDownloadButton] = useThrottledButtonState();
const {translate} = useLocalize();
const {isKeyboardShown} = useKeyboardState();
diff --git a/src/components/Icon/svgs/LoungeAccessIcon.tsx b/src/components/Icon/svgs/LoungeAccessIcon.tsx
index fffbe1b60451..48b140da3bc8 100644
--- a/src/components/Icon/svgs/LoungeAccessIcon.tsx
+++ b/src/components/Icon/svgs/LoungeAccessIcon.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import Svg, {G, Path, Polygon} from 'react-native-svg';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
type LoungeAccessIconProps = {
/** The fill color for the icon. Can be hex, rgb, rgba, or valid react-native named color such as 'red' or 'blue'. */
@@ -19,7 +19,8 @@ type LoungeAccessIconProps = {
height?: number;
};
-function LoungeAccessIcon({fill = themeColors.icon, hovered = 'false', pressed = 'false', width, height}: LoungeAccessIconProps) {
+function LoungeAccessIcon({fill, hovered = 'false', pressed = 'false', width, height}: LoungeAccessIconProps) {
+ const theme = useTheme();
return (
diff --git a/src/components/WalletSection.js b/src/components/WalletSection.js
index d79d2be0ddc9..1b5349098b82 100644
--- a/src/components/WalletSection.js
+++ b/src/components/WalletSection.js
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Section from './Section';
const propTypes = {
@@ -24,6 +24,7 @@ const defaultProps = {
};
function WalletSection({children, icon, subtitle, title}) {
+ const styles = useThemeStyles();
return (
>,
): (props: TProps & RefAttributes) => ReactElement | null {
function WithToggleVisibilityView({isVisible = false, ...rest}: SetOptional, ref: ForwardedRef) {
+ const styles = useThemeStyles();
return (
{/* In the latest Electron version buttons can't be both clickable and draggable.
- That's why we added this workaround. Because of two Pressable components on the desktop app
- we have 30px draggable ba at the top and the rest of the dimmed area is clickable. On other devices,
- everything behaves normally like one big pressable */}
+ That's why we added this workaround. Because of two Pressable components on the desktop app
+ we have 30px draggable ba at the top and the rest of the dimmed area is clickable. On other devices,
+ everything behaves normally like one big pressable */}
{
};
function DetailsPage(props) {
+ const styles = useThemeStyles();
const login = lodashGet(props.route.params, 'login', '');
let details = _.find(props.personalDetails, (detail) => detail.login === login.toLowerCase());
diff --git a/src/pages/EditRequestCategoryPage.js b/src/pages/EditRequestCategoryPage.js
index b3eacbe1abad..290c05f0c494 100644
--- a/src/pages/EditRequestCategoryPage.js
+++ b/src/pages/EditRequestCategoryPage.js
@@ -6,7 +6,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Transaction default category value */
@@ -20,6 +20,7 @@ const propTypes = {
};
function EditRequestCategoryPage({defaultCategory, policyID, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const selectCategory = (category) => {
diff --git a/src/pages/EditRequestCreatedPage.js b/src/pages/EditRequestCreatedPage.js
index 5bf421f1d6b0..78a2d28a925c 100644
--- a/src/pages/EditRequestCreatedPage.js
+++ b/src/pages/EditRequestCreatedPage.js
@@ -5,7 +5,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import NewDatePicker from '@components/NewDatePicker';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import ONYXKEYS from '@src/ONYXKEYS';
const propTypes = {
@@ -17,6 +17,7 @@ const propTypes = {
};
function EditRequestCreatedPage({defaultCreated, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/pages/EditRequestDescriptionPage.js b/src/pages/EditRequestDescriptionPage.js
index f8d16025f42f..f6779ac83ead 100644
--- a/src/pages/EditRequestDescriptionPage.js
+++ b/src/pages/EditRequestDescriptionPage.js
@@ -10,7 +10,7 @@ import TextInput from '@components/TextInput';
import useLocalize from '@hooks/useLocalize';
import * as Browser from '@libs/Browser';
import updateMultilineInputRange from '@libs/UpdateMultilineInputRange';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -23,6 +23,7 @@ const propTypes = {
};
function EditRequestDescriptionPage({defaultDescription, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const descriptionInputRef = useRef(null);
const focusTimeoutRef = useRef(null);
diff --git a/src/pages/EditRequestMerchantPage.js b/src/pages/EditRequestMerchantPage.js
index af9b5c9a539e..1bc464fc37da 100644
--- a/src/pages/EditRequestMerchantPage.js
+++ b/src/pages/EditRequestMerchantPage.js
@@ -7,7 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import TextInput from '@components/TextInput';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -20,6 +20,7 @@ const propTypes = {
};
function EditRequestMerchantPage({defaultMerchant, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const merchantInputRef = useRef(null);
diff --git a/src/pages/EditRequestReceiptPage.js b/src/pages/EditRequestReceiptPage.js
index 9c9daf7c899a..03c0aa777d5e 100644
--- a/src/pages/EditRequestReceiptPage.js
+++ b/src/pages/EditRequestReceiptPage.js
@@ -6,7 +6,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import ReceiptSelector from './iou/ReceiptSelector';
const propTypes = {
@@ -31,6 +31,7 @@ const defaultProps = {
};
function EditRequestReceiptPage({route, transactionID}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const [isDraggingOver, setIsDraggingOver] = useState(false);
diff --git a/src/pages/EditRequestTagPage.js b/src/pages/EditRequestTagPage.js
index 819a026dc9aa..6191c8fb8dd8 100644
--- a/src/pages/EditRequestTagPage.js
+++ b/src/pages/EditRequestTagPage.js
@@ -6,7 +6,7 @@ import TagPicker from '@components/TagPicker';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Transaction default tag value */
@@ -23,6 +23,7 @@ const propTypes = {
};
function EditRequestTagPage({defaultTag, policyID, tagName, onSubmit}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const selectTag = (tag) => {
diff --git a/src/pages/EnablePayments/AdditionalDetailsStep.js b/src/pages/EnablePayments/AdditionalDetailsStep.js
index e58d45b5f1c4..45738c376181 100644
--- a/src/pages/EnablePayments/AdditionalDetailsStep.js
+++ b/src/pages/EnablePayments/AdditionalDetailsStep.js
@@ -17,7 +17,7 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import * as ValidationUtils from '@libs/ValidationUtils';
import AddressForm from '@pages/ReimbursementAccount/AddressForm';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as PersonalDetails from '@userActions/PersonalDetails';
import * as Wallet from '@userActions/Wallet';
import CONST from '@src/CONST';
@@ -79,6 +79,7 @@ const fieldNameTranslationKeys = {
};
function AdditionalDetailsStep({walletAdditionalDetails, translate, currentUserPersonalDetails}) {
+ const styles = useThemeStyles();
const currentDate = new Date();
const minDate = subYears(currentDate, CONST.DATE_BIRTH.MAX_AGE);
const maxDate = subYears(currentDate, CONST.DATE_BIRTH.MIN_AGE_FOR_PAYMENT);
diff --git a/src/pages/EnablePayments/FailedKYC.js b/src/pages/EnablePayments/FailedKYC.js
index 398537cf7645..de170bec4070 100644
--- a/src/pages/EnablePayments/FailedKYC.js
+++ b/src/pages/EnablePayments/FailedKYC.js
@@ -3,7 +3,7 @@ import {View} from 'react-native';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -11,6 +11,7 @@ const propTypes = {
};
function FailedKYC(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/pages/EnablePayments/IdologyQuestions.js b/src/pages/EnablePayments/IdologyQuestions.js
index a46e6d54a5ed..97c0f55f27c6 100644
--- a/src/pages/EnablePayments/IdologyQuestions.js
+++ b/src/pages/EnablePayments/IdologyQuestions.js
@@ -12,7 +12,7 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import * as ErrorUtils from '@libs/ErrorUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -52,6 +52,7 @@ const defaultProps = {
};
function IdologyQuestions({questions, walletAdditionalDetails, idNumber}) {
+ const styles = useThemeStyles();
const formRef = useRef();
const {translate} = useLocalize();
diff --git a/src/pages/EnablePayments/OnfidoPrivacy.js b/src/pages/EnablePayments/OnfidoPrivacy.js
index db5098777744..c542df0196cf 100644
--- a/src/pages/EnablePayments/OnfidoPrivacy.js
+++ b/src/pages/EnablePayments/OnfidoPrivacy.js
@@ -12,7 +12,7 @@ import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import * as ErrorUtils from '@libs/ErrorUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import ONYXKEYS from '@src/ONYXKEYS';
import walletOnfidoDataPropTypes from './walletOnfidoDataPropTypes';
@@ -36,6 +36,7 @@ const defaultProps = {
};
function OnfidoPrivacy({walletOnfidoData, translate, form}) {
+ const styles = useThemeStyles();
const {isLoading = false, hasAcceptedPrivacyPolicy} = walletOnfidoData;
const formRef = useRef(null);
diff --git a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js
index 46a1867a2606..898aec9b2c16 100644
--- a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js
+++ b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js
@@ -4,7 +4,7 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import * as Localize from '@libs/Localize';
import userWalletPropTypes from '@pages/EnablePayments/userWalletPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -17,6 +17,7 @@ const defaultProps = {
};
function ShortTermsForm(props) {
+ const styles = useThemeStyles();
return (
<>
diff --git a/src/pages/EnablePayments/TermsStep.js b/src/pages/EnablePayments/TermsStep.js
index 6dff94b7202b..368f92f0db27 100644
--- a/src/pages/EnablePayments/TermsStep.js
+++ b/src/pages/EnablePayments/TermsStep.js
@@ -9,7 +9,7 @@ import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import * as ErrorUtils from '@libs/ErrorUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import ONYXKEYS from '@src/ONYXKEYS';
import LongTermsForm from './TermsPage/LongTermsForm';
@@ -33,6 +33,7 @@ const defaultProps = {
};
function TermsStep(props) {
+ const styles = useThemeStyles();
const [hasAcceptedDisclosure, setHasAcceptedDisclosure] = useState(false);
const [hasAcceptedPrivacyPolicyAndWalletAgreement, setHasAcceptedPrivacyPolicyAndWalletAgreement] = useState(false);
const [error, setError] = useState(false);
diff --git a/src/pages/ErrorPage/ErrorBodyText/index.js b/src/pages/ErrorPage/ErrorBodyText/index.js
index d50d15c15cd0..d3436a2fc0a8 100644
--- a/src/pages/ErrorPage/ErrorBodyText/index.js
+++ b/src/pages/ErrorPage/ErrorBodyText/index.js
@@ -2,7 +2,7 @@ import React from 'react';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -10,6 +10,7 @@ const propTypes = {
};
function ErrorBodyText(props) {
+ const styles = useThemeStyles();
return (
{`${props.translate('genericErrorPage.body.helpTextMobile')} `}
diff --git a/src/pages/ErrorPage/GenericErrorPage.js b/src/pages/ErrorPage/GenericErrorPage.js
index af551fe5743a..7b627a8e18d5 100644
--- a/src/pages/ErrorPage/GenericErrorPage.js
+++ b/src/pages/ErrorPage/GenericErrorPage.js
@@ -9,9 +9,9 @@ import SafeAreaConsumer from '@components/SafeAreaConsumer';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import defaultTheme from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
@@ -22,6 +22,8 @@ const propTypes = {
};
function GenericErrorPage({translate}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {resetBoundary} = useErrorBoundary();
return (
@@ -35,7 +37,7 @@ function GenericErrorPage({translate}) {
src={Expensicons.Bug}
height={variables.componentSizeNormal}
width={variables.componentSizeNormal}
- fill={defaultTheme.iconSuccessFill}
+ fill={theme.iconSuccessFill}
/>
@@ -79,7 +81,7 @@ function GenericErrorPage({translate}) {
diff --git a/src/pages/FlagCommentPage.js b/src/pages/FlagCommentPage.js
index ee7b2d8af3c1..721bc6742c4b 100644
--- a/src/pages/FlagCommentPage.js
+++ b/src/pages/FlagCommentPage.js
@@ -14,7 +14,7 @@ import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
@@ -62,6 +62,7 @@ function getReportID(route) {
}
function FlagCommentPage(props) {
+ const styles = useThemeStyles();
const severities = [
{
severity: CONST.MODERATION.FLAG_SEVERITY_SPAM,
diff --git a/src/pages/GetAssistancePage.js b/src/pages/GetAssistancePage.js
index 647734a0cde1..b801a91af728 100644
--- a/src/pages/GetAssistancePage.js
+++ b/src/pages/GetAssistancePage.js
@@ -12,7 +12,7 @@ import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -44,6 +44,7 @@ const defaultProps = {
};
function GetAssistancePage(props) {
+ const styles = useThemeStyles();
const menuItems = [
{
title: props.translate('getAssistancePage.chatWithConcierge'),
diff --git a/src/pages/KeyboardShortcutsPage.js b/src/pages/KeyboardShortcutsPage.js
index 4caade5b9ec1..fde4bf5ff3df 100644
--- a/src/pages/KeyboardShortcutsPage.js
+++ b/src/pages/KeyboardShortcutsPage.js
@@ -7,10 +7,11 @@ import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import KeyboardShortcut from '@libs/KeyboardShortcut';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
function KeyboardShortcutsPage() {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const shortcuts = _.chain(CONST.KEYBOARD_SHORTCUTS)
.filter((shortcut) => !_.isEmpty(shortcut.descriptionKey))
diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.js b/src/pages/LogInWithShortLivedAuthTokenPage.js
index 84de67e496b5..8534961b3337 100644
--- a/src/pages/LogInWithShortLivedAuthTokenPage.js
+++ b/src/pages/LogInWithShortLivedAuthTokenPage.js
@@ -11,8 +11,8 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Session from '@userActions/Session';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -46,6 +46,8 @@ const defaultProps = {
};
function LogInWithShortLivedAuthTokenPage(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {translate} = useLocalize();
useEffect(() => {
@@ -109,7 +111,7 @@ function LogInWithShortLivedAuthTokenPage(props) {
diff --git a/src/pages/NewChatPage.js b/src/pages/NewChatPage.js
index 22af82041f7b..90b2615f901c 100755
--- a/src/pages/NewChatPage.js
+++ b/src/pages/NewChatPage.js
@@ -17,7 +17,7 @@ import compose from '@libs/compose';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Permissions from '@libs/Permissions';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -53,6 +53,7 @@ const defaultProps = {
const excludedGroupEmails = _.without(CONST.EXPENSIFY_EMAILS, CONST.EMAIL.CONCIERGE);
function NewChatPage({betas, isGroupChat, personalDetails, reports, translate, isSearchingForReports}) {
+ const styles = useThemeStyles();
const [searchTerm, setSearchTerm] = useState('');
const [filteredRecentReports, setFilteredRecentReports] = useState([]);
const [filteredPersonalDetails, setFilteredPersonalDetails] = useState([]);
diff --git a/src/pages/PrivateNotes/PrivateNotesEditPage.js b/src/pages/PrivateNotes/PrivateNotesEditPage.js
index f38dabee9183..c4946d3c07b4 100644
--- a/src/pages/PrivateNotes/PrivateNotesEditPage.js
+++ b/src/pages/PrivateNotes/PrivateNotesEditPage.js
@@ -22,7 +22,7 @@ import updateMultilineInputRange from '@libs/UpdateMultilineInputRange';
import withReportAndPrivateNotesOrNotFound from '@pages/home/report/withReportAndPrivateNotesOrNotFound';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -50,6 +50,7 @@ const defaultProps = {
};
function PrivateNotesEditPage({route, personalDetailsList, report}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
// We need to edit the note in markdown format, but display it in HTML format
diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.js b/src/pages/PrivateNotes/PrivateNotesListPage.js
index 4d5b348c4b9f..7bcf9c22690b 100644
--- a/src/pages/PrivateNotes/PrivateNotesListPage.js
+++ b/src/pages/PrivateNotes/PrivateNotesListPage.js
@@ -17,7 +17,7 @@ import * as UserUtils from '@libs/UserUtils';
import withReportAndPrivateNotesOrNotFound from '@pages/home/report/withReportAndPrivateNotesOrNotFound';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -55,6 +55,7 @@ const defaultProps = {
};
function PrivateNotesListPage({report, personalDetailsList, session}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
/**
diff --git a/src/pages/PrivateNotes/PrivateNotesViewPage.js b/src/pages/PrivateNotes/PrivateNotesViewPage.js
index 2b836036448d..76057d3d74bc 100644
--- a/src/pages/PrivateNotes/PrivateNotesViewPage.js
+++ b/src/pages/PrivateNotes/PrivateNotesViewPage.js
@@ -15,7 +15,7 @@ import Navigation from '@libs/Navigation/Navigation';
import withReportAndPrivateNotesOrNotFound from '@pages/home/report/withReportAndPrivateNotesOrNotFound';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -51,6 +51,7 @@ const defaultProps = {
};
function PrivateNotesViewPage({route, personalDetailsList, session, report}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const isCurrentUserNote = Number(session.accountID) === Number(route.params.accountID);
const privateNote = lodashGet(report, ['privateNotes', route.params.accountID, 'note'], '');
diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js
index 6b851bf9e5b2..4b3c927ef317 100755
--- a/src/pages/ProfilePage.js
+++ b/src/pages/ProfilePage.js
@@ -29,7 +29,7 @@ import Permissions from '@libs/Permissions';
import * as ReportUtils from '@libs/ReportUtils';
import * as UserUtils from '@libs/UserUtils';
import * as ValidationUtils from '@libs/ValidationUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as PersonalDetails from '@userActions/PersonalDetails';
import * as Report from '@userActions/Report';
@@ -100,6 +100,7 @@ const getPhoneNumber = (details) => {
};
function ProfilePage(props) {
+ const styles = useThemeStyles();
const accountID = Number(lodashGet(props.route.params, 'accountID', 0));
const details = lodashGet(props.personalDetails, accountID, ValidationUtils.isValidAccountRoute(accountID) ? {} : {isloading: false});
diff --git a/src/pages/ReimbursementAccount/ACHContractStep.js b/src/pages/ReimbursementAccount/ACHContractStep.js
index 8f2d2e07998e..9dde145f3de6 100644
--- a/src/pages/ReimbursementAccount/ACHContractStep.js
+++ b/src/pages/ReimbursementAccount/ACHContractStep.js
@@ -12,7 +12,7 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize from '@components/withLocalize';
import * as ValidationUtils from '@libs/ValidationUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import * as FormActions from '@userActions/FormActions';
import CONST from '@src/CONST';
@@ -28,6 +28,7 @@ const propTypes = {
};
function ACHContractStep(props) {
+ const styles = useThemeStyles();
const [beneficialOwners, setBeneficialOwners] = useState(() =>
lodashGet(props.reimbursementAccountDraft, 'beneficialOwners', lodashGet(props.reimbursementAccount, 'achData.beneficialOwners', [])),
);
diff --git a/src/pages/ReimbursementAccount/AddressForm.js b/src/pages/ReimbursementAccount/AddressForm.js
index 260418b9f50b..0f7c878c9058 100644
--- a/src/pages/ReimbursementAccount/AddressForm.js
+++ b/src/pages/ReimbursementAccount/AddressForm.js
@@ -4,7 +4,7 @@ import {View} from 'react-native';
import AddressSearch from '@components/AddressSearch';
import StatePicker from '@components/StatePicker';
import TextInput from '@components/TextInput';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -92,6 +92,7 @@ const defaultProps = {
};
function AddressForm(props) {
+ const styles = useThemeStyles();
return (
<>
diff --git a/src/pages/ReimbursementAccount/BankAccountManualStep.js b/src/pages/ReimbursementAccount/BankAccountManualStep.js
index 1612238ed8d9..dd541c68ecf4 100644
--- a/src/pages/ReimbursementAccount/BankAccountManualStep.js
+++ b/src/pages/ReimbursementAccount/BankAccountManualStep.js
@@ -13,7 +13,7 @@ import {withLocalizePropTypes} from '@components/withLocalize';
import useLocalize from '@hooks/useLocalize';
import shouldDelayFocus from '@libs/shouldDelayFocus';
import * as ValidationUtils from '@libs/ValidationUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -25,6 +25,7 @@ const propTypes = {
};
function BankAccountManualStep(props) {
+ const styles = useThemeStyles();
const {translate, preferredLocale} = useLocalize();
const {reimbursementAccount, reimbursementAccountDraft} = props;
/**
diff --git a/src/pages/ReimbursementAccount/BankAccountPlaidStep.js b/src/pages/ReimbursementAccount/BankAccountPlaidStep.js
index 06e8c0531e3b..080c6ba9fd13 100644
--- a/src/pages/ReimbursementAccount/BankAccountPlaidStep.js
+++ b/src/pages/ReimbursementAccount/BankAccountPlaidStep.js
@@ -13,7 +13,7 @@ import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize from '@components/withLocalize';
import compose from '@libs/compose';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import * as ReimbursementAccount from '@userActions/ReimbursementAccount';
import CONST from '@src/CONST';
@@ -41,6 +41,7 @@ const defaultProps = {
};
function BankAccountPlaidStep(props) {
+ const styles = useThemeStyles();
const {plaidData, receivedRedirectURI, plaidLinkOAuthToken, reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, getDefaultStateForField, translate} = props;
const isFocused = useIsFocused();
diff --git a/src/pages/ReimbursementAccount/BankAccountStep.js b/src/pages/ReimbursementAccount/BankAccountStep.js
index f1bc41d44ed5..898af1ce7108 100644
--- a/src/pages/ReimbursementAccount/BankAccountStep.js
+++ b/src/pages/ReimbursementAccount/BankAccountStep.js
@@ -17,8 +17,8 @@ import TextLink from '@components/TextLink';
import withLocalize from '@components/withLocalize';
import compose from '@libs/compose';
import getPlaidDesktopMessage from '@libs/getPlaidDesktopMessage';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import * as Link from '@userActions/Link';
import CONFIG from '@src/CONFIG';
@@ -64,6 +64,8 @@ const defaultProps = {
};
function BankAccountStep(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
let subStep = lodashGet(props.reimbursementAccount, 'achData.subStep', '');
const shouldReinitializePlaidLink = props.plaidLinkOAuthToken && props.receivedRedirectURI && subStep !== CONST.BANK_ACCOUNT.SUBSTEP.MANUAL;
if (shouldReinitializePlaidLink) {
@@ -157,8 +159,9 @@ function BankAccountStep(props) {
+
{props.translate('bankAccount.validateAccountError')}
)}
@@ -175,7 +178,7 @@ function BankAccountStep(props) {
diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js
index 41f73d1ebf8e..87d60daf7e6f 100644
--- a/src/pages/ReimbursementAccount/CompanyStep.js
+++ b/src/pages/ReimbursementAccount/CompanyStep.js
@@ -19,7 +19,7 @@ import TextLink from '@components/TextLink';
import withLocalize from '@components/withLocalize';
import compose from '@libs/compose';
import * as ValidationUtils from '@libs/ValidationUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -54,6 +54,7 @@ const defaultProps = {
};
function CompanyStep({reimbursementAccount, reimbursementAccountDraft, getDefaultStateForField, onBackButtonPress, translate, session, user, policyID}) {
+ const styles = useThemeStyles();
/**
* @param {Array} fieldNames
*
diff --git a/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
index 52ccc3b87835..45c503494c3d 100644
--- a/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
+++ b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
@@ -14,7 +14,7 @@ import Section from '@components/Section';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import * as ReimbursementAccountProps from './reimbursementAccountPropTypes';
@@ -38,6 +38,7 @@ const propTypes = {
const defaultProps = {policyName: ''};
function ContinueBankAccountSetup(props) {
+ const styles = useThemeStyles();
const errors = lodashGet(props.reimbursementAccount, 'errors', {});
const pendingAction = lodashGet(props.reimbursementAccount, 'pendingAction', null);
return (
diff --git a/src/pages/ReimbursementAccount/Enable2FAPrompt.js b/src/pages/ReimbursementAccount/Enable2FAPrompt.js
index c768f901508e..3cbb3111e089 100644
--- a/src/pages/ReimbursementAccount/Enable2FAPrompt.js
+++ b/src/pages/ReimbursementAccount/Enable2FAPrompt.js
@@ -5,7 +5,7 @@ import * as Illustrations from '@components/Icon/Illustrations';
import Section from '@components/Section';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import ROUTES from '@src/ROUTES';
@@ -13,6 +13,7 @@ const propTypes = {
...withLocalizePropTypes,
};
function Enable2FAPrompt(props) {
+ const styles = useThemeStyles();
const secureYourAccountUrl = encodeURI(
`settings?param={"section":"account","action":"enableTwoFactorAuth","exitTo":"${ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute()}","isFromNewDot":"true"}`,
);
diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js
index cb59a4bc97f5..4f4285d1a62b 100644
--- a/src/pages/ReimbursementAccount/EnableStep.js
+++ b/src/pages/ReimbursementAccount/EnableStep.js
@@ -18,7 +18,7 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import userPropTypes from '@pages/settings/userPropTypes';
import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as BankAccounts from '@userActions/ReimbursementAccount';
import CONST from '@src/CONST';
@@ -47,6 +47,7 @@ const defaultProps = {
};
function EnableStep(props) {
+ const styles = useThemeStyles();
const isUsingExpensifyCard = props.user.isUsingExpensifyCard;
const achData = lodashGet(props.reimbursementAccount, 'achData') || {};
const {icon, iconSize} = getBankIcon(achData.bankName);
diff --git a/src/pages/ReimbursementAccount/IdentityForm.js b/src/pages/ReimbursementAccount/IdentityForm.js
index f584ca3f665a..16dbfb7b8c83 100644
--- a/src/pages/ReimbursementAccount/IdentityForm.js
+++ b/src/pages/ReimbursementAccount/IdentityForm.js
@@ -5,7 +5,7 @@ import {View} from 'react-native';
import _ from 'underscore';
import DatePicker from '@components/DatePicker';
import TextInput from '@components/TextInput';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import AddressForm from './AddressForm';
@@ -130,6 +130,7 @@ const defaultProps = {
};
function IdentityForm(props) {
+ const styles = useThemeStyles();
// dob field has multiple validations/errors, we are handling it temporarily like this.
const dobErrorText = (props.errors.dob ? props.translate('bankAccount.error.dob') : '') || (props.errors.dobAge ? props.translate('bankAccount.error.age') : '');
const identityFormInputKeys = ['firstName', 'lastName', 'dob', 'ssnLast4'];
diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
index 35fa1261f9dc..729201735786 100644
--- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
+++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
@@ -13,6 +13,7 @@ import ReimbursementAccountLoadingIndicator from '@components/ReimbursementAccou
import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import compose from '@libs/compose';
import getPlaidOAuthReceivedRedirectURI from '@libs/getPlaidOAuthReceivedRedirectURI';
import BankAccount from '@libs/models/BankAccount';
@@ -20,7 +21,6 @@ import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import shouldReopenOnfido from '@libs/shouldReopenOnfido';
import withPolicy from '@pages/workspace/withPolicy';
-import styles from '@styles/styles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -77,6 +77,7 @@ const propTypes = {
}),
...withLocalizePropTypes,
+ ...withThemeStylesPropTypes,
};
const defaultProps = {
@@ -441,7 +442,8 @@ class ReimbursementAccountPage extends React.Component {
subtitle={policyName}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
/>
-
+
+
{errorText}
@@ -568,4 +570,5 @@ export default compose(
}),
withLocalize,
withPolicy,
+ withThemeStyles,
)(ReimbursementAccountPage);
diff --git a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js b/src/pages/ReimbursementAccount/RequestorOnfidoStep.js
index 851869f9128d..dc6cff300b09 100644
--- a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js
+++ b/src/pages/ReimbursementAccount/RequestorOnfidoStep.js
@@ -9,7 +9,7 @@ import Onfido from '@components/Onfido';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import Growl from '@libs/Growl';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -34,6 +34,7 @@ const HEADER_STEP_COUNTER = {step: 3, total: 5};
const ONFIDO_ERROR_DISPLAY_DURATION = 10000;
function RequestorOnfidoStep({onBackButtonPress, reimbursementAccount, onfidoToken}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const submitOnfidoData = (onfidoData) => {
diff --git a/src/pages/ReimbursementAccount/ValidationStep.js b/src/pages/ReimbursementAccount/ValidationStep.js
index 343f98644766..386b6b346467 100644
--- a/src/pages/ReimbursementAccount/ValidationStep.js
+++ b/src/pages/ReimbursementAccount/ValidationStep.js
@@ -21,7 +21,7 @@ import compose from '@libs/compose';
import BankAccount from '@libs/models/BankAccount';
import * as ValidationUtils from '@libs/ValidationUtils';
import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -74,6 +74,7 @@ const filterInput = (amount) => {
};
function ValidationStep({reimbursementAccount, translate, onBackButtonPress, account}) {
+ const styles = useThemeStyles();
/**
* @param {Object} values - form input values passed by the Form component
* @returns {Object}
diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js
index de25fdc3a081..f3f55dee3253 100644
--- a/src/pages/ReportDetailsPage.js
+++ b/src/pages/ReportDetailsPage.js
@@ -22,7 +22,7 @@ import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -60,6 +60,7 @@ const defaultProps = {
};
function ReportDetailsPage(props) {
+ const styles = useThemeStyles();
const policy = useMemo(() => props.policies[`${ONYXKEYS.COLLECTION.POLICY}${props.report.policyID}`], [props.policies, props.report.policyID]);
const isPolicyAdmin = useMemo(() => PolicyUtils.isPolicyAdmin(policy), [policy]);
const isPolicyMember = useMemo(() => PolicyUtils.isPolicyMember(props.report.policyID, props.policies), [props.report.policyID, props.policies]);
diff --git a/src/pages/ReportParticipantsPage.js b/src/pages/ReportParticipantsPage.js
index 1ae6942c6412..376ef35da7cd 100755
--- a/src/pages/ReportParticipantsPage.js
+++ b/src/pages/ReportParticipantsPage.js
@@ -14,7 +14,7 @@ import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as UserUtils from '@libs/UserUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -83,6 +83,7 @@ const getAllParticipants = (report, personalDetails, translate) =>
.value();
function ReportParticipantsPage(props) {
+ const styles = useThemeStyles();
const participants = _.map(getAllParticipants(props.report, props.personalDetails, props.translate), (participant) => ({
...participant,
isDisabled: ReportUtils.isOptimisticPersonalDetail(participant.accountID),
diff --git a/src/pages/ReportWelcomeMessagePage.js b/src/pages/ReportWelcomeMessagePage.js
index c9bd65a11318..a0e471d00df6 100644
--- a/src/pages/ReportWelcomeMessagePage.js
+++ b/src/pages/ReportWelcomeMessagePage.js
@@ -15,7 +15,7 @@ import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import updateMultilineInputRange from '@libs/UpdateMultilineInputRange';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -45,6 +45,7 @@ const defaultProps = {
};
function ReportWelcomeMessagePage(props) {
+ const styles = useThemeStyles();
const parser = new ExpensiMark();
const [welcomeMessage, setWelcomeMessage] = useState(() => parser.htmlToMarkdown(props.report.welcomeMessage));
const welcomeMessageInputRef = useRef(null);
diff --git a/src/pages/RoomInvitePage.js b/src/pages/RoomInvitePage.js
index aedd406d28c0..a1f7d22c3dc3 100644
--- a/src/pages/RoomInvitePage.js
+++ b/src/pages/RoomInvitePage.js
@@ -18,7 +18,7 @@ import Permissions from '@libs/Permissions';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -63,6 +63,7 @@ const defaultProps = {
};
function RoomInvitePage(props) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const [searchTerm, setSearchTerm] = useState('');
const [selectedOptions, setSelectedOptions] = useState([]);
diff --git a/src/pages/RoomMembersPage.js b/src/pages/RoomMembersPage.js
index a2599b3382d7..2b96536c9719 100644
--- a/src/pages/RoomMembersPage.js
+++ b/src/pages/RoomMembersPage.js
@@ -21,7 +21,7 @@ import Permissions from '@libs/Permissions';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as UserUtils from '@libs/UserUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -78,6 +78,7 @@ const defaultProps = {
};
function RoomMembersPage(props) {
+ const styles = useThemeStyles();
const [selectedMembers, setSelectedMembers] = useState([]);
const [removeMembersConfirmModalVisible, setRemoveMembersConfirmModalVisible] = useState(false);
const [searchValue, setSearchValue] = useState('');
diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js
index 3e7731efc7b2..09201046d976 100755
--- a/src/pages/SearchPage.js
+++ b/src/pages/SearchPage.js
@@ -9,13 +9,13 @@ import {withNetwork} from '@components/OnyxProvider';
import OptionsSelector from '@components/OptionsSelector';
import ScreenWrapper from '@components/ScreenWrapper';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Performance from '@libs/Performance';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
import * as Report from '@userActions/Report';
import Timing from '@userActions/Timing';
import CONST from '@src/CONST';
@@ -45,6 +45,7 @@ const propTypes = {
/** Whether we are searching for reports in the server */
isSearchingForReports: PropTypes.bool,
+ ...withThemeStylesPropTypes,
};
const defaultProps = {
@@ -189,7 +190,7 @@ class SearchPage extends Component {
{({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => (
<>
-
+
Navigation.goBack(isReport ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(this.props.report.reportID) : ROUTES.SETTINGS)}
/>
-
-
+
+
Navigation.goBack(ROUTES.HOME)}
illustration={LottieAnimations.SaveTheWorld}
>
diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js
index 0b7ed4aedcd6..98c20a2f75aa 100644
--- a/src/pages/home/HeaderView.js
+++ b/src/pages/home/HeaderView.js
@@ -28,8 +28,8 @@ import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as Report from '@userActions/Report';
import * as Session from '@userActions/Session';
@@ -73,6 +73,8 @@ const defaultProps = {
};
function HeaderView(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const participants = lodashGet(props.report, 'participantAccountIDs', []);
const participantPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(participants, props.personalDetails);
const isMultipleParticipant = participants.length > 1;
@@ -247,7 +249,7 @@ function HeaderView(props) {
)}
diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js
index 7abf395644f8..0f09b51487ae 100644
--- a/src/pages/home/ReportScreen.js
+++ b/src/pages/home/ReportScreen.js
@@ -26,7 +26,7 @@ import * as ReportUtils from '@libs/ReportUtils';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportMetadataPropTypes from '@pages/reportMetadataPropTypes';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as ComposerActions from '@userActions/Composer';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -147,6 +147,7 @@ function ReportScreen({
userLeavingStatus,
currentReportID,
}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
@@ -427,8 +428,8 @@ function ReportScreen({
)}
{/* Note: The ReportActionsSkeletonView should be allowed to mount even if the initial report actions are not loaded.
- If we prevent rendering the report while they are loading then
- we'll unnecessarily unmount the ReportActionsView which will clear the new marker lines initial state. */}
+ If we prevent rendering the report while they are loading then
+ we'll unnecessarily unmount the ReportActionsView which will clear the new marker lines initial state. */}
{(!isReportReadyForDisplay || isLoadingInitialReportActions || isLoading) && }
{isReportReadyForDisplay ? (
diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js
index 93437393a5c5..873e7fa243af 100644
--- a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js
+++ b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.android.js
@@ -1,9 +1,10 @@
import React from 'react';
import {Animated, View} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import floatingMessageCounterContainerPropTypes from './floatingMessageCounterContainerPropTypes';
function FloatingMessageCounterContainer(props) {
+ const styles = useThemeStyles();
return (
{props.children}
diff --git a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js
index 2137fa07b573..0b721067631c 100644
--- a/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js
+++ b/src/pages/home/report/FloatingMessageCounter/FloatingMessageCounterContainer/index.js
@@ -1,9 +1,10 @@
import React from 'react';
import {Animated} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import floatingMessageCounterContainerPropTypes from './floatingMessageCounterContainerPropTypes';
function FloatingMessageCounterContainer(props) {
+ const styles = useThemeStyles();
return (
new Animated.Value(MARKER_INACTIVE_TRANSLATE_Y), []);
@@ -72,8 +74,9 @@ function FloatingMessageCounter(props) {
+
= 0 ? Math.min(props.maxAmountOfPreviews, props.linkMetadata.length) : props.linkMetadata.length),
(linkData) => {
@@ -99,7 +101,7 @@ function LinkPreviewer(props) {
{!_.isEmpty(title) && (
{title}
diff --git a/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js b/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js
index 226f26b352c4..6dd56471af07 100644
--- a/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js
+++ b/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js
@@ -3,8 +3,8 @@ import React from 'react';
import {ActivityIndicator, View} from 'react-native';
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView';
import useNetwork from '@hooks/useNetwork';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -32,6 +32,8 @@ const defaultProps = {
};
function ListBoundaryLoader({type, isLoadingOlderReportActions, isLoadingInitialReportActions, lastReportActionName, isLoadingNewerReportActions}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {isOffline} = useNetwork();
// we use two different loading components for header and footer to reduce the jumping effect when you scrolling to the newer reports
@@ -58,7 +60,7 @@ function ListBoundaryLoader({type, isLoadingOlderReportActions, isLoadingInitial
return (
diff --git a/src/pages/home/report/ParticipantLocalTime.js b/src/pages/home/report/ParticipantLocalTime.js
index 2ce0054a3e59..5efd53fe6ae7 100644
--- a/src/pages/home/report/ParticipantLocalTime.js
+++ b/src/pages/home/report/ParticipantLocalTime.js
@@ -6,7 +6,7 @@ import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import DateUtils from '@libs/DateUtils';
import Timers from '@libs/Timers';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -29,6 +29,7 @@ function getParticipantLocalTime(participant, preferredLocale) {
}
function ParticipantLocalTime(props) {
+ const styles = useThemeStyles();
const {participant, preferredLocale, translate} = props;
const [localTime, setLocalTime] = useState(() => getParticipantLocalTime(participant, preferredLocale));
diff --git a/src/pages/home/report/ReactionList/BaseReactionList.js b/src/pages/home/report/ReactionList/BaseReactionList.js
index bd1ed436ceaa..f94f6cdfde0d 100755
--- a/src/pages/home/report/ReactionList/BaseReactionList.js
+++ b/src/pages/home/report/ReactionList/BaseReactionList.js
@@ -8,7 +8,7 @@ import participantPropTypes from '@components/participantPropTypes';
import withWindowDimensions from '@components/withWindowDimensions';
import Navigation from '@libs/Navigation/Navigation';
import * as UserUtils from '@libs/UserUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
@@ -58,6 +58,7 @@ const getItemLayout = (_, index) => ({
});
function BaseReactionList(props) {
+ const styles = useThemeStyles();
if (!props.isVisible) {
return null;
}
diff --git a/src/pages/home/report/ReactionList/HeaderReactionList.js b/src/pages/home/report/ReactionList/HeaderReactionList.js
index 49d61f05b191..c07b36d42949 100644
--- a/src/pages/home/report/ReactionList/HeaderReactionList.js
+++ b/src/pages/home/report/ReactionList/HeaderReactionList.js
@@ -6,8 +6,8 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
import * as EmojiUtils from '@libs/EmojiUtils';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import reactionPropTypes from './reactionPropTypes';
const propTypes = {
@@ -26,6 +26,7 @@ const defaultProps = {
};
function HeaderReactionList(props) {
+ const styles = useThemeStyles();
return (
diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js
index 6ab09a5a1bd4..32b9a53a5880 100644
--- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js
+++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js
@@ -17,7 +17,7 @@ import * as Browser from '@libs/Browser';
import compose from '@libs/compose';
import Permissions from '@libs/Permissions';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import * as Report from '@userActions/Report';
import * as Task from '@userActions/Task';
@@ -124,6 +124,7 @@ function AttachmentPickerWithMenuItems({
actionButtonRef,
isFocused,
}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {windowHeight} = useWindowDimensions();
diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js
index 3f943502f748..e376e8481c0c 100644
--- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js
+++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js
@@ -28,8 +28,8 @@ import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutsi
import SilentCommentUpdater from '@pages/home/report/ReportActionCompose/SilentCommentUpdater';
import Suggestions from '@pages/home/report/ReportActionCompose/Suggestions';
import containerComposeStyles from '@styles/containerComposeStyles';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as EmojiPickerActions from '@userActions/EmojiPickerAction';
import * as InputFocus from '@userActions/InputFocus';
import * as Report from '@userActions/Report';
@@ -107,6 +107,8 @@ function ComposerWithSuggestions({
// For testing
children,
}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {preferredLocale} = useLocalize();
const isFocused = useIsFocused();
const navigation = useNavigation();
@@ -533,7 +535,7 @@ function ComposerWithSuggestions({
multiline
ref={setTextInputRef}
placeholder={inputPlaceholder}
- placeholderTextColor={themeColors.placeholderText}
+ placeholderTextColor={theme.placeholderText}
onChangeText={(commentValue) => updateComment(commentValue, true)}
onKeyPress={triggerHotkeyActions}
textAlignVertical="top"
diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js
index c0a1151f0202..7bce37dc3826 100644
--- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js
+++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js
@@ -29,7 +29,7 @@ import reportActionPropTypes from '@pages/home/report/reportActionPropTypes';
import ReportDropUI from '@pages/home/report/ReportDropUI';
import ReportTypingIndicator from '@pages/home/report/ReportTypingIndicator';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as EmojiPickerActions from '@userActions/EmojiPickerAction';
import * as Report from '@userActions/Report';
import * as User from '@userActions/User';
@@ -116,6 +116,7 @@ function ReportActionCompose({
shouldShowComposeInput,
isReportReadyForDisplay,
}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions();
const animatedRef = useAnimatedRef();
diff --git a/src/pages/home/report/ReportActionCompose/SendButton.js b/src/pages/home/report/ReportActionCompose/SendButton.js
index 41f35b0f8d3d..60c657ca95c7 100644
--- a/src/pages/home/report/ReportActionCompose/SendButton.js
+++ b/src/pages/home/report/ReportActionCompose/SendButton.js
@@ -7,8 +7,8 @@ import * as Expensicons from '@components/Icon/Expensicons';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -20,6 +20,8 @@ const propTypes = {
};
function SendButton({isDisabled: isDisabledProp, handleSendMessage}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const Tap = Gesture.Tap()
@@ -48,7 +50,7 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}) {
{({pressed}) => (
)}
diff --git a/src/pages/home/report/ReportActionItemBasicMessage.js b/src/pages/home/report/ReportActionItemBasicMessage.js
index 87997b29b833..219564e5a8ec 100644
--- a/src/pages/home/report/ReportActionItemBasicMessage.js
+++ b/src/pages/home/report/ReportActionItemBasicMessage.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import Text from '@components/Text';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
message: PropTypes.string.isRequired,
@@ -14,6 +14,7 @@ const defaultProps = {
};
function ReportActionItemBasicMessage(props) {
+ const styles = useThemeStyles();
return (
{props.message}
diff --git a/src/pages/home/report/ReportActionItemCreated.js b/src/pages/home/report/ReportActionItemCreated.js
index a7772ad5e0fb..4c7f14a21abc 100644
--- a/src/pages/home/report/ReportActionItemCreated.js
+++ b/src/pages/home/report/ReportActionItemCreated.js
@@ -14,8 +14,8 @@ import compose from '@libs/compose';
import reportWithoutHasDraftSelector from '@libs/OnyxSelectors/reportWithoutHasDraftSelector';
import * as ReportUtils from '@libs/ReportUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -49,6 +49,7 @@ const defaultProps = {
};
function ReportActionItemCreated(props) {
+ const styles = useThemeStyles();
if (!ReportUtils.isChatReport(props.report)) {
return null;
}
diff --git a/src/pages/home/report/ReportActionItemDate.js b/src/pages/home/report/ReportActionItemDate.js
index 346a1c2683f0..a65bdd4aa7d7 100644
--- a/src/pages/home/report/ReportActionItemDate.js
+++ b/src/pages/home/report/ReportActionItemDate.js
@@ -4,7 +4,7 @@ import {withCurrentDate} from '@components/OnyxProvider';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** UTC timestamp for when the action was created */
@@ -13,6 +13,7 @@ const propTypes = {
};
function ReportActionItemDate(props) {
+ const styles = useThemeStyles();
return {props.datetimeToCalendarTime(props.created)};
}
diff --git a/src/pages/home/report/ReportActionItemDraft.js b/src/pages/home/report/ReportActionItemDraft.js
index 500c4146e608..9b3839aa78f2 100644
--- a/src/pages/home/report/ReportActionItemDraft.js
+++ b/src/pages/home/report/ReportActionItemDraft.js
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Children view component for this action item */
@@ -9,6 +9,7 @@ const propTypes = {
};
function ReportActionItemDraft(props) {
+ const styles = useThemeStyles();
return (
{props.children}
diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js
index bdef759d0ed6..c5097bdfc4a5 100644
--- a/src/pages/home/report/ReportActionItemFragment.js
+++ b/src/pages/home/report/ReportActionItemFragment.js
@@ -10,7 +10,7 @@ import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withW
import compose from '@libs/compose';
import convertToLTR from '@libs/convertToLTR';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import AttachmentCommentFragment from './comment/AttachmentCommentFragment';
import TextCommentFragment from './comment/TextCommentFragment';
@@ -94,6 +94,7 @@ const defaultProps = {
};
function ReportActionItemFragment(props) {
+ const styles = useThemeStyles();
const fragment = props.fragment;
switch (fragment.type) {
diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js
index 75e316342165..2265530f29a1 100644
--- a/src/pages/home/report/ReportActionItemMessage.js
+++ b/src/pages/home/report/ReportActionItemMessage.js
@@ -6,7 +6,7 @@ import _ from 'underscore';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ReportActionItemFragment from './ReportActionItemFragment';
import reportActionPropTypes from './reportActionPropTypes';
@@ -37,6 +37,7 @@ const defaultProps = {
};
function ReportActionItemMessage(props) {
+ const styles = useThemeStyles();
const fragments = _.compact(props.action.previousMessage || props.action.message);
const isIOUReport = ReportActionsUtils.isMoneyRequestAction(props.action);
let iouMessage;
diff --git a/src/pages/home/report/ReportActionItemMessageEdit.js b/src/pages/home/report/ReportActionItemMessageEdit.js
index 60714dad9864..b723ddd93582 100644
--- a/src/pages/home/report/ReportActionItemMessageEdit.js
+++ b/src/pages/home/report/ReportActionItemMessageEdit.js
@@ -28,8 +28,8 @@ import * as ReportUtils from '@libs/ReportUtils';
import setShouldShowComposeInputKeyboardAware from '@libs/setShouldShowComposeInputKeyboardAware';
import reportPropTypes from '@pages/reportPropTypes';
import containerComposeStyles from '@styles/containerComposeStyles';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as EmojiPickerAction from '@userActions/EmojiPickerAction';
import * as InputFocus from '@userActions/InputFocus';
import * as Report from '@userActions/Report';
@@ -80,6 +80,8 @@ const messageEditInput = 'messageEditInput';
const isMobileSafari = Browser.isMobileSafari();
function ReportActionItemMessageEdit(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const reportScrollManager = useReportScrollManager();
const {translate, preferredLocale} = useLocalize();
const {isKeyboardShown} = useKeyboardState();
@@ -457,7 +459,7 @@ function ReportActionItemMessageEdit(props) {
>
diff --git a/src/pages/home/report/ReportActionItemParentAction.js b/src/pages/home/report/ReportActionItemParentAction.js
index e2274ce41ae0..ad319b86e634 100644
--- a/src/pages/home/report/ReportActionItemParentAction.js
+++ b/src/pages/home/report/ReportActionItemParentAction.js
@@ -9,8 +9,8 @@ import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withW
import compose from '@libs/compose';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import ONYXKEYS from '@src/ONYXKEYS';
import AnimatedEmptyStateBackground from './AnimatedEmptyStateBackground';
@@ -46,6 +46,7 @@ const defaultProps = {
};
function ReportActionItemParentAction(props) {
+ const styles = useThemeStyles();
const parentReportAction = props.parentReportActions[`${props.report.parentReportActionID}`];
// In case of transaction threads, we do not want to render the parent report action.
diff --git a/src/pages/home/report/ReportActionItemThread.js b/src/pages/home/report/ReportActionItemThread.js
index 9cfc46f4bf91..bfb5ae0c5a44 100644
--- a/src/pages/home/report/ReportActionItemThread.js
+++ b/src/pages/home/report/ReportActionItemThread.js
@@ -7,7 +7,7 @@ import PressableWithSecondaryInteraction from '@components/PressableWithSecondar
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import compose from '@libs/compose';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -35,6 +35,7 @@ const propTypes = {
};
function ReportActionItemThread(props) {
+ const styles = useThemeStyles();
const numberOfRepliesText = props.numberOfReplies > CONST.MAX_THREAD_REPLIES_PREVIEW ? `${CONST.MAX_THREAD_REPLIES_PREVIEW}+` : `${props.numberOfReplies}`;
const replyText = props.numberOfReplies === 1 ? props.translate('threads.reply') : props.translate('threads.replies');
diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js
index cc19170ae318..eb555500a557 100644
--- a/src/pages/home/report/ReportActionsList.js
+++ b/src/pages/home/report/ReportActionsList.js
@@ -16,7 +16,7 @@ import DateUtils from '@libs/DateUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -130,6 +130,7 @@ function ReportActionsList({
onLayout,
isComposerFullSize,
}) {
+ const styles = useThemeStyles();
const reportScrollManager = useReportScrollManager();
const {translate} = useLocalize();
const {isOffline} = useNetwork();
@@ -281,7 +282,7 @@ function ReportActionsList({
const minimumReportActionHeight = styles.chatItem.paddingTop + styles.chatItem.paddingBottom + variables.fontSizeNormalHeight;
const availableHeight = windowHeight - (CONST.CHAT_FOOTER_MIN_HEIGHT + variables.contentHeaderHeight);
return Math.ceil(availableHeight / minimumReportActionHeight);
- }, [windowHeight]);
+ }, [styles.chatItem.paddingBottom, styles.chatItem.paddingTop, windowHeight]);
/**
* Thread's divider line should hide when the first chat in the thread is marked as unread.
@@ -359,7 +360,7 @@ function ReportActionsList({
const contentContainerStyle = useMemo(
() => [styles.chatContentScrollView, isLoadingNewerReportActions ? styles.chatContentScrollViewWithHeaderLoader : {}],
- [isLoadingNewerReportActions],
+ [isLoadingNewerReportActions, styles.chatContentScrollView, styles.chatContentScrollViewWithHeaderLoader],
);
const lastReportAction = useMemo(() => _.last(sortedReportActions) || {}, [sortedReportActions]);
diff --git a/src/pages/home/report/ReportDropUI.js b/src/pages/home/report/ReportDropUI.js
index ae0c941b37e7..2f4c81313ec2 100644
--- a/src/pages/home/report/ReportDropUI.js
+++ b/src/pages/home/report/ReportDropUI.js
@@ -6,7 +6,7 @@ import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
const propTypes = {
/** Callback to execute when a file is dropped. */
@@ -14,6 +14,7 @@ const propTypes = {
};
function ReportDropUI({onDrop}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/pages/home/report/ReportFooter.js b/src/pages/home/report/ReportFooter.js
index 00d586b67697..e5dd5da19ad5 100644
--- a/src/pages/home/report/ReportFooter.js
+++ b/src/pages/home/report/ReportFooter.js
@@ -12,7 +12,7 @@ import useNetwork from '@hooks/useNetwork';
import compose from '@libs/compose';
import * as ReportUtils from '@libs/ReportUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
@@ -64,6 +64,7 @@ const defaultProps = {
};
function ReportFooter(props) {
+ const styles = useThemeStyles();
const {isOffline} = useNetwork();
const chatFooterStyles = {...styles.chatFooter, minHeight: !isOffline ? CONST.CHAT_FOOTER_MIN_HEIGHT : 0};
const isArchivedRoom = ReportUtils.isArchivedRoom(props.report);
diff --git a/src/pages/home/report/ReportTypingIndicator.js b/src/pages/home/report/ReportTypingIndicator.js
index 7b2b46b7d097..3a2c611ac358 100755
--- a/src/pages/home/report/ReportTypingIndicator.js
+++ b/src/pages/home/report/ReportTypingIndicator.js
@@ -8,7 +8,7 @@ import Text from '@components/Text';
import TextWithEllipsis from '@components/TextWithEllipsis';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as PersonalDetails from '@userActions/PersonalDetails';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -27,6 +27,7 @@ const defaultProps = {
};
function ReportTypingIndicator(props) {
+ const styles = useThemeStyles();
const usersTyping = useMemo(() => _.filter(_.keys(props.userTypingStatuses), (loginOrAccountID) => props.userTypingStatuses[loginOrAccountID]), [props.userTypingStatuses]);
// If we are offline, the user typing statuses are not up-to-date so do not show them
if (props.network.isOffline) {
diff --git a/src/pages/home/report/comment/AttachmentCommentFragment.js b/src/pages/home/report/comment/AttachmentCommentFragment.js
index 8ee161600aee..ec75edd18a35 100644
--- a/src/pages/home/report/comment/AttachmentCommentFragment.js
+++ b/src/pages/home/report/comment/AttachmentCommentFragment.js
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import reportActionSourcePropType from '@pages/home/report/reportActionSourcePropType';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import RenderCommentHTML from './RenderCommentHTML';
const propTypes = {
@@ -17,6 +17,7 @@ const propTypes = {
};
function AttachmentCommentFragment({addExtraMargin, html, source}) {
+ const styles = useThemeStyles();
return (
{props.translate('reportActionCompose.edited')}
diff --git a/src/pages/home/sidebar/AvatarWithOptionalStatus.js b/src/pages/home/sidebar/AvatarWithOptionalStatus.js
index 300a898b9e90..4507b21a382c 100644
--- a/src/pages/home/sidebar/AvatarWithOptionalStatus.js
+++ b/src/pages/home/sidebar/AvatarWithOptionalStatus.js
@@ -6,7 +6,7 @@ import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeed
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import PressableAvatarWithIndicator from './PressableAvatarWithIndicator';
@@ -25,6 +25,7 @@ const defaultProps = {
};
function AvatarWithOptionalStatus({emojiStatus, isCreateMenuOpen}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const showStatusPage = useCallback(() => {
diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js
index ad981a190a70..5e69be266342 100644
--- a/src/pages/home/sidebar/SidebarLinks.js
+++ b/src/pages/home/sidebar/SidebarLinks.js
@@ -19,9 +19,9 @@ import onyxSubscribe from '@libs/onyxSubscribe';
import SidebarUtils from '@libs/SidebarUtils';
import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu';
import safeAreaInsetPropTypes from '@pages/safeAreaInsetPropTypes';
-import styles from '@styles/styles';
import * as StyleUtils from '@styles/StyleUtils';
-import defaultTheme from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import variables from '@styles/variables';
import * as App from '@userActions/App';
import * as Session from '@userActions/Session';
@@ -52,6 +52,8 @@ const propTypes = {
};
function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priorityMode = CONST.PRIORITY_MODE.DEFAULT, isActiveReport, isCreateMenuOpen}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const modal = useRef({});
const {translate, updateLocale} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
@@ -155,7 +157,7 @@ function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priority
diff --git a/src/pages/home/sidebar/SidebarLinksData.js b/src/pages/home/sidebar/SidebarLinksData.js
index 9cf981170ee5..dc7d00566bc0 100644
--- a/src/pages/home/sidebar/SidebarLinksData.js
+++ b/src/pages/home/sidebar/SidebarLinksData.js
@@ -12,7 +12,7 @@ import compose from '@libs/compose';
import * as SessionUtils from '@libs/SessionUtils';
import SidebarUtils from '@libs/SidebarUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import SidebarLinks, {basePropTypes} from './SidebarLinks';
@@ -64,6 +64,7 @@ const defaultProps = {
};
function SidebarLinksData({isFocused, allReportActions, betas, chatReports, currentReportID, insets, isLoadingReportData, onLinkClick, policies, priorityMode}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const reportIDsRef = useRef(null);
diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js
index 0d2930220bcd..5b7a126a4655 100644
--- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js
+++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.js
@@ -4,7 +4,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import * as Browser from '@libs/Browser';
import Performance from '@libs/Performance';
import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import Timing from '@userActions/Timing';
import CONST from '@src/CONST';
import sidebarPropTypes from './sidebarPropTypes';
@@ -18,6 +18,7 @@ const startTimer = () => {
};
function BaseSidebarScreen(props) {
+ const styles = useThemeStyles();
useEffect(() => {
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED);
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true);
diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
index 57f31a8c3e9f..739f7e3e0295 100644
--- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
+++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
@@ -14,7 +14,7 @@ import usePrevious from '@hooks/usePrevious';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import Permissions from '@libs/Permissions';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as App from '@userActions/App';
import * as IOU from '@userActions/IOU';
import * as Policy from '@userActions/Policy';
@@ -87,6 +87,7 @@ const defaultProps = {
* @returns {JSX.Element}
*/
function FloatingActionButtonAndPopover(props) {
+ const styles = useThemeStyles();
const [isCreateMenuActive, setIsCreateMenuActive] = useState(false);
const isAnonymousUser = Session.isAnonymousUser();
const anchorRef = useRef(null);
diff --git a/src/pages/home/sidebar/SignInButton.js b/src/pages/home/sidebar/SignInButton.js
index afa67bdc04cd..c42e56551200 100644
--- a/src/pages/home/sidebar/SignInButton.js
+++ b/src/pages/home/sidebar/SignInButton.js
@@ -4,11 +4,12 @@ import {View} from 'react-native';
import Button from '@components/Button';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
function SignInButton() {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js
index 9551004eb1ab..7f3bf7985ba6 100644
--- a/src/pages/iou/MoneyRequestCategoryPage.js
+++ b/src/pages/iou/MoneyRequestCategoryPage.js
@@ -10,7 +10,7 @@ import useLocalize from '@hooks/useLocalize';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -43,6 +43,7 @@ const defaultProps = {
};
function MoneyRequestCategoryPage({route, report, iou}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const reportID = lodashGet(route, 'params.reportID', '');
diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js
index 430af5d9de94..2eae14b2e180 100644
--- a/src/pages/iou/MoneyRequestDatePage.js
+++ b/src/pages/iou/MoneyRequestDatePage.js
@@ -10,7 +10,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -49,6 +49,7 @@ const defaultProps = {
};
function MoneyRequestDatePage({iou, route, selectedTab}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const iouType = lodashGet(route, 'params.iouType', '');
const reportID = lodashGet(route, 'params.reportID', '');
diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js
index 35fcc0d900e9..43d7b58bfc7f 100644
--- a/src/pages/iou/MoneyRequestDescriptionPage.js
+++ b/src/pages/iou/MoneyRequestDescriptionPage.js
@@ -16,7 +16,7 @@ import * as Browser from '@libs/Browser';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
import updateMultilineInputRange from '@libs/UpdateMultilineInputRange';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -55,6 +55,7 @@ const defaultProps = {
};
function MoneyRequestDescriptionPage({iou, route, selectedTab}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const inputRef = useRef(null);
const focusTimeoutRef = useRef(null);
diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js
index ce9fc3be7d34..2c5869dfa7a3 100644
--- a/src/pages/iou/MoneyRequestMerchantPage.js
+++ b/src/pages/iou/MoneyRequestMerchantPage.js
@@ -12,7 +12,7 @@ import TextInput from '@components/TextInput';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -48,6 +48,7 @@ const defaultProps = {
};
function MoneyRequestMerchantPage({iou, route}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const {inputCallbackRef} = useAutoFocusInput();
const iouType = lodashGet(route, 'params.iouType', '');
diff --git a/src/pages/iou/MoneyRequestSelectorPage.js b/src/pages/iou/MoneyRequestSelectorPage.js
index e6ea81fc896b..37eaee513fb6 100644
--- a/src/pages/iou/MoneyRequestSelectorPage.js
+++ b/src/pages/iou/MoneyRequestSelectorPage.js
@@ -19,7 +19,7 @@ import OnyxTabNavigator, {TopTab} from '@libs/Navigation/OnyxTabNavigator';
import * as ReportUtils from '@libs/ReportUtils';
import withReportOrNotFound from '@pages/home/report/withReportOrNotFound';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -57,6 +57,7 @@ const defaultProps = {
};
function MoneyRequestSelectorPage(props) {
+ const styles = useThemeStyles();
const [isDraggingOver, setIsDraggingOver] = useState(false);
const iouType = lodashGet(props.route, 'params.iouType', '');
diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js
index 43f2ebde10ba..b8ef1dba6207 100644
--- a/src/pages/iou/MoneyRequestTagPage.js
+++ b/src/pages/iou/MoneyRequestTagPage.js
@@ -13,7 +13,7 @@ import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
@@ -50,6 +50,7 @@ const defaultProps = {
};
function MoneyRequestTagPage({route, report, policyTags, iou}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const iouType = lodashGet(route, 'params.iouType', '');
diff --git a/src/pages/iou/ReceiptDropUI.js b/src/pages/iou/ReceiptDropUI.js
index 9c1483663d4b..18ad31e036e4 100644
--- a/src/pages/iou/ReceiptDropUI.js
+++ b/src/pages/iou/ReceiptDropUI.js
@@ -4,7 +4,7 @@ import {Text, View} from 'react-native';
import ReceiptUpload from '@assets/images/receipt-upload.svg';
import DragAndDropConsumer from '@components/DragAndDrop/Consumer';
import useLocalize from '@hooks/useLocalize';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -20,6 +20,7 @@ const defaultProps = {
};
function ReceiptDropUI({onDrop, receiptImageTopPosition}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
return (
diff --git a/src/pages/iou/ReceiptSelector/index.js b/src/pages/iou/ReceiptSelector/index.js
index 74bb7d27a1af..dd7c2e3a104e 100644
--- a/src/pages/iou/ReceiptSelector/index.js
+++ b/src/pages/iou/ReceiptSelector/index.js
@@ -22,8 +22,8 @@ import Navigation from '@libs/Navigation/Navigation';
import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes';
import ReceiptDropUI from '@pages/iou/ReceiptDropUI';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -62,6 +62,8 @@ const defaultProps = {
};
function ReceiptSelector({route, transactionID, iou, report}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const iouType = lodashGet(route, 'params.iouType', '');
const pageIndex = lodashGet(route, 'params.pageIndex', 1);
@@ -171,9 +173,10 @@ function ReceiptSelector({route, transactionID, iou, report}) {
)}
+
{cameraPermissionState === 'denied' && (
)}
@@ -245,7 +248,7 @@ function ReceiptSelector({route, transactionID, iou, report}) {
height={32}
width={32}
src={Expensicons.Bolt}
- fill={isFlashLightOn ? themeColors.iconHovered : themeColors.textSupporting}
+ fill={isFlashLightOn ? theme.iconHovered : theme.textSupporting}
/>
diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js
index ef81109ffb90..8a1db47aa742 100644
--- a/src/pages/iou/ReceiptSelector/index.native.js
+++ b/src/pages/iou/ReceiptSelector/index.native.js
@@ -18,8 +18,8 @@ import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -59,6 +59,8 @@ const defaultProps = {
};
function ReceiptSelector({route, report, iou, transactionID}) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const devices = useCameraDevices('wide-angle-camera');
const device = devices.back;
@@ -198,7 +200,7 @@ function ReceiptSelector({route, report, iou, transactionID}) {
)}
@@ -243,7 +245,7 @@ function ReceiptSelector({route, report, iou, transactionID}) {
height={32}
width={32}
src={Expensicons.Gallery}
- fill={themeColors.textSupporting}
+ fill={theme.textSupporting}
/>
)}
@@ -270,7 +272,7 @@ function ReceiptSelector({route, report, iou, transactionID}) {
height={32}
width={32}
src={Expensicons.Bolt}
- fill={flash ? themeColors.iconHovered : themeColors.textSupporting}
+ fill={flash ? theme.iconHovered : theme.textSupporting}
/>
diff --git a/src/pages/iou/SplitBillDetailsPage.js b/src/pages/iou/SplitBillDetailsPage.js
index e7be67ea5c8d..d1fe21d8cf4e 100644
--- a/src/pages/iou/SplitBillDetailsPage.js
+++ b/src/pages/iou/SplitBillDetailsPage.js
@@ -19,7 +19,7 @@ import reportActionPropTypes from '@pages/home/report/reportActionPropTypes';
import withReportAndReportActionOrNotFound from '@pages/home/report/withReportAndReportActionOrNotFound';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -70,6 +70,7 @@ const defaultProps = {
};
function SplitBillDetailsPage(props) {
+ const styles = useThemeStyles();
const {reportID} = props.report;
const {translate} = useLocalize();
const reportAction = props.reportActions[`${props.route.params.reportActionID.toString()}`];
diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js
index faddc988d250..ecc56fbae80f 100644
--- a/src/pages/iou/WaypointEditor.js
+++ b/src/pages/iou/WaypointEditor.js
@@ -19,7 +19,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import * as ErrorUtils from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as ValidationUtils from '@libs/ValidationUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Transaction from '@userActions/Transaction';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -77,6 +77,7 @@ const defaultProps = {
};
function WaypointEditor({route: {params: {iouType = '', transactionID = '', waypointIndex = '', threadReportID = 0}} = {}, transaction, recentWaypoints}) {
+ const styles = useThemeStyles();
const {windowWidth} = useWindowDimensions();
const [isDeleteStopModalOpen, setIsDeleteStopModalOpen] = useState(false);
const navigation = useNavigation();
diff --git a/src/pages/iou/steps/MoneyRequestAmountForm.js b/src/pages/iou/steps/MoneyRequestAmountForm.js
index 734b7d9794b4..c7b1c14ea798 100644
--- a/src/pages/iou/steps/MoneyRequestAmountForm.js
+++ b/src/pages/iou/steps/MoneyRequestAmountForm.js
@@ -15,7 +15,7 @@ import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import getOperatingSystem from '@libs/getOperatingSystem';
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
const propTypes = {
@@ -69,6 +69,7 @@ const NUM_PAD_CONTAINER_VIEW_ID = 'numPadContainerView';
const NUM_PAD_VIEW_ID = 'numPadView';
function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCurrencyButtonPress, onSubmitButtonPress, selectedTab}) {
+ const styles = useThemeStyles();
const {isExtraSmallScreenHeight} = useWindowDimensions();
const {translate, toLocaleDigit, numberFormat} = useLocalize();
diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js
index 54a84f99fa55..ebb687b324e8 100644
--- a/src/pages/iou/steps/MoneyRequestConfirmPage.js
+++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js
@@ -22,7 +22,7 @@ import * as ReportUtils from '@libs/ReportUtils';
import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import * as Policy from '@userActions/Policy';
import CONST from '@src/CONST';
@@ -61,6 +61,7 @@ const defaultProps = {
};
function MoneyRequestConfirmPage(props) {
+ const styles = useThemeStyles();
const {isOffline} = useNetwork();
const {windowWidth} = useWindowDimensions();
const prevMoneyRequestId = useRef(props.iou.id);
diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js
index 7d38ee1c0282..7cb0e72356e1 100644
--- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js
+++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js
@@ -15,7 +15,7 @@ import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as TransactionUtils from '@libs/TransactionUtils';
import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -52,6 +52,7 @@ const defaultProps = {
};
function MoneyRequestParticipantsPage({iou, selectedTab, route, transaction}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const prevMoneyRequestId = useRef(iou.id);
const optionsSelectorRef = useRef();
diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
index 553ba6ae5170..925a25db9484 100755
--- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
+++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
@@ -17,7 +17,7 @@ import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as ReportUtils from '@libs/ReportUtils';
import personalDetailsPropType from '@pages/personalDetailsPropType';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -95,6 +95,7 @@ function MoneyRequestParticipantsSelector({
isDistanceRequest,
isSearchingForReports,
}) {
+ const styles = useThemeStyles();
const [searchTerm, setSearchTerm] = useState('');
const [newChatOptions, setNewChatOptions] = useState({
recentReports: [],
diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js
index 84082337d39b..1140bbbcf5b2 100644
--- a/src/pages/iou/steps/NewRequestAmountPage.js
+++ b/src/pages/iou/steps/NewRequestAmountPage.js
@@ -15,7 +15,7 @@ import * as MoneyRequestUtils from '@libs/MoneyRequestUtils';
import Navigation from '@libs/Navigation/Navigation';
import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes';
import reportPropTypes from '@pages/reportPropTypes';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -55,6 +55,7 @@ const defaultProps = {
};
function NewRequestAmountPage({route, iou, report, selectedTab}) {
+ const styles = useThemeStyles();
const {translate} = useLocalize();
const prevMoneyRequestID = useRef(iou.id);
diff --git a/src/pages/settings/AboutPage/AboutPage.js b/src/pages/settings/AboutPage/AboutPage.js
index b09117719a8c..a88a07117f08 100644
--- a/src/pages/settings/AboutPage/AboutPage.js
+++ b/src/pages/settings/AboutPage/AboutPage.js
@@ -17,7 +17,7 @@ import * as Environment from '@libs/Environment/Environment';
import Navigation from '@libs/Navigation/Navigation';
import {CONTEXT_MENU_TYPES} from '@pages/home/report/ContextMenu/ContextMenuActions';
import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as Report from '@userActions/Report';
import CONST from '@src/CONST';
@@ -41,6 +41,7 @@ function getFlavor() {
}
function AboutPage(props) {
+ const styles = useThemeStyles();
const {translate} = props;
const popoverAnchor = useRef(null);
const waitForNavigate = useWaitForNavigation();
diff --git a/src/pages/settings/AppDownloadLinks.js b/src/pages/settings/AppDownloadLinks.js
index db86b23fa048..ab8a1f310cf4 100644
--- a/src/pages/settings/AppDownloadLinks.js
+++ b/src/pages/settings/AppDownloadLinks.js
@@ -11,7 +11,7 @@ import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import {CONTEXT_MENU_TYPES} from '@pages/home/report/ContextMenu/ContextMenuActions';
import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
@@ -22,6 +22,7 @@ const propTypes = {
};
function AppDownloadLinksPage(props) {
+ const styles = useThemeStyles();
let popoverAnchor;
const menuItems = [
diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js
index 207c006a31c2..36c457f8e6ed 100755
--- a/src/pages/settings/InitialSettingsPage.js
+++ b/src/pages/settings/InitialSettingsPage.js
@@ -34,8 +34,8 @@ import {CONTEXT_MENU_TYPES} from '@pages/home/report/ContextMenu/ContextMenuActi
import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu';
import policyMemberPropType from '@pages/policyMemberPropType';
import * as ReimbursementAccountProps from '@pages/ReimbursementAccount/reimbursementAccountPropTypes';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as Link from '@userActions/Link';
import * as PaymentMethods from '@userActions/PaymentMethods';
import * as Session from '@userActions/Session';
@@ -130,6 +130,8 @@ const defaultProps = {
};
function InitialSettingsPage(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {isExecuting, singleExecution} = useSingleExecution();
const waitForNavigate = useWaitForNavigation();
const popoverAnchor = useRef(null);
@@ -333,7 +335,7 @@ function InitialSettingsPage(props) {
{_.isEmpty(props.currentUserPersonalDetails) || _.isUndefined(props.currentUserPersonalDetails.displayName) ? (
) : (
@@ -390,7 +392,7 @@ function InitialSettingsPage(props) {
title={translate('common.settings')}
headerContent={headerContent}
headerContainerStyles={[styles.staticHeaderImage, styles.justifyContentCenter]}
- backgroundColor={themeColors.PAGE_BACKGROUND_COLORS[SCREENS.SETTINGS.ROOT]}
+ backgroundColor={theme.PAGE_BACKGROUND_COLORS[SCREENS.SETTINGS.ROOT]}
>
{getMenuItems}
diff --git a/src/pages/settings/Preferences/PreferencesPage.js b/src/pages/settings/Preferences/PreferencesPage.js
index f715c2082f13..4dbc5fda9198 100755
--- a/src/pages/settings/Preferences/PreferencesPage.js
+++ b/src/pages/settings/Preferences/PreferencesPage.js
@@ -12,8 +12,8 @@ import Text from '@components/Text';
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
+import useTheme from '@styles/themes/useTheme';
+import useThemeStyles from '@styles/useThemeStyles';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -37,6 +37,8 @@ const defaultProps = {
};
function PreferencesPage(props) {
+ const theme = useTheme();
+ const styles = useThemeStyles();
const {isProduction} = useEnvironment();
const {translate, preferredLocale} = useLocalize();
@@ -44,7 +46,7 @@ function PreferencesPage(props) {
Navigation.goBack(ROUTES.SETTINGS)}
- backgroundColor={themeColors.PAGE_BACKGROUND_COLORS[SCREENS.SETTINGS.PREFERENCES]}
+ backgroundColor={theme.PAGE_BACKGROUND_COLORS[SCREENS.SETTINGS.PREFERENCES]}
illustration={LottieAnimations.PreferencesDJ}
>
diff --git a/src/pages/settings/Preferences/PriorityModePage.js b/src/pages/settings/Preferences/PriorityModePage.js
index 73c6932b6218..8f6e4564fe92 100644
--- a/src/pages/settings/Preferences/PriorityModePage.js
+++ b/src/pages/settings/Preferences/PriorityModePage.js
@@ -8,7 +8,7 @@ import SelectionList from '@components/SelectionList';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -26,6 +26,7 @@ const defaultProps = {
};
function PriorityModePage(props) {
+ const styles = useThemeStyles();
const priorityModes = _.map(_.values(CONST.PRIORITY_MODE), (mode) => ({
value: mode,
text: props.translate(`priorityModePage.priorityModes.${mode}.label`),
diff --git a/src/pages/settings/Preferences/ThemePage.js b/src/pages/settings/Preferences/ThemePage.js
index 7802faecce14..f4acd10a7230 100644
--- a/src/pages/settings/Preferences/ThemePage.js
+++ b/src/pages/settings/Preferences/ThemePage.js
@@ -9,7 +9,7 @@ import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
+import useThemeStyles from '@styles/useThemeStyles';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -27,6 +27,7 @@ const defaultProps = {
};
function ThemePage(props) {
+ const styles = useThemeStyles();
const localesToThemes = _.map(_.values(_.omit(CONST.THEME, 'DEFAULT')), (theme) => ({
value: theme,
text: props.translate(`themePage.themes.${theme}.label`),
diff --git a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
index b97bc2521e55..5f91414368a0 100644
--- a/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
+++ b/src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
@@ -16,11 +16,11 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
+import withTheme, {withThemePropTypes} from '@components/withTheme';
+import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import compose from '@libs/compose';
import * as ErrorUtils from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
-import styles from '@styles/styles';
-import themeColors from '@styles/themes/default';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
@@ -73,6 +73,8 @@ const propTypes = {
isLoadingReportData: PropTypes.bool,
...withLocalizePropTypes,
+ ...withThemeStylesPropTypes,
+ ...withThemePropTypes,
};
const defaultProps = {
@@ -268,20 +270,23 @@ class ContactMethodDetailsPage extends Component {
isVisible={this.state.isDeleteModalOpen && !isDefaultContactMethod}
danger
/>
+
{isFailedAddContactMethod && (
)}
+
{!loginData.validatedDate && !isFailedAddContactMethod && (
-
+
+
User.clearContactMethodErrors(contactMethod, 'defaultLogin')}
>