How to customise styles & components
In order to customise your app you need to go a little deeper and dive into the code renders and styles each of the components and elements.
Customise Your App
Components can be easily customised by following the guidelines below:
How to customise component styling
Step 1: Find your component by following the component tree: Screen - Child component - Grandchild component
, etc. (Typically there are no more than three levels). Inside your code editor, click on the component name while pressing command (mac) / ctrl (windows) on your keyboard.
Step 2: Each group of components (buttons / charts / lists / views / etc.) share one styles.js
file, which is imported somewhere at the top of each component file...
...and applied inside the style prop on a component inside the parent component's return statement:
Step 3: Change the style properties, and saving your changes (command / ctrl S) will immediately render the updated style in your iOS simulator / android emulator / expo client.
How to add new components
Components can be easily extended by adding components. These are the steps:
Step 1: Import the component at the top of the file of the component that you are going to modify...
...but make sure that you are importing from the correct folder:
Same folder:
import ... from './text/CustomText';
Different folder same level:
import ... from '../text/CustomText';
Different folder one level up:
import ... from '../../text/CustomText';
Step 2: Place the imported component inside the parent component's return statement...
...while keeping the following rules in mind:
A component is always wrapped inside angle brackets like this:
<YourNewComponent />
or<YourNewComponent><ChildComponent /></YourNewComponent>
A component can have required props as well as optional props. Which props are required and which are optional is declared in the components PropTypes, which can be found at the bottom of a component's file:
Be aware that removing components from your project is possible - if you know what you're doing - but could result in serious complications and could potentially break the application.
Last updated
Was this helpful?