{"bugs":{"url":"https://github.com/expo/expo/issues"},"dist":{"shasum":"9faff9e2f1c7010f968fd69b928d04ebcc7d45d1","tarball":"https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-6.2.0.tgz","fileCount":119,"integrity":"sha512-bF4B0A/ZsaQdsSwnv7y3uCG5eUlOYa/P0++RMiwvoBM6j4PVaWaVGl7vn8A/Nxt5bOABbMGurbGZKoHS19RZIg==","signatures":[{"sig":"MEYCIQCqe6NGEem6/Q1TZLKxjc/K0IVqfKOmJ/oZRK3IGRX9UAIhANqIE4A00CYAu5S7aexwYboKYraQCCcyCamf4x9th/y0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1135988,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSB+uCRA9TVsSAnZWagAAHcYP/AnBAm3tDt08MtLrGQ0N\n/M6eizNe4ngnceWXeZj5PTtq3R7QnQJJsohr0vwk22j03ryizgm8BOP8ZbKr\nXipyvw6x/lA04yD4LGBbnqj9/zdN955H2py5Eopwc/hj13wJ/4JsN8Oe45w2\nAHvywg9YR1yfePVLJPT3D+NUP7+Y7VMLePTLXIkzvxtx7VpfGX1uPif9YPBe\nhBfBHbZVKVuCTDn9TKFsTRvqogrvsPMYGH1lsMc61e9yRBw/KfeuoCwkYqzI\nBwUuxzQY05widK3Bfd3SOZfw+w0TGu8jr8LXX+kPGkmcuZCoPazMZ2FeYkcQ\nNepZfvnx+H1m+wlfqzd0PLoGJN7WOG+ND7SAUHfU7apjahYkfWAIFqzR4l9X\nn/nPYv3FsL1J7kELD1Z1Gfi+QJykaEwkltRWkTjwLSbv24I3icTxZX3Tik+I\nak3D4s8C54rGEO26V4AD7VIC8ZpxXKlc4QhK9eMOr+SDFlzefrYowMbc6R+e\nhsW52/rbDCA32Up757YqHdnoi7xu+Iz9dfuqbledf7o59zhjaK1JtXER0qT0\nW1LdlDUN1ZriYxEPx6HToj4ojIBFVdN1EfTJysjls+8kxdo6C4YoIWovAP4c\n90yh+LqXNk1QOXWzGf/supRvPWpYUZCjmzk1MG00mEf929qX0M5nTlmL4zgp\n27YD\r\n=bO5X\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"preset":"expo-module-scripts"},"main":"build/index.js","name":"@unimodules/react-native-adapter","types":"build/index.d.ts","author":{"name":"650 Industries, Inc."},"readme":"# @unimodules/react-native-adapter\n\nA React Native adapter for Expo Universal Modules. It requires [`@unimodules/core`](https://github.com/expo/expo/tree/master/packages/@unimodules/core) to be installed and linked.\n\n## JavaScript installation\n\n```sh\n$ yarn add @unimodules/react-native-adapter\n\n# or\n\n$ npm install @unimodules/react-native-adapter --save\n```\n\n## Installation\n\nIf you are using `react-native-unimodules`, this package will already be installed and configured!\n\n### iOS (Cocoapods)\n\nIf you're using Cocoapods, add the dependency to your `Podfile`:\n\n`pod 'UMReactNativeAdapter', path: '../node_modules/@unimodules/react-native-adapter/ios', inhibit_warnings: true`\n\nand run `npx pod-install`.\n\n### Android\n\n1.  Append the following lines to `android/settings.gradle`:\n    ```gradle\n    include ':unimodules-react-native-adapter'\n    project(':unimodules-react-native-adapter').projectDir = new File(rootProject.projectDir, '../node_modules/@unimodules/react-native-adapter/android')\n    ```\n2.  Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n    ```gradle\n    compile project(':unimodules-react-native-adapter')\n    ```\n\n## Additional required setup\n\n#### iOS\n\n1. Open the `AppDelegate.m` of your application.\n2. Import `<UMCore/UMModuleRegistry.h>`, `<UMReactNativeAdapter/UMNativeModulesProxy.h>` and `<UMReactNativeAdapter/UMModuleRegistryAdapter.h>`.\n3. Make `AppDelegate` implement `RCTBridgeDelegate` protocol (`@interface AppDelegate () <RCTBridgeDelegate>`).\n4. Add a new instance variable to your `AppDelegate`:\n\n   ```objc\n   @interface AppDelegate () <RCTBridgeDelegate>\n\n   // add this line\n   @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;\n\n   @end\n   ```\n\n5. In `-application:didFinishLaunchingWithOptions:` add the following at the top of the implementation:\n   ```objc\n   self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];\n   ```\n6. Add two methods to the `AppDelegate`'s implementation:\n\n   ```objc\n   - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge\n   {\n       NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];\n       // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!\n       return extraModules;\n   }\n\n   - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {\n       return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index\" fallbackResource:nil];\n   }\n   ```\n\n7. When initializing `RCTBridge`, make the `AppDelegate` a delegate of the bridge:\n   ```objc\n   RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];\n   ```\n\n   or, if you use `react-native-navigation`, add the `bridgeManagerDelegate` parameter of `self`, like:\n   ```diff\n   -[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];\n   +[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions bridgeManagerDelegate:self];\n   ```\n8. That's it! All in all, your `AppDelegate.m` should look similar to:\n\n   <details>\n       <summary>Click to expand</summary>\n       <p>\n\n   ```objc\n   #import \"AppDelegate.h\"\n\n   #import <React/RCTBundleURLProvider.h>\n   #import <React/RCTRootView.h>\n\n   #import <UMCore/UMModuleRegistry.h>\n   #import <UMReactNativeAdapter/UMNativeModulesProxy.h>\n   #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>\n\n   @interface AppDelegate () <RCTBridgeDelegate>\n\n   @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;\n\n   @end\n\n   @implementation AppDelegate\n\n   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n   {\n       self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];\n       RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];\n       RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@\"YOUR_MODULE_NAME\" initialProperties:nil];\n       rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];\n\n       self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];\n       UIViewController *rootViewController = [UIViewController new];\n       rootViewController.view = rootView;\n       self.window.rootViewController = rootViewController;\n       [self.window makeKeyAndVisible];\n       return YES;\n   }\n\n   - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge\n   {\n       NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];\n       // If you'd like to export some custom RCTBridgeModules that are not universal modules, add them here!\n       return extraModules;\n   }\n\n   - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {\n       return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index\" fallbackResource:nil];\n   }\n\n   @end\n   ```\n\n   </details>\n\n#### Android\n\n1. Open the `MainApplication.java` of your application.\n2. Add to the imports:\n   ```java\n   import org.unimodules.adapters.react.ModuleRegistryAdapter;\n   import org.unimodules.adapters.react.ReactAdapterPackage;\n   import org.unimodules.adapters.react.ReactModuleRegistryProvider;\n   import org.unimodules.core.interfaces.Package;\n   ```\n3. Create an instance variable on the `Application`:\n   ```java\n   private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(Arrays.<Package>asList(\n       new ReactAdapterPackage()\n       // more packages, like\n       // new CameraPackage(), if you use expo-camera\n       // etc.\n   ), /* singletonModules */ null);\n   ```\n4. Add `new ModuleRegistryAdapter(mModuleRegistryProvider)` to the list returned by `protected List<ReactPackage> getPackages()`.\n5. You're good to go!\n\n## Usage\n\n### Calling methods on native modules\n\nNative modules are available behind the proxy (`NativeModulesProxy` of `@unimodules/core`).\n\nTo call an exported method, use `NativeModulesProxy[clientCodeName].exportedMethod(...arguments)`, like this:\n\n```js\n// For UM_REGISTER_MODULE(FileSystem,) or UM_REGISTER_UMPORTED_MODULE(FileSystem)\n// and UM_EXPORT_METHOD_AS(getInfo, getInfo:(NSString *)path)\n\n// or for method\n// @ExpoMethod\n// public void getInfo(String path, Promise promise)\n// defined in native module with name FileSystem\n\nimport { NativeModulesProxy } from '@unimodules/core';\n\nconst { FileSystem } = NativeModulesProxy;\n\nFileSystem.getInfo('file:///...');\n```\n\nNote that all the methods return `Promise`s.\n\n### Synthetic Platform Events\n\nWhen creating web universal modules, you may find that you need to send events back to the API layer.\nIn this case you will want to use the shared `SyntheticPlatformEmitter` instance from `@unimodules/core`. The shared emitter emit events to `react-native`'s `NativeEventEmitter` and `@unimodules/core`'s `EventEmitter` .\n\n`ExponentGyroscope.web.ts`\n\n```js\n// Example from expo-sensors native web gyroscope sensor\n\nimport { SyntheticPlatformEmitter } from '@unimodules/core';\n\nSyntheticPlatformEmitter.emit('gyroscopeDidUpdate', { x, y, z });\n```\n\nThis emitted event is then received with a `EventEmitter` in the developer-facing API.\n\n```js\nimport { EventEmitter } from '@unimodules/core';\n\nimport ExponentGyroscope from './ExponentGyroscope';\n\nconst nativeEmitter = new EventEmitter(ExponentGyroscope);\n\n// On Android and iOS, `nativeEmitter` receives events sent from Objective-C and Java. On web, it\n// receives events from the shared `SyntheticPlatformEmitter` instance.\nnativeEmitter.addListener('gyroscopeDidUpdate', ({ x, y, z }) => {});\n```\n","gitHead":"20fd5d772b3909444cf5c981845625801fe51e78","license":"MIT","scripts":{"lint":"expo-module lint","test":"expo-module test","build":"expo-module build","clean":"expo-module clean","prepare":"expo-module prepare","expo-module":"expo-module","prepublishOnly":"expo-module prepublishOnly"},"_npmUser":{"name":"brentvatne","email":"brentvatne@gmail.com"},"homepage":"https://github.com/expo/expo/tree/master/packages/@unimodules/react-native-adapter","keywords":["react-native","unimodules","adapter"],"deprecated":"replaced by the 'expo' package, learn more: https://blog.expo.dev/whats-new-in-expo-modules-infrastructure-7a7cdda81ebc","repository":{"url":"git+https://github.com/expo/expo.git","type":"git","directory":"packages/@unimodules/react-native-adapter"},"_npmVersion":"6.14.9","description":"The adapter to use universal modules with the React Native bridge","directories":{},"maintainers":[{"name":"sjchmiela","email":"sjchmiela@gmail.com"},{"name":"tsapeta","email":"npm@tsapeta.com"},{"name":"dsokal","email":"dominiksokal@gmail.com"},{"name":"wkozyra","email":"wojciech.kozyra@swmansion.com"},{"name":"bbarthec","email":"bartlomiejbukowski.b@gmail.com"},{"name":"ide","email":"ide+npm@jameside.com"},{"name":"mczernek","email":"czernekmichal@gmail.com"},{"name":"lukmccall","email":"kosmatylukasz@gmail.com"},{"name":"uniadmin","email":"brentvatne+unimodules@gmail.com"},{"name":"brentvatne","email":"brentvatne@gmail.com"},{"name":"ccheever","email":"ccheever@gmail.com"},{"name":"evanbacon","email":"baconbrix@gmail.com"},{"name":"quinlanj","email":"quinlanjung@gmail.com"},{"name":"esamelson","email":"eric@expo.io"},{"name":"fson","email":"ville.immonen@iki.fi"},{"name":"expoadmin","email":"support@expo.io"},{"name":"charliecruzan","email":"charliecruzan@gmail.com"},{"name":"tcdavis","email":"tc@expo.io"},{"name":"exponent","email":"exponent.team@gmail.com"},{"name":"wschurman","email":"wschurman@gmail.com"},{"name":"jkhales","email":"jonathan@expo.io"},{"name":"ijzerenhein","email":"hrutjes@gmail.com"},{"name":"bycedric","email":"me@bycedric.com"},{"name":"nikki93","email":"s.nikhilesh@gmail.com"},{"name":"jonsamp","email":"sampjon@gmail.com"}],"sideEffects":false,"_nodeVersion":"14.15.2","dependencies":{"lodash":"^4.5.0","invariant":"^2.2.4"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@types/lodash":"^4.5.4","@unimodules/core":"~7.1.0","expo-module-scripts":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-adapter_6.2.0_1615339437474_0.9918706246903848","host":"s3://npm-registry-packages"},"_id":"@unimodules/react-native-adapter@6.2.0","version":"6.2.0"}