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

fix new arch pod install error #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ios/LocalizationSettings.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ - (NSDictionary *)constantsToExport
{
return @{ @"language": [self getCurrentLanguage]};
}

+(BOOL)requiresMainQueueSetup
{
return YES;
Expand All @@ -85,6 +86,11 @@ +(BOOL)requiresMainQueueSetup
{
return std::make_shared<facebook::react::NativeLocalizationSettingsSpecJSI>(params);
}

- (facebook::react::ModuleConstants<JS::NativeLocalizationSettings::Constants::Builder>)getConstants {
return [self constantsToExport];
}

#endif

@end
4 changes: 3 additions & 1 deletion src/NativeLocalizationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule {
getLanguage(): Promise<string>;
setLanguage(lang: string): void;
language: string;
getConstants(): {
language: string;
};
}

export default TurboModuleRegistry.getEnforcing<Spec>('LocalizationSettings');
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const LocalizationSettings = LocalizationSettingsModule
*/
export function getLanguage(): string {
LocalizationSettings.getLanguage();
return LocalizationSettings.language.split('_')[0];
return LocalizationSettings.getConstants().language.split('_')[0];
}

/**
Expand Down