Here is a simple component that I am trying to test using React Native 0.39 and Jest 18:
// index.ios.js
import React, { Component } from \'react\';
import { Ap
This way, you will mock it once (before jest starts)
jest.config.js
module.exports = {
preset: 'react-native',
setupFiles: ['./__mocks__/your-native-bridge.js']
};
__mocks__/your-native-bridge.js
import {NativeModules} from 'react-native';
NativeModules.YourNativeBridge = {
property: jest.fn()
};
Don't forget to mock all possible functions, properties in YourNativeBridge