Skip to content

bit-demos/react-native-custom-fonts-in-compositions

Repository files navigation

React Native components with custom fonts in compositions

This repo contains a number of helper components and example implementations for creating React Native components with Bit.
This workspace is created using React Native workspace template bit new react-native your-workspace-name.

  1. A basic React Native component that render text with a custom font.
    Created using React Native component template bit create react-native text code, read more.
  2. A React component that is used as a theme component that load the custom font, this component includes two examples of loading, one with Link and the other with ttf file.
  3. A custom React Native env that use the theme component to wrap the compositions of the components that are using this env.
    Created using React Native env template bit create react-native-env my-react-native code, read more.

Start the workspace

To run this workspace, Bit version 0.0.603 or higher is required.

bit install
bit compile
bit start

Workspace.jsonc

Here you can see how environments are applied for the components.

"teambit.workspace/variants": {
    "{ui/**}": {
      // uses the custom env
      "company.scope/envs/my-react-native": {}
      // uncomment the line below if you remove the custom env and remove the line above
      // "teambit.react/react-native": {}
    },
    "{theme/**}": {
      "teambit.react/react": {}
    },
    "envs/my-react-native": {
      "teambit.harmony/aspect": {}
    }
  }

About

Demo of a React Native workspace with custom fonts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published