Skip to content

Commit e074cdd

Browse files
committed
keep old docs around
1 parent c070f37 commit e074cdd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

website/versioned_docs/version-22.x/TutorialReactNative.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,22 @@ jest.mock('Text', () => {
201201
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.
202202

203203
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`.
204+
205+
### `@providesModule`
206+
207+
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`:
208+
209+
```json
210+
"haste": {
211+
"defaultPlatform": "ios",
212+
"platforms": ["android", "ios"],
213+
"providesModuleNodeModules": [
214+
"react",
215+
"react-native",
216+
"my-awesome-module",
217+
"my-text-component"
218+
]
219+
},
220+
```
221+
222+
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 commit comments

Comments
 (0)