Skip to content

Commit

Permalink
Merge pull request #104 from 282931/fix#103
Browse files Browse the repository at this point in the history
fix #103: 修复TabBar中route为空会导致app奔溃问题
  • Loading branch information
maotoumao authored Oct 27, 2023
2 parents f3c3844 + 6b95fa8 commit f306e36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/recommendSheets/components/body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import PluginManager from '@/core/pluginManager';
import {fontWeightConst} from '@/constants/uiConst';
import SheetBody from './sheetBody';
import useColors from '@/hooks/useColors';
import Empty from '@/components/base/empty';

export default function Body() {
const [index, setIndex] = useState(0);
Expand Down Expand Up @@ -53,6 +54,9 @@ export default function Body() {
/>
);

if (!routes?.length) {
return <Empty />;
}
return (
<TabView
lazy
Expand Down
4 changes: 4 additions & 0 deletions src/pages/topList/components/topListBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TabBar, TabView} from 'react-native-tab-view';
import {fontWeightConst} from '@/constants/uiConst';
import BoardPanelWrapper from './boardPanelWrapper';
import useColors from '@/hooks/useColors';
import Empty from '@/components/base/empty';

export default function TopListBody() {
const routes = PluginManager.getSortedTopListsablePlugins().map(_ => ({
Expand All @@ -21,6 +22,9 @@ export default function TopListBody() {
),
[],
);
if (!routes?.length) {
return <Empty />;
}

return (
<TabView
Expand Down

0 comments on commit f306e36

Please sign in to comment.