Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RCTBridgeWillInvalidateModulesNotification observer from RCTDeviceInfo #45012

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 2 additions & 12 deletions packages/react-native/React/CoreModules/RCTDeviceInfo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ - (void)initialize

_currentInterfaceDimensions = [self _exportedDimensions];

_invalidated = NO;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(interfaceOrientationDidChange)
name:UIApplicationDidBecomeActiveNotification
Expand All @@ -74,16 +76,6 @@ - (void)initialize
selector:@selector(interfaceFrameDidChange)
name:UIDeviceOrientationDidChangeNotification
object:nil];

// TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73
// The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure
// and the infrastructure imperatively invoke the `invalidate` method, rather than listening to a notification.
// This is a temporary workaround until we can investigate the issue better as there might be other modules in a
// similar situation.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(invalidate)
name:RCTBridgeWillInvalidateModulesNotification
Comment on lines -83 to -85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't really remove this.
If you look at the change that introduced this, it solves another bug: #42120.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the PR that introduced this is d46d80d and a further fix later in 91279a8

object:nil];
}

- (void)invalidate
Expand All @@ -107,8 +99,6 @@ - (void)_cleanupObservers

[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTWindowFrameDidChangeNotification object:nil];

[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];

[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ runTests() {
-scheme RNTester \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
"${SKIPPED_TESTS[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this in a separate PR, please?

"${SKIPPED_TESTS[@]}" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
}

buildProject() {
Expand Down