Skip to content

AceDev24/react-ymap

Repository files navigation

React Native Yandex Maps

yarn add react-native-yamap
npm i react-native-yamap --save

const withYandexMaps: ConfigPlugin = (config) => { return withAppDelegate(config, async (config) => { const appDelegate = config.modResults;

// Add import
if (!appDelegate.contents.includes("#import <YandexMapsMobile/YMKMapKitFactory.h>")) {
  // Replace the first line with the intercom import
  appDelegate.contents = appDelegate.contents.replace(
    /#import "AppDelegate.h"/g,
    `#import "AppDelegate.h"\n#import <YandexMapsMobile/YMKMapKitFactory.h>`
  );
}

const mapKitMethodInvocations = [
  `[YMKMapKit setApiKey:@"${config.extra?.mapKitApiKey}"];`,
  `[YMKMapKit setLocale:@"ru_RU"];`,
  `[YMKMapKit mapKit];`,
]
  .map((line) => `\t${line}`)
  .join("\n");

// Add invocation
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (!appDelegate.contents.includes(mapKitMethodInvocations)) {
  appDelegate.contents = appDelegate.contents.replace(
    /\s+return YES;/g,
    `\n\n${mapKitMethodInvocations}\n\n\treturn YES;`
  );
}

return config;

}); };

export default withYandexMaps(config);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published