Skip to content

Commit

Permalink
Set CxxModule instance before retrieving Method vector (#32719)
Browse files Browse the repository at this point in the history
Summary:
Allows `CxxModule` objects to set their `instance_` member before `getMethods()` is invoked, allowing for the `Method` callbacks to capture a weak reference to `getInstance()` if needed.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Set CxxModules' Instance before retrieving their Method vector.

Pull Request resolved: #32719

Test Plan: Ensure this statement swap does not break any scenarios with existing CI validation.

Reviewed By: JoshuaGross

Differential Revision: D32955616

Pulled By: genkikondo

fbshipit-source-id: fd7a23ca2c12c01882ff1600f5aef86b1fe4a984
  • Loading branch information
JunielKatarn authored and facebook-github-bot committed Dec 15, 2021
1 parent 89faf0c commit 1d45b20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/CxxNativeModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ void CxxNativeModule::lazyInit() {
module_ = provider_();
provider_ = nullptr;
if (module_) {
methods_ = module_->getMethods();
module_->setInstance(instance_);
methods_ = module_->getMethods();
}
}

Expand Down

0 comments on commit 1d45b20

Please sign in to comment.