Copy/paste the following code to ~/components/ui/text.tsx:
Props
Accepts all the props of the React-Native Text component.
Usage
Uses the inheritance system to apply styles from parent components. Usage is the same as the React-Native Text component.
Inheritance system
By default, children cannot inherit styles from their parent components in React-Native. This can be problematic
for components like a Button with variants where its Text component should change its styles based on the variant.
To solve this, components that need to pass styles to their Text children are wrapped with a TextClassContext.Provider.
The Text component applies the styles from the TextClassContext to the React-Native Text component.
Specificity
The algorithm used to determine which styles to apply is based on the following order of specificity:
Order of specificity:
The added className of the Text component when being used
The value of the closest TextClassContext.Provider to children Text components