stefalda / ReactNativeLocalization

Class to localize the ReactNative interface
MIT License
900 stars 123 forks source link

Localizing snapshot #82

Open fabriziogiordano opened 7 years ago

fabriziogiordano commented 7 years ago

Hi, this is not an issue. It's a support request.

You suggest in the wiki to Snapshot

Were you able to configure Snapshot on a React Native project? If yes, would you mind share the steps?

Thanks, Fabrizio

stefalda commented 7 years ago

Hi, I think Pavel Prokopenko wrtote that, because unfortunately I've never used snapshots either...

Sorry

Stefano

fabriziogiordano commented 7 years ago

do you know Pavel Prokopenko handle?

stefalda commented 7 years ago

Nope... just saw that he was the WIKI author...

Have you checked the documentation on the fastlane site?

fabriziogiordano commented 7 years ago

Thank you @stefalda

MoOx commented 7 years ago

What I am doing with jest is adding a jest-setup.js file and put this in it

// monkey patching the locale to avoid the error:
//  Something went wrong initializing the native ReactLocalization module
NativeModules.ReactLocalization = {
  language: 'fr_FR',
};

Then in jest config:

    "setupFiles": [
      "./jest-setup.js"
    ]

Can probably be configured via cli to allow multiples tests/snaps per language.

stami commented 7 years ago

Just in case someone else tried @MoOx's fix, you have to add also

import { NativeModules } from 'react-native';

to the beginning of jest-setup.js file to get Jest working.

(I'm using TypeScript, not sure if NativeModules is available globally in JS world...)