Expose the bridge instance to CxxModule via a weak_ptr

Summary:
In order for `CxxModule` modules to be able to do things like emit events, we need to expose the bridge instance.

To allow classes derived from `CxxModule` in other projects to include `<cxxreact/Instance.h> I also needed to convert all the header includes to non-relative  ones.

Reviewed By: javache

Differential Revision: D4564145

fbshipit-source-id: a5bc28dd9b40e2b141af9e867105c56083fbdcdc
This commit is contained in:
Sean Kinsey
2017-02-15 09:49:07 -08:00
committed by Facebook Github Bot
parent f9df89ac95
commit c38d56d9db
17 changed files with 66 additions and 53 deletions

View File

@@ -50,7 +50,9 @@ CxxNativeModule::CxxNativeModule(std::weak_ptr<Instance> instance,
std::unique_ptr<CxxModule> module)
: instance_(instance)
, module_(std::move(module))
, methods_(module_->getMethods()) {}
, methods_(module_->getMethods()) {
module_->setInstance(instance);
}
std::string CxxNativeModule::getName() {
return module_->getName();