react / react/react-native

style transform on Text component inconsistently applied on iOS

未关闭
#55,306 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Triage :mag: Platform: iOS Type: New Architecture
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

CSS transform styles applied directly to <Text> components do not work consistently on iOS. The same code works correctly on Android.

In the example snippet below:

  • Android: ✅ Text is translated as expected
  • iOS: ❌ Text is not translated
<Text style={{ transform: [{ translateY: 50 }] }}>Transformed text</Text>

Occasionally a fast refresh will correct it but that's not consistent either.

Workaround

Wrapping the <Text> in a <View> and applying the transform to the <View> works on both platforms:

<View style={{ transform: [{ translateY: 50 }] }}>
  <Text>Transformed text</Text>
</View>
Steps to reproduce
  1. Run the provided Expo Snack on an iOS device/sim
    https://snack.expo.dev/@jacob-venable-companycam/text-transform-repro
  2. Notice that the 2nd piece of text does not have the expected transform applied
React Native Version

0.81.5

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.2
  CPU: (14) arm64 Apple M4 Pro
  Memory: 501.72 MB / 48.00 GB
Binaries:
  Node:
    version: 20.19.5
    path: /.nvm/versions/node/v20.19.5/bin/node
  Yarn:
    version: 1.22.22
    path: /.nvm/versions/node/v20.19.5/bin/yarn
  npm:
    version: 10.8.2
    path: /.nvm/versions/node/v20.19.5/bin/npm
  Watchman:
    version: 2025.03.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13752376
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.5
    wanted: 0.81.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
N/A
MANDATORY Reproducer

https://snack.expo.dev/@jacob-venable-companycam/text-transform-repro

Screenshots and Videos
Actual Expected
example showing text using a transform style not having the transform applied in iOS example showing text using a transform style having the transform applied in iOS as expected

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在 iOS 设备或模拟器上运行必需的 Expo Snack 复现程序,并比较直接对 Text 应用的变换与使用 View 包裹的变通方案。调查报告中涉及的 Fabric/New Renderer 路径;完成的标准是,Text 上的直接 translateY 变换在 iOS 上能够像在 Android 上一样一致地应用。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。