chore: fix rtl cannot revert in Safari (#37052)

close #37035
This commit is contained in:
afc163 2022-08-15 15:25:18 +08:00 committed by GitHub
parent cbb8b28430
commit 4a826bb25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,8 @@
}
html {
direction: initial;
&.rtl {
direction: rtl;
}

View File

@ -13,7 +13,6 @@ import './Navigation.less';
export interface NavigationProps extends SharedProps {
isMobile: boolean;
isRTL: boolean;
pathname: string;
responsive: null | 'narrow' | 'crowded';
location: { pathname: string; query: any };

View File

@ -186,7 +186,7 @@ const Header: React.FC<HeaderProps & WrappedComponentProps<'intl'>> = props => {
);
}, [location]);
const getNextDirectionText = useMemo<string>(
const nextDirectionText = useMemo<string>(
() => (direction !== 'rtl' ? 'RTL' : 'LTR'),
[direction],
);
@ -242,7 +242,7 @@ const Header: React.FC<HeaderProps & WrappedComponentProps<'intl'>> = props => {
isMobile={isMobile}
showTechUIButton={showTechUIButton}
pathname={pathname}
directionText={getNextDirectionText}
directionText={nextDirectionText}
onLangChange={onLangChange}
onDirectionChange={onDirectionChange}
/>
@ -275,7 +275,7 @@ const Header: React.FC<HeaderProps & WrappedComponentProps<'intl'>> = props => {
className="header-button header-direction-button"
key="direction-button"
>
{getNextDirectionText}
{nextDirectionText}
</Button>,
<More key="more" {...sharedProps} />,
<Github key="github" responsive={responsive} />,

View File

@ -226,6 +226,7 @@ export default class Layout extends React.Component<LayoutPropsType, LayoutState
appLocale.locale === 'zh-CN'
? '基于 Ant Design 设计体系的 React UI 组件库,用于研发企业级中后台产品。'
: 'An enterprise-class UI design language and React UI library with a set of high-quality React components, one of best React UI library for enterprises';
return (
// eslint-disable-next-line react/jsx-no-constructed-context-values
<SiteContext.Provider value={{ isMobile, direction, theme, setTheme, setIframeTheme }}>