Skip to content

Commit b6f497d

Browse files
author
Julius Marminge
committed
refactor(mobile): remove superseded native zoom target
1 parent eb44817 commit b6f497d

6 files changed

Lines changed: 9 additions & 110 deletions

File tree

‎apps/mobile/modules/t3-native-controls/ios/T3NativeControls.podspec‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Pod::Spec.new do |s|
1212
s.static_framework = true
1313

1414
s.dependency 'ExpoModulesCore'
15-
s.dependency 'RNScreens'
1615
s.pod_target_xcconfig = {
1716
'DEFINES_MODULE' => 'YES',
1817
}

‎apps/mobile/modules/t3-native-controls/ios/T3NativeControlsModule.swift‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ public final class T3NativeControlsModule: Module {
3636
}
3737
}
3838

39-
View(T3ZoomTransitionView.self) {
40-
ViewName("ZoomTransitionTarget")
41-
Prop("sourceIdentifier") { (view: T3ZoomTransitionView, identifier: String) in
42-
view.sources = self.presentationSources
43-
view.sourceIdentifier = identifier
44-
}
45-
Prop("colorScheme") { (view: T3ZoomTransitionView, colorScheme: String?) in
46-
view.colorScheme = colorScheme
47-
}
48-
OnViewDidUpdateProps { (view: T3ZoomTransitionView) in
49-
view.updateTransition()
50-
}
51-
}
52-
5339
AsyncFunction("shareFileFromSource") { (url: URL, title: String, identifier: String, promise: Promise) in
5440
try self.shareFile(url: url, title: title, sourceIdentifier: identifier, promise: promise)
5541
}.runOnQueue(.main)

‎apps/mobile/modules/t3-native-controls/ios/T3NativePresentation.swift‎

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ExpoModulesCore
2-
import RNScreens
32
import UIKit
43

54
final class T3PresentationSources {
@@ -24,21 +23,6 @@ final class T3PresentationSources {
2423
// Use the child bounds, not the wrapper's potentially stretched layout bounds.
2524
entries[identifier]?.view?.subviews.first
2625
}
27-
28-
func configureZoom(
29-
for controller: UIViewController,
30-
sourceIdentifier: String,
31-
alignmentRect: @escaping (UIViewController) -> CGRect? = { _ in nil }
32-
) {
33-
guard #available(iOS 18.0, *), !UIAccessibility.isReduceMotionEnabled,
34-
!sourceIdentifier.isEmpty
35-
else { return }
36-
let options = UIViewController.Transition.ZoomOptions()
37-
options.alignmentRectProvider = { context in alignmentRect(context.zoomedViewController) }
38-
controller.preferredTransition = .zoom(options: options) { [weak self] _ in
39-
self?.view(for: sourceIdentifier)
40-
}
41-
}
4226
}
4327

4428
final class T3PresentationSourceView: ExpoView {
@@ -55,45 +39,6 @@ final class T3PresentationSourceView: ExpoView {
5539
}
5640
}
5741

58-
final class T3ZoomTransitionView: ExpoView {
59-
weak var sources: T3PresentationSources?
60-
var sourceIdentifier = ""
61-
var colorScheme: String? {
62-
didSet {
63-
overrideUserInterfaceStyle = colorScheme == "dark" ? .dark
64-
: colorScheme == "light" ? .light : .unspecified
65-
}
66-
}
67-
68-
override func didMoveToSuperview() {
69-
super.didMoveToSuperview()
70-
updateTransition()
71-
}
72-
73-
func updateTransition() {
74-
guard superview != nil else { return }
75-
// The native stack attaches its screen controller after mounting the children.
76-
DispatchQueue.main.async { [weak self] in self?.configureTransition() }
77-
}
78-
79-
private func configureTransition() {
80-
var responder: UIResponder? = self
81-
while let current = responder {
82-
if let screen = current as? RNSScreen {
83-
// RNS wraps a modal with a visible native header in an inner stack.
84-
// UIKit presents the outer screen, so it owns the zoom and dismissal.
85-
let destination = screen.navigationController?.parent as? RNSScreen ?? screen
86-
sources?.configureZoom(for: destination, sourceIdentifier: sourceIdentifier) { [weak self] controller in
87-
guard let self else { return nil }
88-
return self.convert(self.bounds, to: controller.view)
89-
}
90-
return
91-
}
92-
responder = current.next
93-
}
94-
}
95-
}
96-
9742
func presentFileShare(
9843
url: URL,
9944
title: String,
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { requireNativeView } from "expo";
22
import type { ComponentType } from "react";
3-
import type { PresentationSourceProps, ZoomTransitionTargetProps } from "./NativePresentation";
3+
import type { PresentationSourceProps } from "./NativePresentation";
44

55
const NativeSource: ComponentType<PresentationSourceProps> = requireNativeView(
66
"T3NativeControls",
@@ -10,8 +10,3 @@ const NativeSource: ComponentType<PresentationSourceProps> = requireNativeView(
1010
export function PresentationSource(props: PresentationSourceProps) {
1111
return <NativeSource {...props} collapsableChildren={false} />;
1212
}
13-
14-
export const ZoomTransitionTarget: ComponentType<ZoomTransitionTargetProps> = requireNativeView(
15-
"T3NativeControls",
16-
"ZoomTransitionTarget",
17-
);

‎apps/mobile/src/components/NativePresentation.tsx‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,7 @@ export interface PresentationSourceProps extends ViewProps {
77
readonly identifier: string;
88
}
99

10-
export interface ZoomTransitionTargetProps extends ViewProps {
11-
readonly sourceIdentifier?: string;
12-
readonly colorScheme?: "light" | "dark";
13-
}
14-
1510
/** Registers the view as an iOS zoom or share-sheet origin. */
1611
export function PresentationSource({ identifier: _identifier, ...props }: PresentationSourceProps) {
1712
return <View {...props} />;
1813
}
19-
20-
/** Place inside a native-stack screen, around the content to align with the source. */
21-
export function ZoomTransitionTarget({
22-
sourceIdentifier: _sourceIdentifier,
23-
colorScheme: _colorScheme,
24-
...props
25-
}: ZoomTransitionTargetProps) {
26-
return <View {...props} />;
27-
}

‎docs/internals/mobile-navigation.md‎

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,13 @@ use a separate implementation and do not need this workaround.
5151

5252
## Native media presentations
5353

54-
`PresentationSource` and `ZoomTransitionTarget` in `NativePresentation` connect a
55-
view to an iOS native-stack destination using UIKit's zoom transition. Wrap the
56-
thumbnail as the source's single child, pass its stable identifier in the route params, and wrap
57-
the destination content in a target with that `sourceIdentifier`. The target's
58-
bounds define the zoom alignment. These components do not load files or own
59-
playback, so image viewers can use the same API.
60-
61-
The native module keeps weak references to source views and resolves the source
62-
again on dismissal. Recycled or compact composer thumbnails can register the
63-
same identifier. Identifiers must distinguish simultaneously visible attachments.
64-
Reduce Motion keeps the route's normal transition. Android wrappers use regular
65-
views and do not register a native transition.
54+
`PresentationSource` in `NativePresentation` registers a thumbnail for AVKit's
55+
full-screen entry and UIKit's share sheet. Wrap the thumbnail as its single child
56+
and pass the stable identifier to the presentation. The registry keeps weak
57+
references to source views; recycled or compact composer thumbnails can register
58+
the same identifier. Identifiers must distinguish simultaneously visible attachments.
59+
This source registration does not own playback and can be reused by a future image
60+
viewer. Android uses a regular view.
6661

6762
On iOS, video previews mount `AVPlayerViewController` temporarily inside the
6863
registered source and enter full screen through AVKit. AVKit
@@ -72,9 +67,7 @@ simulator, that leaves native Close unable to exit full screen. When the source
7267
the player uses a standard modal presentation. Programmatic entry uses the same
7368
guarded `enterFullScreenAnimated:completionHandler:` selector as Expo Video;
7469
if that selector is unavailable, the player also falls back to a standard modal.
75-
Future image viewers can use the
76-
same source registry with `configureZoom` or the native-stack target. Images
77-
retain their existing viewer.
70+
Images retain their existing viewer.
7871

7972
Received videos open directly from their signed asset URL. AVKit handles buffering;
8073
the client does not download the entire file or show a separate opening overlay before
@@ -90,11 +83,6 @@ if no other component changed it during playback. It does not deactivate the
9083
shared session, which may still serve another player or recorder. Android retains
9184
its React Native modal and Expo Video player.
9285

93-
Use React Native's `StatusBar` API for app-owned status-bar changes. Expo's base
94-
Info.plist prebuild mod sets `UIViewControllerBasedStatusBarAppearance` to `false`,
95-
even though `app.config.ts` does not override the key. With that generated setting,
96-
native-stack `statusBarStyle` options raise an error.
97-
9886
`shareFileFromSource` uses the same source registration to anchor UIKit's activity
9987
controller. Its promise completes when the native share flow finishes, keeping
10088
the existing attachment lease and foreground handoff active for that duration.

0 commit comments

Comments
 (0)