chore: App 名稱 Hey Mama → Dear Mama + 相關修復
- 品牌與顯示:app.json、Info.plist、package scheme、iOS 產物 DearMama.app - 協議與條款:隱私協議/使用條款全文、設計文檔、server legal_docs + legal API、push 預設 title - 多語言:all.json / zh-TW / zh-CN / en / es / pt 的 consent、widget 標題與引導文案 - 小工具:EmotionWidget.swift 品牌文案、Dear Mama.xcscheme - CocoaPods:project.pbxproj objectVersion 70→56 以通過 pod install - Metro:react-native-text-size 用 require + extraNodeModules 解析 - textWrap:measureWidthImpl 改為 require 載入 react-native-text-size Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,11 +20,12 @@ type TextSizeMeasureParams = {
|
||||
|
||||
type TextSizeMeasureResult = { width: number };
|
||||
|
||||
async function loadReactNativeTextSize(): Promise<{
|
||||
function loadReactNativeTextSize(): {
|
||||
measure: (params: TextSizeMeasureParams) => Promise<TextSizeMeasureResult>;
|
||||
}> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const mod: any = await import('react-native-text-size');
|
||||
} {
|
||||
// 使用 require 确保 Metro 能解析并打包该原生模块(动态 import 在某些环境下无法被正确解析)
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-explicit-any
|
||||
const mod: any = require('react-native-text-size');
|
||||
return mod?.default ?? mod;
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ function toTextSizeFontSpecs(fontSpec: FontSpec): Pick<TextSizeMeasureParams, 'f
|
||||
* - usePreciseWidth=true,取更精确的宽度(开销更大,但对本算法更稳定)
|
||||
*/
|
||||
export const defaultMeasureWidthImpl: MeasureWidthImpl = async ({ text, fontSpec }) => {
|
||||
const TextSize = await loadReactNativeTextSize();
|
||||
const TextSize = loadReactNativeTextSize();
|
||||
if (!TextSize || typeof TextSize.measure !== 'function') {
|
||||
// 典型原因:在 Expo Go 中运行,或没有使用包含该原生模块的 Development Build。
|
||||
// 这里抛出更明确的错误,方便上层捕获并在 meta.reason=MEASURE_FAILED 时看到根因。
|
||||
|
||||
Reference in New Issue
Block a user