-
Notifications
You must be signed in to change notification settings - Fork 4.9k
📚 [Guide] Create a backward compatible Turbomodule #3023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📚 [Guide] Create a backward compatible Turbomodule #3023
Conversation
✅ Deploy Preview for react-native ready! 🔨 Explore the source changes: 95db79d 🔍 Inspect the deploy log: https://app.netlify.com/sites/react-native/deploys/6239a2c0899af50008deb46e 😎 Browse the preview: https://deploy-preview-3023--react-native.netlify.app |
78e1d3a
to
0698e45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @cipolleschi, thank you for the great work on fixing and extending the documentation lately! 👍
It looks like the page is not linked in any sidebar, which makes the page only accessible via URL. You probably want to add this page somewhere in there:
Other that that, I have left two, small suggestions according to the new page content.
Hi @Simek! Thanks for the suggestions. I'll go through applying them now. About the sidebar thing, I left the article out on purpose for two reasons:
What do you think? |
0698e45
to
3b07322
Compare
I should have fixed all the comments! :D |
|
||
To create a turbomodule with the React Native CLI, run the following command: | ||
|
||
```sh title="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```sh title="" | |
```sh |
Just a small fix suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick updates! For the formatting and website perspective this LGTM.
Let's have a @cortinico look at the technical side of this. 🙂
There are few more small formatting (capitalization of Metro, JavaScript, TypeScript etc.) and punctuation issues (mostly missing dots at the end of sentences), but since this still a draft we can correct this in the future.
3b07322
to
e9c53d6
Compare
Great, thanks! |
], | ||
"keywords": ["react-native", "ios", "android"], | ||
"repository": "https://github.com/<your_github_handle>/example-library", | ||
"author": "<Your Name> <your_email@your_provide.com> (https://github.com/<your_github_handle>)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"author": "<Your Name> <your_email@your_provide.com> (https://github.com/<your_github_handle>)", | |
"author": "<Your Name> <your_email@your_provider.com> (https://github.com/<your_github_handle>)", |
|
||
This section and the following are a practical guides to create a module that is backward compatible. We are not diving deep into what can be done with Native Modules. For more informations on that topic, have a look [here](native-modules-intro). | ||
|
||
If you are interested in creating a Turbomodule, you can skip this part and directly go [here](#create-the-turbomodule). Consider that most of the code of a Native Module is needed for a Turbomodule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the "Consider that most of the code of a Native Module is needed for a Turbomodule" is confusing for the reader.
If a reader is looking into creating a TurboModule without dealing with backward compat, probably is not even reading this page right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I moved the sentence to the previous paragraph, adding some more context.
Great stuff 👍 A couple of things that are worth mentioning:
|
e9c53d6
to
df09aba
Compare
Thanks! For your points 1 and 2, I added a sentence at line 426. It's not clear to me what do you mean for your point 3, though. The whole point of the article is that we can install the module in both the architecture. Some problem arises if:
But I think that these are clearly explained throughout the guide and also with the summary. I think that the user can expect some error if it forget about these steps. What do you think? |
df09aba
to
95db79d
Compare
Discussed offline but following up here for the sake of transparency. I think we will adjust the guide a bit to adopt the approach followed by some of the Software Mansion library: Ideally we would like to don't ask the user to update the import but just have an abstraction that will expose the correct object given the underlying infrastructure. |
Closing as this is stale and merged in #3037 |
This PR contains a first draft of a Guide to create a TurboModule which is backward compatible with the new architecture.
This guide is intended to be used as a reference to understand better how the backward compatibility can be achieved and what are the differences between a Native Module and a Turbomodule, from a developer perspective.