I am using react-native-localization library is my RN project.
My RN version is 0.59.4
I already get the project to work on android as expected, but the problem is with the IOS build.
I npm installed both react-native-localization and react-native-localize and linked them as described in their github manual using pod.
I did everything I could from linking to clean and building the project multiple times.
But I'm getting this error when running react-native-localize NativeModule.RNLocalize is null. To fix this issue try these steps and I did what the console told me but IN VAIN.
Can someone please tell me what I'm doing wrong?
Create a mock file like this (in the root directory):
Check that
__mock__has two underscores.This is an example of the file:
You don't have to import the
node_moduleofreact-native-localizationbecause each file under__mocks__will be automatically mocked.Try to run the test again and check if the error persist.
Edit: in my case, the only function that I needed from
react-native-localizewasuses24HourClock()so my mock file was very short:That was all for me.