Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dependency-patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

| 依赖 | 用途 |
| --- | --- |
| `expo-image-manipulator@57.0.14` | 修复 iOS HDR / 10-bit HEIC 图片在方向归一化时因原生 `CGContext` 参数不兼容而抛出 `ERR_IMAGE_CONTEXT_LOST`;正常方向直接复用原图,其余方向交给 `UIGraphicsImageRenderer`。同类问题与真机验证见 [`tloncorp/tlon-apps#5951`](https://github.com/tloncorp/tlon-apps/pull/5951),待 Expo 上游提供等价修复后移除。 |
| `expo-paste-input@0.2.2` | 优化移动端粘贴图片的处理时序,将耗时的解码、压缩和写盘移出 UI 线程,并补充加载中与失败事件。 |
| `harmonyos-sans-sc-webfont-splitted` | 移除依赖按语言全局覆盖 `font-family` 的规则,由 Cindy 自己决定界面字体。 |
| `react-native@0.85.3` | 回移 Yoga 对 `display: none` 与 `display: contents` 测量过程的布局状态修复,避免 Fabric 布局阶段因错误的 owner 关系触发断言崩溃(上游 `6fa330693fba313a2fe1121545c1efd558b60983`、`2546ce4d8219050fcd1bf432c7c830c9fd70c9af`)。移动端 iOS 通过 `expo-build-properties` 的 `buildReactNativeFromSource` 编译该补丁,不能改回预编译 RN Core。 |
Expand Down
79 changes: 79 additions & 0 deletions dependency-patches/expo-image-manipulator@57.0.14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
diff --git a/ios/Transformers/ImageFixOrientationTransformer.swift b/ios/Transformers/ImageFixOrientationTransformer.swift
index c3e3b66eb6b5b0ef75431c96bf292d4fae004606..9e9e6503a09771896936c4d823dd28e9d03b51df 100644
--- a/ios/Transformers/ImageFixOrientationTransformer.swift
+++ b/ios/Transformers/ImageFixOrientationTransformer.swift
@@ -6,70 +6,12 @@
*/
internal struct ImageFixOrientationTransformer: ImageTransformer {
func transform(image: UIImage) async throws -> UIImage {
- guard let cgImage = image.cgImage else {
- throw ImageNotFoundException()
- }
- guard var colorSpace = cgImage.colorSpace else {
- // That should never happen as `colorSpace` is empty only when the image is a mask.
- throw ImageColorSpaceNotFoundException()
- }
- if !colorSpace.supportsOutput {
- colorSpace = CGColorSpaceCreateDeviceRGB()
- }
-
- var transform = CGAffineTransform.identity
-
- switch image.imageOrientation {
- case .down, .downMirrored:
- transform = transform.translatedBy(x: image.size.width, y: image.size.height)
- transform = transform.rotated(by: Double.pi)
- case .left, .leftMirrored:
- transform = transform.translatedBy(x: image.size.width, y: 0)
- transform = transform.rotated(by: Double.pi / 2)
- case .right, .rightMirrored:
- transform = transform.translatedBy(x: 0, y: image.size.height)
- transform = transform.rotated(by: -Double.pi / 2)
- default:
- break
- }
-
- switch image.imageOrientation {
- case .upMirrored, .downMirrored:
- transform = transform.translatedBy(x: image.size.width, y: 0)
- transform = transform.scaledBy(x: -1, y: 1)
- case .leftMirrored, .rightMirrored:
- transform = transform.translatedBy(x: image.size.height, y: 0)
- transform = transform.scaledBy(x: -1, y: 1)
- default:
- break
- }
-
- let context = CGContext(
- data: nil,
- width: Int(image.size.width),
- height: Int(image.size.height),
- bitsPerComponent: cgImage.bitsPerComponent,
- bytesPerRow: 0,
- space: colorSpace,
- bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
- )
-
- guard let context = context else {
- throw ImageContextLostException()
- }
-
- context.concatenate(transform)
-
- switch image.imageOrientation {
- case .left, .leftMirrored, .right, .rightMirrored:
- context.draw(cgImage, in: CGRect(x: 0, y: 0, width: image.size.height, height: image.size.width))
- default:
- context.draw(cgImage, in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height))
+ if image.imageOrientation == .up {
+ return image
}

- guard let newCGImage = context.makeImage() else {
- throw ImageDrawingFailedException()
+ return drawInNewContext(size: image.size) { _ in
+ image.draw(in: CGRect(origin: .zero, size: image.size))
}
- return UIImage(cgImage: newCGImage)
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"react-native@0.85.3": "dependency-patches/react-native@0.85.3.patch",
"react-native-uitextview@2.2.0": "dependency-patches/react-native-uitextview@2.2.0.patch",
"react-native-webview@13.16.1": "dependency-patches/react-native-webview@13.16.1.patch",
"expo-image-manipulator@57.0.14": "dependency-patches/expo-image-manipulator@57.0.14.patch",
"expo-paste-input@0.2.2": "dependency-patches/expo-paste-input@0.2.2.patch"
},
"allowUnusedPatches": true
Expand Down
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.