You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/versioned_docs/version-22.x/TutorialReactNative.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -201,3 +201,22 @@ jest.mock('Text', () => {
201
201
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.
202
202
203
203
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