ReactNativeLocalization icon indicating copy to clipboard operation
ReactNativeLocalization copied to clipboard

Localizing snapshot

Open fabriziogiordano opened this issue 8 years ago • 6 comments

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

fabriziogiordano avatar Jul 10 '17 05:07 fabriziogiordano

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

Sorry

Stefano

stefalda avatar Jul 11 '17 12:07 stefalda

do you know Pavel Prokopenko handle?

fabriziogiordano avatar Jul 11 '17 15:07 fabriziogiordano

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

Have you checked the documentation on the fastlane site?

stefalda avatar Jul 11 '17 15:07 stefalda

Thank you @stefalda

fabriziogiordano avatar Jul 12 '17 13:07 fabriziogiordano

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.

MoOx avatar Aug 24 '17 13:08 MoOx

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...)

stami avatar Nov 01 '17 14:11 stami