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 4b0aeb9
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/sdk/client-side-sdks/react-native/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';

The DevCycle React Native SDK lets you easily integrate your React Native web applications with DevCycle.

:::caution
:::info

This SDK is not compatible with React Native Expo.
Extra steps are required to get DevCycle working with Expo and React Native Web. See the [Expo + React Native Web](#expo--react-native-web) section below for more information.

:::

Expand All @@ -31,3 +31,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.

## Expo + React Native Web

To get your Expo or React Native Web working with DevCycle, you will need to change one of the rules in the webpack config to exclude `.cjs` files from being 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 4b0aeb9

Please sign in to comment.