fix: 안드로이드 앱에서 한글이 단어 중간에서 줄바꿈되던 것 (띄어쓰기에서만 줄이 바뀌게)
This commit is contained in:
1 parent
64ca463591
commit
fbebdcb796
21 files changed
+58
-20
No files matched your search
@@ -3,7 +3,8 @@ import { ArticleCategory, IndexCategory } from '@nalssigak/shared/api/client/typ
|
||||
import { kst, loadOf, seasonOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
|
||||
import { Pressable, RefreshControl, ScrollView, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { GakGrid, GridSkel } from '@/components/gak/grid';
|
||||
import { Podium, PodiumSkel } from '@/components/gak/podium';
|
||||
|
||||
@@ -2,7 +2,8 @@ import { getWeekOptions, getWeekRankingOptions, listEventsOptions, listPlacesOpt
|
||||
import { loadOf, shortDay } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
|
||||
import { Pressable, RefreshControl, ScrollView, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { DayStrip, EventRow, PickCard, PlaceCard, RankRow } from '@/components/week/sections';
|
||||
import { DaysSkel, EventsSkel, PickSkel, PlacesSkel, RankSkel } from '@/components/week/skels';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { TimeKind } from '@nalssigak/shared/lib';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withSequence, withTiming } from 'react-native-reanimated';
|
||||
|
||||
import { Ic } from '@/components/ui';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { IndexSummary } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Ic, Skel } from '@/components/ui';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { IndexSummary } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { MEDALS } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Ic, Skel } from '@/components/ui';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
|
||||
@@ -3,7 +3,8 @@ import { PostType, type PostData, type ResFeed } from '@nalssigak/shared/api/cli
|
||||
import { useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Animated, Pressable, Text, View } from 'react-native';
|
||||
import { Animated, Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Path } from 'react-native-svg';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ import { deg } from '@nalssigak/shared/lib/weatherText';
|
||||
import { Image } from 'expo-image';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
||||
import { Pressable, StyleSheet, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Polygon } from 'react-native-svg';
|
||||
|
||||
import { Credit, Ic, Rows, Thumb } from '@/components/ui';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { ArticleSummary, ResSeasonWeek } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { ARTICLE_LABEL, cardBg, dateRange, shortDay } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Fall } from '@/components/fall';
|
||||
import { Credit, Ic, Skel, Thumb } from '@/components/ui';
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ARTICLE_LABEL, articleMeta, cardBg, dateRange, loadOf, shortDay } from
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useEffect } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Credit, Ic, StateBox, Thumb } from '@/components/ui';
|
||||
import { CARD_BG } from '@/lib/colors';
|
||||
|
||||
@@ -4,7 +4,8 @@ import { loadOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useEffect } from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Circle, Line, Polygon, Text as SvgText, TSpan } from 'react-native-svg';
|
||||
|
||||
import { Ic, Skel, StateBox } from '@/components/ui';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { subscribeAuth } from '@nalssigak/shared/api/auth';
|
||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react';
|
||||
import { KeyboardAvoidingView, Modal, Pressable, Text, View } from 'react-native';
|
||||
import { KeyboardAvoidingView, Modal, Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode, Ref } from 'react';
|
||||
import { ScrollView, Text, TextInput, View, type TextInputProps } from 'react-native';
|
||||
import { ScrollView, TextInput, View, type TextInputProps } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Path } from 'react-native-svg';
|
||||
|
||||
import { Skel } from '@/components/ui';
|
||||
|
||||
@@ -2,7 +2,8 @@ import { listRegionsOptions } from '@nalssigak/shared/api/client/@tanstack/react
|
||||
import { loadOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useDeferredValue, useEffect, useRef, useState } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Skel, StateBox } from '@/components/ui';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
|
||||
@@ -2,7 +2,8 @@ import type { BestTime, SkyPlanData } from '@nalssigak/shared/api/client/types.g
|
||||
import { clockShort } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
import { RAIL, skyOf } from '@/components/sky/colors';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { BottomTabBarProps } from 'expo-router/tabs';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Children, type ReactNode } from 'react';
|
||||
import { Platform, Text as RNText, type TextProps } from 'react-native';
|
||||
|
||||
const WORD_JOINER = '\u2060';
|
||||
const HANGUL = /[\uAC00-\uD7A3]/;
|
||||
|
||||
/** 안드로이드는 한글을 글자마다 끊어서, 단어 안쪽에 줄바꿈 금지 문자를 넣어 띄어쓰기에서만 줄이 바뀌게 한다 */
|
||||
function keepWords(s: string): string {
|
||||
return HANGUL.test(s) ? s.replace(/\S+/g, (w) => Array.from(w).join(WORD_JOINER)) : s;
|
||||
}
|
||||
|
||||
function wrap(children: ReactNode): ReactNode {
|
||||
return Children.map(children, (c) => (typeof c === 'string' ? keepWords(c) : c));
|
||||
}
|
||||
|
||||
export function Text({ children, ...props }: TextProps) {
|
||||
return <RNText {...props}>{Platform.OS === 'android' ? wrap(children) : children}</RNText>;
|
||||
}
|
||||
@@ -3,7 +3,8 @@ import { kindOfHour, kst, type Load, type TimeKind, WEEKDAYS } from '@nalssigak/
|
||||
import { KINDS, moonPath, PREVIEW, SLOT_KEY, WANING, type Weather, WEATHER_ICON, weatherOf } from '@nalssigak/shared/lib/today';
|
||||
import { deg, slotAt } from '@nalssigak/shared/lib/weatherText';
|
||||
import { useEffect, useState, type ReactNode } from 'react';
|
||||
import { Pressable, Text, View, type DimensionValue, type ViewStyle } from 'react-native';
|
||||
import { Pressable, View, type DimensionValue, type ViewStyle } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withRepeat, withTiming } from 'react-native-reanimated';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import Svg, { Defs, Path, RadialGradient, Rect, Stop } from 'react-native-svg';
|
||||
|
||||
@@ -3,7 +3,8 @@ import { cardBg, MEDALS } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Link, type Href } from 'expo-router';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Ic, Rail, Sec, Skel, Thumb } from '@/components/ui';
|
||||
import { CARD_BG, BAND_BG } from '@/lib/colors';
|
||||
|
||||
@@ -3,7 +3,8 @@ import { kst, seasonOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { usePathname } from 'expo-router';
|
||||
import { useState } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Link, type Href } from 'expo-router';
|
||||
import { useEffect, useState, type ReactNode } from 'react';
|
||||
import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
||||
import { Linking, Pressable, ScrollView, Text, View, type StyleProp, type ViewStyle } from 'react-native';
|
||||
import { Linking, Pressable, ScrollView, View, type StyleProp, type ViewStyle } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { ICONS } from '@/lib/icons';
|
||||
import { imageUri } from '@/lib/site';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { EventData, PlaceData, WeekRankItem, DayData } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { cardBg, dateRange } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Pressable, ScrollView, Text, View } from 'react-native';
|
||||
import { Pressable, ScrollView, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Credit, Ic, MapLink, Thumb } from '@/components/ui';
|
||||
import { CARD_BG } from '@/lib/colors';
|
||||
|
||||
Reference in new issue
Block a user