Skip to content

feat(ios): encapsulate device info listeners#49162

Closed
okwasniewski wants to merge 4 commits into
facebook:mainfrom
okwasniewski:feat/encapsulate-deviceinfo
Closed

feat(ios): encapsulate device info listeners#49162
okwasniewski wants to merge 4 commits into
facebook:mainfrom
okwasniewski:feat/encapsulate-deviceinfo

Conversation

@okwasniewski
Copy link
Copy Markdown
Contributor

@okwasniewski okwasniewski commented Feb 4, 2025

Summary:

This PR encapsulates device info listeners removing additional logic from RCTAppDelegate which is a prerequisite for #49078

Now we use KVO (Key Value Observation) to listen to window size changes making this module's logic encapsulated + allows to use it in brownfield scenarios.

To keep backward compatibility RCTDeviceInfo still emits RCTWindowFrameDidChangeNotification

Changelog:

[IOS] [ADDED] - encapsulate device info listeners

Test Plan:

Check if window size change listener is fired

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner labels Feb 4, 2025
@okwasniewski okwasniewski force-pushed the feat/encapsulate-deviceinfo branch from 48cb626 to 227a2c7 Compare February 4, 2025 11:27
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 4, 2025
Comment thread packages/react-native/React/CoreModules/RCTDeviceInfo.mm Outdated
Co-authored-by: Riccardo Cipolleschi <riccardo.cipolleschi@gmail.com>
Comment thread packages/react-native/React/CoreModules/RCTDeviceInfo.mm Outdated
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@okwasniewski
Copy link
Copy Markdown
Contributor Author

Hey @cipolleschi I've pushed additional commit with observer cleanup on invalidation.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 13, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi merged this pull request in 7dc85d0.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @okwasniewski in 7dc85d0

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants