[Docs] NS_ENUM exported to JS, used as method arguments for native modules, must use RCT_ENUM_CONVERTER in RCTConvert class extension #2077
Labels
Good first issue
Interested in collaborating? Take a stab at fixing one of these issues.
Resolution: Locked
This issue was locked by the bot.
I think this section of the docs needs to be further expanded to explain the use of
RCT_ENUM_CONVERTER
.In v0.5.0, I was able to export NS_ENUM defined constants, and use them as method arguments. Example code below.
Enum Definition:
Constants:
Method Definition:
RCT_EXPORT_METHOD(doSomethingWithEnum:(MyEnumType)enum completion:(RCTResponseSenderBlock)callback)
In v0.7.0, this failed with the following log:
I was only able to puzzle the solution out after reading through the internal React Native code for quite some time. (Create a class extension for RCTConvert, use RCT_ENUM_CONVERTER to implement a converter method.)
The text was updated successfully, but these errors were encountered: