Skip to content

Commit

Permalink
Replace withLocalize HOC with hook usage
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Nov 20, 2023
1 parent 67a29ca commit c4ca2d5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React, {memo} from 'react';
import {StyleProp, TextStyle, View, ViewStyle} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import getButtonState from '@libs/getButtonState';
import * as StyleUtils from '@styles/StyleUtils';
import useThemeStyles from '@styles/useThemeStyles';
import CONST from '@src/CONST';
import Hoverable from './Hoverable';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import type {LocaleContextProps} from './LocaleContextProvider';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import RenderHTML from './RenderHTML';
import Text from './Text';
import Tooltip from './Tooltip';
import withLocalize from './withLocalize';

type BannerProps = LocaleContextProps & {
type BannerProps = {
/** Text to display in the banner. */
text: string;

Expand All @@ -40,8 +39,9 @@ type BannerProps = LocaleContextProps & {
textStyles?: StyleProp<TextStyle>;
};

function Banner({text, translate, onClose, onPress, containerStyles, textStyles, shouldRenderHTML = false, shouldShowIcon = false, shouldShowCloseButton = false}: BannerProps) {
function Banner({text, onClose, onPress, containerStyles, textStyles, shouldRenderHTML = false, shouldShowIcon = false, shouldShowCloseButton = false}: BannerProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

return (
<Hoverable>
Expand Down Expand Up @@ -101,5 +101,4 @@ function Banner({text, translate, onClose, onPress, containerStyles, textStyles,

Banner.displayName = 'Banner';

// TODO: use `compose` function for HOCs composing once TypeScript issues are resolved.
export default memo(withLocalize(Banner));
export default memo(Banner);

0 comments on commit c4ca2d5

Please sign in to comment.