From e074cdd21b50e40a2cb89bd3e24d80e25db94ed8 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 20 Aug 2019 18:41:29 +0200 Subject: [PATCH] keep old docs around --- .../version-22.x/TutorialReactNative.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/website/versioned_docs/version-22.x/TutorialReactNative.md b/website/versioned_docs/version-22.x/TutorialReactNative.md index df5dd5253034..83c6ebbd34ea 100644 --- a/website/versioned_docs/version-22.x/TutorialReactNative.md +++ b/website/versioned_docs/version-22.x/TutorialReactNative.md @@ -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.