WIP Add support for mocking files
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):

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