Skip to content

Commit

Permalink
chore: update docs for extra info for expo compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jsalaber committed Jul 24, 2023
1 parent d9c7ad6 commit 2efadeb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/sdk/client-side-sdks/react-native/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ This SDK is not compatible with React Native Expo.

:::

:::caution

Extra steps are required to get DevCycle working with React Native Web. See the [React Native Web](#expo--react-native-web) section below for more information.

:::

:::info

Currently, DevCycle for React Native only supports access via functional component hooks.
Expand All @@ -31,3 +37,25 @@ The SDK is available as a package on npm. It is also open source and can be view
## Requirements:

This SDK is compatible with _React Native_ version 0.64.0 and above.

## React Native Web

To get your React Native Web working with DevCycle, you will need to change one of the rules in the webpack config to include `.cjs` files as one of the file types to be transpiled, e.g.:

```js
const createExpoWebpackConfigAsync = require('@expo/webpack-config');

module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);

config.module.rules = config.module.rules.map(rule => {
if (rule.oneOf instanceof Array) {
// add "cjs" as an exclusion to this rule to prevent it from being regarded as an asset
rule.oneOf[rule.oneOf.length - 1].exclude = [/\.(js|mjs|jsx|cjs|ts|tsx)$/, /\.html$/, /\.json$/];
}
return rule;
});

return config;
};
```

0 comments on commit 2efadeb

Please sign in to comment.