Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Creating Standalone JS File For Each Native Component #22990
We are going to be generating native code from flow types in JS for our native components. In order to do this we need to have an individual JS file for each native component with complete flow types.
In a bunch of our JS files we choose a component based on platform, typically looking something like this:
we want to change this code so that each
We need your help to make this change!
How to help
Pick one of the native components from the list below. Comment that you are working on that file and try to choose one that nobody else has commented about already.
Search the codebase for .js files that include that name. We are specifically looking for
Create a new js file suffixed with 'NativeComponent' right next to the file that you found. In this case we'd create a
We should move the call to requireNativeComponent from
A pastebin of what I think the changes look like for this component are here: https://pastebin.com/RFpdT76V
One thing to note is that the majority of types necessary for these files shouldn't be imported from other files. Our codegen can't yet handle importing types from other files so in most cases I'd prefer to duplicate the type in this new file if it is needed. There are some exceptions to this that the codegen can handle that I'd expect most of these files will need. Specifically:
If you come across other types that you think are sufficiently complex that you think shouldn't be duplicated tag me on your PR. Perhaps we should be adding knowledge of that type to the codegen.
Testing Your Changes
For the highest confidence in your change, we recommend testing your changes using the RNTester App. Instructions to install and test the app are in the readme in the RNTester directory. If your component is an Android component you should test it on Android. If it is iOS, then test on iOS.