{"bugs":{"url":"https://github.com/expo/expo/issues"},"dist":{"shasum":"cb9c90550ceee5359e9899c99aa1c9e20a931954","tarball":"https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-5.0.0-alpha.0.tgz","fileCount":95,"integrity":"sha512-qPF92DiSDMoOmdxb/i6+XEAqLR7+4RZgi2HmPMlqh2oTBQIlrAcM7JQVsIDFkmtcVAzdy4VPzJpFDSJW67My3A==","signatures":[{"sig":"MEUCICBq58qgjzcPpAW1XfLPbu4IocOBppkvjlaTPix1YIR5AiEAunk7cTjygtcG6aNkIISFmZjUecuGGt85dzySM4AkkRY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":146340,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdg+gKCRA9TVsSAnZWagAA50AP/3xZv6uTWcGlyppABt7b\ntmOpmuOFVBtMGsYGwXgFLdKls0/GpnsUyGzGs/ZWgQKx/VYLVNURcoM9GPah\n/3v0zgiX4AzjooDTUw6mR+WlmArP8bUUui40YDGXTcMGbgbxHchK3B/WMONh\nds5xUCQfGI7k8dDbN2wdQaO09M5g7rbGsR7bQwjTysX5fs5KqmvN3zvNTjh6\n5dbjMG9VgLUAQMNK/THLrU7xrhg/uoU5fbUhdZJNA9PO5pWphPgGUEEN/sZ4\nvceLAaxTfH0Xdog9SwEadNQnbuGsHzFTVjifWKhBvqmomZ0YIGqyUvy4mldn\nEQpz6OrAUo2UdjHfeXHoaNcFO03RjOQ09rjrhTpDZcIPiL/0Ov3aNr9E0tlT\n6M17qT+uqF2HM08Gz5OLLKpYpttspZ8MiB76v9Kpf+1Syvt4AQ+mMCp2UQMd\nrCS/DNdD1GyC6PN+ZVGovRnU3JEapp6hkWu8xvJ4wDvV22c2mKAupxPzsPaS\n0QC9xl8D5oOT2ulXbFvglSgHP7RLe4zhkyvYZRFIvLw0kE559W3tD4IpO+9H\n/YllrumZ0nrA+AwXYepnqEIVqIlj3UCq0y9npjn2cI0OvVnlJp/UXC+nim2B\nra8WR/ZZBPkxDC9nwAdRsZJSyB+ytt55/DRmNZfUrNm+jDG+2ittohus4dIh\ngOLG\r\n=YFFe\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 `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 andExperience:nil];\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   ```\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 andExperience:nil];\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":"4e13b3cb88d9205f14bee7764038ab2dd9ef1fbd","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"},"_npmVersion":"6.9.0","description":"The adapter to use universal modules with the React Native bridge","directories":{},"maintainers":[{"name":"bbarthec","email":"bartlomiejbukowski.b@gmail.com"},{"name":"brentvatne","email":"brentvatne@gmail.com"},{"name":"ccheever","email":"ccheever@gmail.com"},{"name":"charliecruzan","email":"charliecruzan@gmail.com"},{"name":"dsokal","email":"dominiksokal@gmail.com"},{"name":"esamelson","email":"eric@expo.io"},{"name":"evanbacon","email":"baconbrix@gmail.com"},{"name":"expoadmin","email":"support@expo.io"},{"name":"fson","email":"ville.immonen@iki.fi"},{"name":"ide","email":"ide+npm@jameside.com"},{"name":"mczernek","email":"czernekmichal@gmail.com"},{"name":"quinlanj","email":"quinlanjung@gmail.com"},{"name":"sjchmiela","email":"sjchmiela@gmail.com"},{"name":"szymon20000","email":"szymon.kapala@swmansion.com"},{"name":"tsapeta","email":"sapeta.tomasz@gmail.com"},{"name":"uniadmin","email":"brentvatne+unimodules@gmail.com"},{"name":"wkozyra","email":"wojciech.kozyra@swmansion.com"}],"sideEffects":false,"_nodeVersion":"10.16.0","dependencies":{"lodash":"^4.5.0","invariant":"^2.2.4","prop-types":"^15.6.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@types/lodash":"^4.5.4","@unimodules/core":"~4.0.0","babel-preset-expo":"~7.0.0","expo-module-scripts":"~1.1.1"},"peerDependencies":{"react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-adapter_5.0.0-alpha.0_1568925706283_0.6065922531917005","host":"s3://npm-registry-packages"},"unimodulePeerDependencies":{"@unimodules/core":"^2.0.0-alpha.0","unimodules-font-interface":"*","unimodules-permissions-interface":"*","unimodules-image-loader-interface":"*"},"_id":"@unimodules/react-native-adapter@5.0.0-alpha.0","version":"5.0.0-alpha.0"}