Skip to content

WIP: Change font for all Text to Fraunces#33

Open
bcye wants to merge 1 commit intomainfrom
feature/font-fraunces
Open

WIP: Change font for all Text to Fraunces#33
bcye wants to merge 1 commit intomainfrom
feature/font-fraunces

Conversation

@bcye
Copy link
Owner

@bcye bcye commented May 17, 2025

@coderabbitai pause

Summary by CodeRabbit

  • New Features
    • Added support for the Fraunces font family, including multiple weights and italic variants, throughout the app.
    • Introduced global theme initialization to ensure all text components use the Fraunces font for a consistent appearance.
  • Chores
    • Updated and added necessary font-related dependencies for improved font management.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 17, 2025

Walkthrough

The changes introduce support for the Fraunces font family by updating the app configuration, installing the required font package, and initializing a global theme to apply the font to all Text components. A new theme initialization function is added and invoked at the app layout level. No existing code entities are modified or removed.

Changes

File(s) Change Summary
app/app.json Added "expo-font" plugin configuration with explicit Fraunces font files from "@expo-google-fonts/fraunces".
app/package.json Added "@expo-google-fonts/fraunces" dependency and updated "expo-font" version.
app/utils/theme.ts Added import of ThemeManager and exported function initialiseTheme to set global Text font to Fraunces.
app/app/_layout.tsx Imported and invoked initialiseTheme after splash screen prevention to set up the theme globally.

Sequence Diagram(s)

sequenceDiagram
    participant AppLayout
    participant ThemeUtils
    participant ThemeManager

    AppLayout->>ThemeUtils: import initialiseTheme
    AppLayout->>ThemeUtils: call initialiseTheme()
    ThemeUtils->>ThemeManager: configure Text component (fontFamily: "Fraunces")
Loading

Poem

In the garden of code, new fonts take their place,
Fraunces arrives with elegant grace.
The theme is set, the text refined,
A stylish hop for every line.
With every update, the app feels new—
A rabbit’s thanks for all you do!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
app/app/_layout.tsx (1)

13-14: Consider adding font loading verification.

The theme initialization is correctly placed early in the app lifecycle. However, there's no verification that the Fraunces font has loaded successfully before applying it.

Consider using the useFonts hook from expo-font to ensure fonts are loaded:

+import { useFonts, Fraunces_400Regular /* import other weights as needed */ } from '@expo-google-fonts/fraunces';

preventAutoHideAsync();
initialiseTheme();

export default function Layout() {
+  const [fontsLoaded] = useFonts({
+    Fraunces: Fraunces_400Regular,
+    // Add other weights if needed
+  });
+
+  const onLayoutRootView = useCallback(async () => {
+    if (fontsLoaded) {
+      await hide();
+    }
+  }, [fontsLoaded]);
+
+  if (!fontsLoaded) {
+    return null;
+  }

  const [privacyConsent, setPrivacyConsent] = useState<boolean | null>(null);
  // Rest of the component
app/utils/theme.ts (1)

5-9: Properly implemented theme function with potential improvements.

The initialiseTheme function correctly sets Fraunces as the font family for all Text components while preserving existing styles.

Consider these improvements:

  1. Add a more specific TypeScript type for props instead of any
  2. Include a fallback font family in case Fraunces fails to load
-export function initialiseTheme() {
-  ThemeManager.setComponentTheme("Text", (props: any) => ({
-    style: [{ fontFamily: "Fraunces" }, props.style],
-  }));
+export function initialiseTheme() {
+  ThemeManager.setComponentTheme("Text", (props: TextProps) => ({
+    style: [{ fontFamily: "Fraunces, serif" }, props.style],
+  }));
}

Don't forget to add the import:

import { TextProps } from "react-native";
app/app.json (1)

52-76: Complete font configuration with optimization opportunity.

The Fraunces font is correctly configured with all weights and styles in the Expo font plugin. This is comprehensive but could potentially increase app bundle size.

Consider limiting the included font weights to only those you'll actually use in the app to reduce bundle size. For example, if you only need regular, medium, and bold weights:

"fonts": [
-  "node_modules/@expo-google-fonts/fraunces/100Thin/Fraunces_100Thin.ttf",
-  "node_modules/@expo-google-fonts/fraunces/100Thin_Italic/Fraunces_100Thin_Italic.ttf",
-  "node_modules/@expo-google-fonts/fraunces/200ExtraLight/Fraunces_200ExtraLight.ttf",
-  "node_modules/@expo-google-fonts/fraunces/200ExtraLight_Italic/Fraunces_200ExtraLight_Italic.ttf",
-  "node_modules/@expo-google-fonts/fraunces/300Light/Fraunces_300Light.ttf",
-  "node_modules/@expo-google-fonts/fraunces/300Light_Italic/Fraunces_300Light_Italic.ttf",
   "node_modules/@expo-google-fonts/fraunces/400Regular/Fraunces_400Regular.ttf",
-  "node_modules/@expo-google-fonts/fraunces/400Regular_Italic/Fraunces_400Regular_Italic.ttf",
   "node_modules/@expo-google-fonts/fraunces/500Medium/Fraunces_500Medium.ttf",
-  "node_modules/@expo-google-fonts/fraunces/500Medium_Italic/Fraunces_500Medium_Italic.ttf",
-  "node_modules/@expo-google-fonts/fraunces/600SemiBold/Fraunces_600SemiBold.ttf",
-  "node_modules/@expo-google-fonts/fraunces/600SemiBold_Italic/Fraunces_600SemiBold_Italic.ttf",
   "node_modules/@expo-google-fonts/fraunces/700Bold/Fraunces_700Bold.ttf",
-  "node_modules/@expo-google-fonts/fraunces/700Bold_Italic/Fraunces_700Bold_Italic.ttf",
-  "node_modules/@expo-google-fonts/fraunces/800ExtraBold/Fraunces_800ExtraBold.ttf",
-  "node_modules/@expo-google-fonts/fraunces/800ExtraBold_Italic/Fraunces_800ExtraBold_Italic.ttf",
-  "node_modules/@expo-google-fonts/fraunces/900Black/Fraunces_900Black.ttf",
-  "node_modules/@expo-google-fonts/fraunces/900Black_Italic/Fraunces_900Black_Italic.ttf"
]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3393a08 and ea5ee24.

⛔ Files ignored due to path filters (1)
  • app/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • app/app.json (1 hunks)
  • app/app/_layout.tsx (1 hunks)
  • app/package.json (2 hunks)
  • app/utils/theme.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
app/app/_layout.tsx (1)
app/utils/theme.ts (1)
  • initialiseTheme (5-9)
🔇 Additional comments (4)
app/package.json (2)

28-28: New dependency added correctly.

The @expo-google-fonts/fraunces package is correctly added as a dependency, which is necessary for using the Fraunces font family in the application.


42-42: Appropriate version update for expo-font.

Updating expo-font to version ~13.0.4 ensures compatibility with the new font integration.

app/app/_layout.tsx (1)

4-4: Proper imports for theme management.

The imports for ThemeManager and initialiseTheme are correctly added to support the font changes.

Also applies to: 7-7

app/utils/theme.ts (1)

1-2: Appropriate ThemeManager import.

The ThemeManager import is correctly added to support setting global component themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant