From 9a37ea2e1d0886aae62c8cd3b7421160b93f89e7 Mon Sep 17 00:00:00 2001 From: snehasishcodes Date: Mon, 17 Aug 2026 15:13:04 +0530 Subject: [PATCH] fix(mobile): apply Manrope font globally and fix onboarding title clipping Load all Manrope weight faces and remap font-weight utilities to the corresponding families so every Text uses Manrope on native. Also guard the onboarding title against right-edge clipping in the horizontal FlatList. --- apps/mobile/app/_layout.tsx | 18 ++++++++++++--- apps/mobile/app/onboarding.tsx | 2 +- .../[sessionId]/selective-copy.tsx | 2 +- apps/mobile/components/memo-markdown.tsx | 20 +++++++++++++++- apps/mobile/components/ui/input.tsx | 2 +- apps/mobile/components/ui/text.tsx | 2 +- apps/mobile/components/ui/textarea.tsx | 2 +- apps/mobile/tailwind.config.js | 23 +++++++++++++++++-- 8 files changed, 60 insertions(+), 11 deletions(-) diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index 6085b7a..8d423e1 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -2,8 +2,14 @@ import "../global.css" import { PortalHost } from "@rn-primitives/portal" import { ThemeProvider } from "@react-navigation/native" -import { useFonts } from "@expo-google-fonts/manrope" -import { Manrope_400Regular } from "@expo-google-fonts/manrope" +import { + Manrope_400Regular, + Manrope_500Medium, + Manrope_600SemiBold, + Manrope_700Bold, + Manrope_800ExtraBold, + useFonts, +} from "@expo-google-fonts/manrope" import { Stack, useRouter, useSegments } from "expo-router" import { StatusBar } from "expo-status-bar" import { useColorScheme } from "nativewind" @@ -22,7 +28,13 @@ export default function RootLayout() { const segments = useSegments() const { colorScheme } = useColorScheme() const theme = colorScheme ?? "dark" - const [fontsLoaded] = useFonts({ Manrope: Manrope_400Regular }) + const [fontsLoaded] = useFonts({ + Manrope_400Regular, + Manrope_500Medium, + Manrope_600SemiBold, + Manrope_700Bold, + Manrope_800ExtraBold, + }) const hasCompletedOnboarding = useSettings((state) => state.hasCompletedOnboarding) const [settingsHydrated, setSettingsHydrated] = React.useState(useSettings.persist.hasHydrated()) useNotificationRouting() diff --git a/apps/mobile/app/onboarding.tsx b/apps/mobile/app/onboarding.tsx index 65cfb67..c390a2f 100644 --- a/apps/mobile/app/onboarding.tsx +++ b/apps/mobile/app/onboarding.tsx @@ -130,7 +130,7 @@ export default function OnboardingScreen() { )} - {item.title} + {item.title} {item.description} diff --git a/apps/mobile/app/project/[projectId]/[sessionId]/selective-copy.tsx b/apps/mobile/app/project/[projectId]/[sessionId]/selective-copy.tsx index d091f3f..54132ef 100644 --- a/apps/mobile/app/project/[projectId]/[sessionId]/selective-copy.tsx +++ b/apps/mobile/app/project/[projectId]/[sessionId]/selective-copy.tsx @@ -136,7 +136,7 @@ export default function SelectiveCopyScreen() { style={{ color: t.foreground, textAlignVertical: "top", - fontFamily: "Manrope", + fontFamily: "Manrope_400Regular", }} value={text} onChangeText={handleChangeText} diff --git a/apps/mobile/components/memo-markdown.tsx b/apps/mobile/components/memo-markdown.tsx index c6944d2..12a5812 100644 --- a/apps/mobile/components/memo-markdown.tsx +++ b/apps/mobile/components/memo-markdown.tsx @@ -1,8 +1,25 @@ import { memo, useEffect, useRef, useState } from "react" import { type ReactNode, Fragment } from "react" import Markdown from "react-native-marked" +import type { MarkedStyles } from "react-native-marked" import { Text, View, type TextStyle, type ViewStyle, type ImageStyle } from "react-native" +const manropeStyles: MarkedStyles = { + text: { fontFamily: "Manrope_400Regular" }, + em: { fontFamily: "Manrope_400Regular" }, + strong: { fontFamily: "Manrope_700Bold" }, + strikethrough: { fontFamily: "Manrope_400Regular" }, + link: { fontFamily: "Manrope_400Regular" }, + h1: { fontFamily: "Manrope_700Bold" }, + h2: { fontFamily: "Manrope_700Bold" }, + h3: { fontFamily: "Manrope_600SemiBold" }, + h4: { fontFamily: "Manrope_600SemiBold" }, + h5: { fontFamily: "Manrope_600SemiBold" }, + h6: { fontFamily: "Manrope_600SemiBold" }, + codespan: { fontFamily: "Manrope_400Regular" }, + li: { fontFamily: "Manrope_400Regular" }, +} + function keyedChildren(children: ReactNode[]): ReactNode { if (!Array.isArray(children)) return children return children.map((child, i) => {child}) @@ -86,13 +103,14 @@ function MarkdownRendererInner({ children, streaming }: { children: string; stre }, [children, streaming]) if (streaming && parsed !== children) { - return {children} + return {children} } return ( & return ( { + addUtilities({ + '.font-thin': { fontFamily: 'Manrope_200ExtraLight' }, + '.font-extralight': { fontFamily: 'Manrope_200ExtraLight' }, + '.font-light': { fontFamily: 'Manrope_300Light' }, + '.font-normal': { fontFamily: 'Manrope_400Regular' }, + '.font-medium': { fontFamily: 'Manrope_500Medium' }, + '.font-semibold': { fontFamily: 'Manrope_600SemiBold' }, + '.font-bold': { fontFamily: 'Manrope_700Bold' }, + '.font-extrabold': { fontFamily: 'Manrope_800ExtraBold' }, + '.font-black': { fontFamily: 'Manrope_800ExtraBold' }, + }) + }), + ], }