Fix <Text> error

This commit is contained in:
root 2026-02-10 19:04:46 +00:00 • committed by kmmiio99o
parent c8271d19a9
commit ad663b105b
No known key found for this signature in database
GPG key ID: 1790B7202ED8484A
2 changed files with 25 additions and 22 deletions

View file

@ -4,24 +4,24 @@
"workspaces": {
"": {
"dependencies": {
"@swc/helpers": "latest",
"serve": "latest",
"@swc/helpers": "^0.5.18",
"serve": "^14.2.5",
},
"devDependencies": {
"@rollup/plugin-commonjs": "latest",
"@rollup/plugin-node-resolve": "latest",
"@swc/core": "latest",
"@types/react": "latest",
"@types/react-native": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"esbuild": "latest",
"eslint": "latest",
"eslint-plugin-react": "latest",
"rollup": "latest",
"rollup-plugin-esbuild": "latest",
"typescript": "latest",
"vendetta-types": "latest",
"@rollup/plugin-commonjs": "^29.0.0",
"@rollup/plugin-node-resolve": "^16.0.3",
"@swc/core": "^1.15.11",
"@types/react": "^19.2.10",
"@types/react-native": "^0.73.0",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"esbuild": "^0.27.2",
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.37.5",
"rollup": "^4.57.1",
"rollup-plugin-esbuild": "^6.2.1",
"typescript": "^5.9.3",
"vendetta-types": "^2.4.21",
},
},
},

View file

@ -89,7 +89,7 @@ export default function RPCPreview() {
try {
const primaryArtist = artists[0] || "Unknown Artist";
const trackInfoResponse = await fetch(
`https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${getStorage("apiKey")}&artist=${encodeURIComponent(primaryArtist)}&track=${encodeURIComponent(track.name)}&format=json&username=${getStorage("username")}`,
`https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${getStorage("apiKey")}&artist=${encodeURIComponent(primaryArtist)}&track=${encodeURIComponent(track.name)}&format=json&u[...]`
);
const trackInfo = await trackInfoResponse.json();
if (trackInfo.track && trackInfo.track.duration) {
@ -195,8 +195,11 @@ export default function RPCPreview() {
}
};
// Store getStorage calls with defaults to prevent undefined rendering
const activityType = getStorage("listeningTo") ? "Listening to" : "Playing";
const appName = getStorage("appName", "Music");
const appName = getStorage("appName") || "Music";
const showLargeText = getStorage("showLargeText", true);
const showTimestamp = getStorage("showTimestamp", false);
if (isLoading) {
return (
@ -251,13 +254,13 @@ export default function RPCPreview() {
<RN.Text style={styles.artistName} numberOfLines={1}>
{previewTrack.artist}
</RN.Text>
{getStorage("showLargeText") && previewText !== "No tooltip text" && (
{showLargeText && previewText !== "No tooltip text" && (
<RN.Text style={styles.tooltipText} numberOfLines={1}>
{previewText}
</RN.Text>
)}
{getStorage("showTimestamp") && previewTrack.duration && (
{showTimestamp && previewTrack.duration ? (
<RN.View style={styles.progressContainer}>
<RN.Text style={styles.timeText}>
{formatTime(progressData.current)}
@ -274,7 +277,7 @@ export default function RPCPreview() {
{formatTime(progressData.total)}
</RN.Text>
</RN.View>
)}
) : null}
</RN.View>
</RN.View>
</RN.View>
@ -419,4 +422,4 @@ const styles = RN.StyleSheet.create({
minWidth: 35,
textAlign: "center",
},
});
});