Skip to content

Commit

Permalink
keep old docs around
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Aug 22, 2019
1 parent 7ecb6ea commit 654f96a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions website/versioned_docs/version-22.x/TutorialReactNative.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,22 @@ jest.mock('Text', () => {
In other cases you may want to mock a native module that isn't a React component. The same technique can be applied. We recommend inspecting the native module's source code and logging the module when running a react native app on a real device and then modeling a manual mock after the real module.

If you end up mocking the same modules over and over it is recommended to define these mocks in a separate file and add it to the list of `setupFiles`.

### `@providesModule`

If you'd like to use Facebook's `@providesModule` module system through an npm package, the default haste config option must be overwritten and npm modules must be added to `providesModuleNodeModules`:

```json
"haste": {
"defaultPlatform": "ios",
"platforms": ["android", "ios"],
"providesModuleNodeModules": [
"react",
"react-native",
"my-awesome-module",
"my-text-component"
]
},
```

If you'd like to test a different default platform or if you are building for other platforms, the `defaultPlatform` and `platforms` configuration option can be updated.

0 comments on commit 654f96a

Please sign in to comment.