Skip to content

Commit

Permalink
fix: enhance DormScoreScreen with theme support (#649)
Browse files Browse the repository at this point in the history
* feat: enhance DormScoreScreen with theme support and loading indicator

* fix: revert some changes
  • Loading branch information
SunnyCloudYang authored Nov 4, 2024
1 parent d57567a commit 169161d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/thu-info-app/src/ui/home/dormScore.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {View} from "react-native";
import {View, useColorScheme} from "react-native";
import {useEffect, useState} from "react";
import {NetworkRetry} from "../../components/easySnackbars";
import {getStr} from "../../utils/i18n";
Expand All @@ -8,10 +8,13 @@ import {saveRemoteImg} from "../../utils/saveImg";
import {DormAuthError} from "@thu-info/lib/src/utils/error";
import {RootNav} from "../../components/Root";
import {useSelector} from "react-redux";
import themes from "../../assets/themes/themes";

export const DormScoreScreen = ({navigation}: {navigation: RootNav}) => {
const [base64, setBase64] = useState<string>();
const dormPassword = useSelector((s: State) => s.credentials.dormPassword);
const themeName = useColorScheme();
const {colors} = themes(themeName);
useEffect(() => {
helper
.getDormScore(dormPassword)
Expand All @@ -29,7 +32,8 @@ export const DormScoreScreen = ({navigation}: {navigation: RootNav}) => {
<View style={{flex: 1}}>
{base64 && (
<ImageViewer
imageUrls={[{url: `data:image/png;base64,${base64}`}]}
imageUrls={[{ url: `data:image/png;base64,${base64}` }]}
backgroundColor={colors.themeBackground}
onSave={saveRemoteImg}
renderIndicator={() => <View />}
menuContext={{
Expand Down

0 comments on commit 169161d

Please sign in to comment.