react-native-mock icon indicating copy to clipboard operation
react-native-mock copied to clipboard

Mock for i18nManager

Open edmundito opened this issue 8 years ago • 3 comments

Hello, I'd like to add a suggestion to create a mock for React.i18nManager.

My team ran into an issue where an OSS module was referring it and failed to build during the test runner setup process. Our workaround is to import react-native-mock in the runner setup script and assign a i18nManager mock. However, it would be nice if react-native-mock supported it out of the box.

edmundito avatar May 22 '17 20:05 edmundito

Short term that's exactly the ideal fix for this! Long term i plan to do a large refactor job on the project in the coming weeks, i'll add this to the list!

RealOrangeOne avatar May 25 '17 08:05 RealOrangeOne

@edmundito would you be able to share how you implemented this?

joelpickup avatar Jun 08 '17 10:06 joelpickup

@joelpickup In whichever test framework you're using in the initialization JS file, or via an import in your test, you can add the following:

const React = require('react-native');

React.I18nManager = {
  isRTL: false,
  allowRTL: () => {},
  forceRTL: () => {}
};

edmundito avatar Jun 08 '17 16:06 edmundito