-
Couldn't load subscription status.
- Fork 52
Add a Component Page
Chiara Mooney edited this page Jan 28, 2021
·
13 revisions
Make sure to follow the steps on the Contributing to React Native Gallery page to create a fork of the react-native-gallery repo and an a fresh branch which will contain the change to the repo you made in your page addition.
If you are adding a page for a core component you can skip this step; it is only necessary if you are working with a community module.
- Run
yarn add <community module>at the root of the repository. - If the community module supports autolinking, you are done. Otherwise continue to Step 3.
- Open up windows/rngallery.sln in Visual Studio.
- Add community module as an Existing Project to solution.
- Add community module project as a reference to rngallery project.
- Open pch.h and add "#include <winrt/module_namespace.h>".
- Open App.cpp and add "PackageProviders().Append(winrt::module_namespace>::ReactPackageProvider());".
- Navigate to react-native-gallery repository in your local file system. Open repository by typing 'code .'. This will ensure that the linter will properly format your code each time you save.
- Create a new file in src/examples with the name "ExamplePage.tsx".
- Copy the source code from src/examples/TemplateExamplePage into your new file.
- Follow the instructions provided in the comments on the page to replace the data used for the template page with the data for your component.
- If working with a core component use React Native website to see the list of prop options for the component.
- If working with a community module, visit the repository for the module to see the list of prop options for the component.
- Delete all comments from the page source code once you have correctly filled the page.
- Open RNGalleryList.ts.
- Underneath the import statements at the top of the page, import your new page. Follow the syntax of previously added pages as an example.
- Inside the RNGalleryList array, add an entry for your page with the key equal to the name of your component and the component equal to your new page.