Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module RNI18n requires main queue setup since it overrides constantsToExport #5

Open
gfrileux opened this issue Feb 14, 2019 · 3 comments

Comments

@gfrileux
Copy link

Hi,

I have just installed react-native-locale-detector 1.0.1 in order to initialise i18next
The install and build worked ok (although the RNi18Test target in XCode is causing issues and needs to be removed), however I now get a warning whenever we launch the app. Below is the message:

Module RNI18n requires main queue setup since it overrides constantsToExport but doesn't implement requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

How can this be resolved ?

Here is our setup:
"i18next": "^12.0.0",
"react-i18next": "^8.3.8",
"react-native": "0.57.5",
"react-native-locale-detector": "^1.0.1",

Many thanks
Greg

@yungkittty
Copy link

I also see this warning when building my application on iPhone. Is it going to be fixed?

@lukasa1993
Copy link

is this still alive ?

@lukasa1993
Copy link

//  RNI18n.m
//  RNI18n
//
//  Created by Alexander Zaytsev on 14/06/15.
//  Copyright (c) 2015 Alexander Zaytsev. All rights reserved.
//

#import "RNI18n.h"

@interface RNI18n ()
-(NSString*) getCurrentLocale;
@end

@implementation RNI18n
RCT_EXPORT_MODULE();

-(NSString*) getCurrentLocale{
    NSString *localeString=[[NSLocale preferredLanguages] objectAtIndex:0];
    return localeString;
}

- (NSDictionary *)constantsToExport
{
    return @{ @"locale": [self getCurrentLocale] };
}

+ (BOOL)requiresMainQueueSetup
{
    return YES;
}
@end

please commit this and publish

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

No branches or pull requests

3 participants