react-native-owl icon indicating copy to clipboard operation
react-native-owl copied to clipboard

WIP Add support for mocking files

Open ceceppa opened this issue 3 years ago • 2 comments

Description

This PR sets the OWL_BUILD environment variable when building the app using the owl:build:* process. The variable can be used to configure the metro.config.js file to change the priority of the file extensions. For example in the example app:

if (process.env.OWL_BUILD) {
  resolver.sourceExts = [
    'owl.ts',
    'owl.tsx',
    'owl.js',
    'owl.jsx',
    'ts',
    'tsx',
    'js',
    'jsx',
  ];
}

it allows the app to load mock components with the extension .owl.ts*. Besides allowing mock components/data for testing only, it guarantees that no test code ends up by mistake in the production app.

Type of Change

  • [x] New feature (non-breaking change which adds functionality)
  • [x] This change requires a documentation update

How Has This Been Tested?

The example app renders the App Button when launched via yarn start and Owl Button when launched with owl:test:*

Checklist:

  • [ ] Add support for communication between mocks and test
  • [ ] Add support for Android build
  • [ ] Update documentation
  • [ ] Better example

Screenshots (for visual changes):

Simulator Screen Shot - iPhone 13 Pro - 2022-09-06 at 09 10 19

ceceppa avatar Sep 06 '22 07:09 ceceppa

@ceceppa Once https://github.com/FormidableLabs/react-native-owl/pull/151 is merged, it would be great for this PR to be continued :)

robwalkerco avatar Sep 05 '23 09:09 robwalkerco

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-owl ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 7, 2023 9:47am

vercel[bot] avatar Sep 07 '23 09:09 vercel[bot]