{"bugs":{"url":"https://github.com/expo/expo/issues"},"dist":{"shasum":"b631d47e01eea4ff3b1da2c86713f8148479bfeb","tarball":"https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-2.0.0-alpha.0.tgz","fileCount":73,"integrity":"sha512-x7jvqndkaPgjMurb96sTZNxZnzbRoOFuhFfZ9YGTWQO5cNugH1wuq5oVW2wMIF+8X0DOkhFd1xzwFlAh1wfe1A==","signatures":[{"sig":"MEUCIQCGtHrLgi8QVQR7LhI/pt3tstJ2tVAiQltE8xkIGGuKAgIgcPWUay/uThjzP/YAehTJySbkwsl3mj9xGFf/+Eu4Vm4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":135853,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxxJHCRA9TVsSAnZWagAAeoMQAJ0cVtdHW29gAfneYHVS\n8B6fnxMTroE/moS3IESTbbDdgE+wAu0x0nt96vQrLOB9Sz6iu+NwFQ8yDMdv\n7uIppFAcm02Unmu1OciZz82FAclS7Gk3GplwUhDefY6/5nLC43psAS9GInbn\nFCZjKCSbEpC/eF11VLJnrN7P+NoFXu/J6eEXxlq33xceVAGGCE8qOnySjGop\nxHYrMCG6vLbDDfxBmCo8uGOKLxRiSFI+gXyH8kFu3uzEK0ft9Rw6YlRcFzjB\n91lJKtQMa0D1Yiblw7fM/BjouhFdEPMV5fqV51aSuFc8ghwkJKx1q9bfrHny\noCadnWQfg4jxedE0EsbkYekJZ2/VJHviD0/Roj/ea1FQqoXDVYi67UusCnxe\nNko2O5rOyw8jnb4IRbCSiO0zCKYNdMEOKP3mns33Xv7kj1p7/C6Yz4st+uQ8\nsCkD9jOny1sqXysoo9yF1ZYTJLRv5mf7PhBig1yXjaWmRyAkVJ8sCF2BPeDF\ntNNyt59ML57KV65VLS5C+K4o5wk2+BUBGuoaMcodRRNM8sryxEOZ77XUEzoX\nCV9dci221J7iMUW0kmH91iSlP/LacDlgMLz4w+HM52helcrhhAst3l6Yq3Cg\n0QzVboqBjqCZxF/zGzYzLquApfJLzqlVjM7Zx3WMKs2A3UYYXZF0PV8WR7JU\npObN\r\n=HUn0\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":"0c9c728afc913b2fd53e4f0a9cb163a58e83b68d","license":"MIT","scripts":{"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":"sjchmiela","email":"sjchmiela@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":"https://github.com/expo/expo.git","type":"git"},"description":"The adapter to use universal modules with the React Native bridge","directories":{},"maintainers":[{"name":"barthec","email":"bartlomiejbukowski.b@gmail.com"},{"name":"brentvatne","email":"brentvatne@gmail.com"},{"name":"ccheever","email":"ccheever@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":"janicduplessis","email":"janicduplessis@gmail.com"},{"name":"jesseruder","email":"jesseruder@gmail.com"},{"name":"nikki93","email":"s.nikhilesh@gmail.com"},{"name":"quinlanj","email":"quinlanjung@gmail.com"},{"name":"sjchmiela","email":"sjchmiela@gmail.com"},{"name":"terribleben","email":"ben@exp.host"},{"name":"tsapeta","email":"sapeta.tomasz@gmail.com"},{"name":"uniadmin","email":"brentvatne+unimodules@gmail.com"},{"name":"wkozyra","email":"wojciech.kozyra@swmansion.com"}],"sideEffects":false,"dependencies":{"invariant":"^2.2.4","prop-types":"^15.6.1","lodash.omit":"^4.5.0","lodash.pick":"^4.4.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@unimodules/core":"~1.0.0","babel-preset-expo":"^5.0.0","@types/lodash.omit":"^4.5.4","@types/lodash.pick":"^4.4.4","expo-module-scripts":"^1.0.0"},"peerDependencies":{"react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-adapter_2.0.0-alpha.0_1556550214464_0.4828025100818032","host":"s3://npm-registry-packages"},"unimodulePeerDependencies":{"@unimodules/core":"~1.0.0","unimodules-font-interface":"*","unimodules-permissions-interface":"*","unimodules-image-loader-interface":"*"},"_id":"@unimodules/react-native-adapter@2.0.0-alpha.0","version":"2.0.0-alpha.0"}