perf(MobilePageNavigationBar): improve style performance

This commit is contained in:
Zeke Zhang 2024-10-30 15:57:05 +08:00
parent d94fdb65c0
commit d77e3f6798
2 changed files with 27 additions and 26 deletions

View File

@ -7,27 +7,25 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import React, { FC } from 'react';
import { NavBar } from 'antd-mobile';
import { RecursionField, useFieldSchema } from '@formily/react';
import { cx, SchemaToolbarProvider } from '@nocobase/client';
import { NavBar } from 'antd-mobile';
import React, { FC } from 'react';
import { useMobilePage } from '../../context';
import { useMobileTitle } from '../../../../mobile-providers';
import { useMobilePage } from '../../context';
import { useStyles } from './styles';
export const MobilePageNavigationBar: FC = () => {
const { title } = useMobileTitle();
const { displayNavigationBar = true, displayPageTitle = true } = useMobilePage();
const fieldSchema = useFieldSchema();
const { styles } = useStyles();
const { componentCls, hashId } = useStyles();
if (!displayNavigationBar) return null;
return (
<div
className={cx('mobile-page-navigation-bar', styles.mobilePageNavigationBar)}
data-testid="mobile-page-navigation-bar"
>
<div className={cx('mobile-page-navigation-bar', componentCls, hashId)} data-testid="mobile-page-navigation-bar">
<NavBar
backArrow={false}
back={null}

View File

@ -7,10 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { createStyles } from 'antd-style';
import { genStyleHook } from '@nocobase/client';
export const useStyles = createStyles(() => ({
mobilePageNavigationBar: {
export const useStyles = genStyleHook('nb-mobile-page-navigation-bar', (token) => {
const { componentCls } = token;
return {
[componentCls]: {
'.adm-nav-bar': {
maxWidth: '100%',
height: 49,
@ -28,4 +30,5 @@ export const useStyles = createStyles(() => ({
},
},
},
}));
};
});