0.14.10 • Published 3 years ago

react-native-unimodules v0.14.10

Weekly downloads
62,452
License
MIT
Repository
github
Last release
3 years ago

@unimodules/core

This library contains the core Unimodule infrastructure and a collection of Unimodules and interfaces that are commonly depended on by other Unimodules. You will need to install this before using libraries from Foundation, like expo-camera, expo-media-library, and others.

Installation

The easiest way to do this is to initialize a "custom" project with expo-cli. If you have an existing app, you can follow these steps instead. This project requires that you use Cocoapods on iOS, to set iot up see this gist, or relevant parts of the this guide.

Install the package

npm install @unimodules/core

Configure iOS

  • Go back to the ios directory and open your Podfile, make your Podfile look like this one.
    • If you need to customize the path to node_modules, for example because you are using yarn workspaces, then you can pass in a param for this: use_unimodules!(node_modules_path: '../../../node_modules')
  • Run pod install again
  • Update your AppDelegate.h and AppDelegate.m according to this diff.

Add permission usage description keys to Info.plist

In order to submit your app to the App Store, you will need to eventually add these keys to your Info.plist. Even if you don't use the APIs described, you need to include the keys because code related to asking the permission will be bundled regardless, and Apple's static analysis tools will detect it and reject your app if the key isn't present. Including the key without using it has no impact to your users - iOS app permissions are requested at runtime and not listed in the app store listing as they are on Android. Test the permission prompts and customize the message as needed.

<key>NSCalendarsUsageDescription</key>
<string>Allow (YOUR APP NAME) to access your calendar</string>
<key>NSCameraUsageDescription</key>
<string>Allow (YOUR APP NAME) to use the camera</string>
<key>NSContactsUsageDescription</key>
<string>Allow (YOUR APP NAME) experiences to access your contacts</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Allow (YOUR APP NAME) to use your location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Allow (YOUR APP NAME) to use your location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Allow (YOUR APP NAME) to use your location</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow (YOUR APP NAME) to access your microphone</string>
<key>NSMotionUsageDescription</key>
<string>Allow (YOUR APP NAME) to access your device's accelerometer</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Give (YOUR APP NAME) periences permission to save photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Give (YOUR APP NAME) periences permission to access your photos</string>
<key>NSRemindersUsageDescription</key>
<string>Allow (YOUR APP NAME) to access your reminders</string>

Configure Android

  • Add apply from: '../node_modules/@unimodules/core/settings.gradle' and then useUnimodules.apply() to the top of android/settings.gradle
    • If you need to customize the path to node_modules, for example because you are using yarn workspaces, then you can pass in a param for this: useUnimodules.apply(nodeModulesPath: "../../../node_modules")
  • Add apply from: '../../node_modules/@unimodules/core/build.gradle' anywhere in android/app/build.gradle
  • Update minSdkVersion in android/build.gradle to 21
  • Update your MainApplication.java to according to this diff.

Add permissions to AndroidManifest.xml

Add whichever of the following permissions you would like to use in your app to android/app/src/main:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />

API

It's possible that you will not have to use any of the code provided by this package directly, it may be used only by other Unimodules that you install.

But it's likely that you will want to use something like FileSystem or Permissions, and to do that you can import the following modules like so:

import {
  Asset,
  Constants,
  FileSystem,
  Permissions,
} from '@unimodules/core';

You can import them directly from the specific Unimodule packag if you like, but your linter may complain for import a transitive dependency.

import * as Permissions from 'expo-permissions';
react-native-sdafpeakcomponentspeak-custom-componentsslashbracket-custom-expo-bare-templatereact-native-template-webview-sportibestbet55customsreactnativereact-native-compactcomic-packagereact-native-tc-conversations-teststatsig-react-native-sdkpublishtestformeinreactnativewebtestcomponentiusify-module-codigos_pt@code503/sds-react-native-components@plum4t2/plumcheckboxplainvenuemodegkashpaysdk1@infinitebrahmanuniverse/nolb-react-native-u@everything-registry/sub-chunk-2597xj-react-native-componentswefdsacerchretnerxfewedxfwsdfwefregwonderpool-app-ridertimeline-demotest_ssm_packagetest-library-streetertes-upload-recursiva@eohjsc/react-native-personal-health@eohjsc/react-native-smart-parking@eohjsc/highchartsvalidate-form-in-expo-style@highcharts/highcharts-react-native@hinh-eoh/test_publishtap-checkout-sdk-react-nativezippi-market-corerahulghagtest2rahulghagtest3dp-taro-taro-rndigitrecognizerrejurerhb-fesample-components-demosarcellern-pm85-scannerrn-openpayrnshellsouge-shop-packagebp-native-templates@didcky/jaijagga@lgowrav/testappgenesys-7aug@mifind/taro-rn@ekostore/eko-uidesign@kafudev/react-native-corebasic-counterbasecomponentsgasblockparty-native-storybookappcontactmarfin@banked/rn-banked-checkout@cognativ/locationnodjs-mobile-native-template@ats-components/circular-manager@ats-components/circular-spinnerbumble-react-sdkbarcodeapp-mainnative-base-hotfixnative-base-v3maro-rnmap-rn-commonmicroexamplecompany-react-native-commoncurrency-converter_vivantposetrackerpterrific-uireact-native-native-toast-library123react-native-redux-kitreact-native-piechart-xxyyreact-native-fusioncharts-enhancedreact-native-images-cachereact-native-empresis-componentsreact-native-compacreact-native-google-map-carouselreact-native-sdaf-testreact-native-side-navhighcharts-react-native-exthighcharts-react-native-test-b166erfc@react-native-tools/rn-google-maps@priyankahash/expoapp@native-base/v3everest-native-shellexposionexpo-template-bare-iex-defaultexpo-template-bare-tsexpo-template-bare-typescriptexpo-njbd-baseexpo-and-native-starter-kit@staart/nativeep-native-templateseasy-expo@tokstok/encrypt@riversilica_narendra/ios
0.15.0

3 years ago

0.14.10

3 years ago

0.14.9

3 years ago

0.14.8

3 years ago

0.14.7

3 years ago

0.15.0-alpha.0

3 years ago

0.14.6

3 years ago

0.14.5

3 years ago

0.14.4

3 years ago

0.14.3

3 years ago

0.14.2

3 years ago

0.14.1

3 years ago

0.14.0

3 years ago

0.13.3

3 years ago

0.13.2

3 years ago

0.13.1

3 years ago

0.13.0

3 years ago

0.12.0

3 years ago

0.11.0

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.7.0-rc.4

5 years ago

0.7.0-rc.3

5 years ago

0.7.0-rc.2

5 years ago

0.7.0-rc.1

5 years ago

0.7.0-rc.0

5 years ago

0.6.0

5 years ago

0.6.0-rc.1

5 years ago

0.6.0-rc.0

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.5.0-rc.0

5 years ago

0.4.2

5 years ago

0.4.1-alpha.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.4.0-alpha.3

5 years ago

0.4.0-alpha.2

5 years ago

0.4.0-alpha.1

5 years ago

0.4.0-alpha.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.2.0-beta.0

5 years ago

0.1.0-rc.2

5 years ago

0.1.0-rc.1

5 years ago

0.1.0-rc.0

5 years ago

0.0.1

5 years ago