Skip to content

Commit 83316ca

Browse files
committed
Revert "Get rid of view controller hierarchy warning that causes UI glitch in some cases"
This reverts commit 9bc7670. # Conflicts: # ios/ReactNativeDeviceActivityView.swift
1 parent f44b7b9 commit 83316ca

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

ios/ReactNativeDeviceActivityView.swift

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,7 @@ class ReactNativeDeviceActivityView: ExpoView {
2626

2727
clipsToBounds = true
2828

29-
// Configure the hosting controller
30-
contentView.view.backgroundColor = .clear
31-
contentView.view.translatesAutoresizingMaskIntoConstraints = false
32-
33-
// Add the view directly
34-
addSubview(contentView.view)
35-
36-
// Setup constraints
37-
NSLayoutConstraint.activate([
38-
contentView.view.topAnchor.constraint(equalTo: topAnchor),
39-
contentView.view.leadingAnchor.constraint(equalTo: leadingAnchor),
40-
contentView.view.trailingAnchor.constraint(equalTo: trailingAnchor),
41-
contentView.view.bottomAnchor.constraint(equalTo: bottomAnchor)
42-
])
43-
44-
// Find root view controller and add content view controller as child
45-
if let rootViewController = UIApplication.shared.windows.first?.rootViewController {
46-
rootViewController.addChild(contentView)
47-
contentView.didMove(toParent: rootViewController)
48-
}
29+
self.addSubview(contentView.view)
4930

5031
model.$activitySelection.debounce(for: .seconds(0.1), scheduler: RunLoop.main).sink {
5132
selection in
@@ -57,6 +38,10 @@ class ReactNativeDeviceActivityView: ExpoView {
5738
.store(in: &cancellables)
5839
}
5940

41+
override func layoutSubviews() {
42+
contentView.view.frame = bounds
43+
}
44+
6045
let onSelectionChange = EventDispatcher()
6146

6247
var previousSelection: FamilyActivitySelection?

ios/ScreenTimeActivityPicker.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ struct ScreenTimeSelectAppsContentView: View {
3737
if #available(iOS 16.0, *) {
3838
InnerView()
3939
.onTapGesture {
40-
Task { @MainActor in
41-
try? await AuthorizationCenter.shared.requestAuthorization(for: .individual)
42-
pickerIsPresented = true
43-
}
40+
pickerIsPresented = true
4441
}
4542
.familyActivityPicker(
4643
headerText: $model.headerText.wrappedValue,
@@ -51,12 +48,7 @@ struct ScreenTimeSelectAppsContentView: View {
5148
} else {
5249
InnerView()
5350
.onTapGesture {
54-
Task { @MainActor in
55-
if #available(iOS 16.0, *) {
56-
try? await AuthorizationCenter.shared.requestAuthorization(for: .individual)
57-
}
58-
pickerIsPresented = true
59-
}
51+
pickerIsPresented = true
6052
}
6153
.familyActivityPicker(
6254
isPresented: $pickerIsPresented,

0 commit comments

Comments
 (0)