{"bugs":{"url":"https://github.com/expo/expo/issues"},"dist":{"shasum":"d6d310b8ac1bd6ea6492e13ba8ae5efa7e5c3263","tarball":"https://registry.npmjs.org/@unimodules/react-native-adapter/-/react-native-adapter-5.5.0.tgz","fileCount":107,"integrity":"sha512-QoGNSzq1YQzMYhqOmEMBk60mmTfpCjo81iir/RQVLTnrycQeTO9mlSrMOkEswDFt1cz6jGASdZa31x30bT0bmg==","signatures":[{"sig":"MEUCIQDcDcb1+zBKeXp7sKMALhsdVOhUq2Y6RYBYP7WZkHqtYwIgQLFfxZcJ92uzutVDnStpGvtwkF2EfBHcFZVSp+DpgLo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":144933,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMmksCRA9TVsSAnZWagAAu/wP/2IHBIIVduBqbnSkNYW0\nIWldBNlEI59LmHALBnk1yEGIA+hkl30oFM1rZixYlJQ5ZSCI0911x298amAH\naB395Qng+DfHYOh2Dytby57gIpmRUuzKdJNtiD9XXiRG0m3ujbbTo7gLD4It\n8E72boAf38AojKDgHq0j2qYCy/NxPtwp669y4qiDGsblNkhT4Y9IVQNpFQBq\nSVUsMDVz2aJv946VReZEn8bJvX9kflDYnM00KVZosyCgcwy3BhpXUFFuyNfd\nORYRiZ+9B9tm/V878UkagR09dMAxl+1DXoh6hux8R63T1WfAvuMrO0e33dnr\n1lOJjncLBRK+kmk9FC6yOTF52ck3nbAu8BRiGdxZN3BLWgjMEWIqBP+sF60H\nbZRmV5TdjpHYHbO+SQHHzkNkQUfmlYGUkDs4yjx3SqJzPzrwuMF0IJ6/4dzz\nhylY1w9OKrnRQ6znWi0Lkt0smbR06Pb4NIBu9FKAXfT9+X7nFItiDcFWsogO\nzz+fSBA85KbqSLY3Dph3VaU7ye+vHOKRbgRrhH0uYOg0AeyFMu22UTutE3ZN\nlWHlJzkOm0xnk/bPINYjp7ynL1twXw8RoCEuxcnCqwmij6pz0mjUbm5oaHYJ\ncf3WEqp8FWb9skF2Q1z1A8LSUFZ7Z1Afg4PAXSvCbRT+KfPN/ZXbvyly0883\nXfw1\r\n=EUmz\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":"6e9b27f2e118c6a3540376ca6601478a087edfcc","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":"tsapeta","email":"npm@tsapeta.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.14.5","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":"bycedric","email":"me@bycedric.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":"exponent","email":"exponent.team@gmail.com"},{"name":"fson","email":"ville.immonen@iki.fi"},{"name":"ide","email":"ide+npm@jameside.com"},{"name":"ijzerenhein","email":"hrutjes@gmail.com"},{"name":"jkhales","email":"jonathan@expo.io"},{"name":"mczernek","email":"czernekmichal@gmail.com"},{"name":"quinlanj","email":"quinlanjung@gmail.com"},{"name":"sjchmiela","email":"sjchmiela@gmail.com"},{"name":"tcdavis","email":"tc@expo.io"},{"name":"tsapeta","email":"sapeta.tomasz@gmail.com"},{"name":"uniadmin","email":"brentvatne+unimodules@gmail.com"},{"name":"wkozyra","email":"wojciech.kozyra@swmansion.com"},{"name":"wschurman","email":"wschurman@gmail.com"}],"sideEffects":false,"_nodeVersion":"14.3.0","dependencies":{"lodash":"^4.5.0","invariant":"^2.2.4"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@types/lodash":"^4.5.4","@unimodules/core":"~5.5.0","expo-module-scripts":"~1.2.0"},"peerDependencies":{"react-native":"*","react-native-web":"~0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-adapter_5.5.0_1597139244079_0.7252711087229227","host":"s3://npm-registry-packages"},"unimodulePeerDependencies":{"@unimodules/core":"*","unimodules-app-loader":"*","unimodules-font-interface":"*","unimodules-permissions-interface":"*","unimodules-image-loader-interface":"*"},"_id":"@unimodules/react-native-adapter@5.5.0","version":"5.5.0"}