Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Mock for i18nManager #134

Open
edmundito opened this issue May 22, 2017 · 3 comments
Open

Mock for i18nManager #134

edmundito opened this issue May 22, 2017 · 3 comments

Comments

@edmundito
Copy link

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.

@RealOrangeOne
Copy link
Owner

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!

@joelpickup
Copy link

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

@edmundito
Copy link
Author

@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: () => {}
};

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants