Skip to content

Commit

Permalink
Fix reported properties for native modules (facebook#46788)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#46788

Changelog: [internal]

This fixes the reported keys for C++ TurboModules. Before, we were trying to read the properties from the method map in the public `TurboModule`, but in this implementation all the logic is actually in its delegate (also a `TurboModule` instance, yeah, confusing).

This fixes the issue by forwarding the call to the delegate that has the right information.

Differential Revision: D63761381
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 2, 2024
1 parent c430083 commit b37596a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public:
return delegate_.create(rt, propName);
}
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}
static constexpr std::string_view kModuleName = "${moduleName}";
protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -107,6 +111,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -707,6 +715,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModuleCxx\\";

protected:
Expand Down Expand Up @@ -988,6 +1000,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -1110,6 +1126,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -1301,6 +1321,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"AliasTurboModule\\";

protected:
Expand Down Expand Up @@ -1646,6 +1670,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"CameraRollManager\\";

protected:
Expand Down Expand Up @@ -1890,6 +1918,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"ExceptionsManager\\";

protected:
Expand Down Expand Up @@ -2095,6 +2127,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -2272,6 +2308,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule\\";

protected:
Expand Down Expand Up @@ -2323,6 +2363,10 @@ public:
return delegate_.create(rt, propName);
}

std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}

static constexpr std::string_view kModuleName = \\"SampleTurboModule2\\";

protected:
Expand Down

0 comments on commit b37596a

Please sign in to comment.