react-native-unimodules
This library contains the core unimodule infrastructure and a collection of unimodules and interfaces that are commonly depended on by other unimodules.
Last updated 2 months ago by bbarthec .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-native-unimodules 
SYNC missed versions from official npm registry.

react-native-unimodules

This library contains the core unimodule infrastructure and a collection of unimodules and interfaces that are commonly depended on by other unimodules. You only need to install react-native-unimodules once and then you will be able to use most of the packages from the Expo SDK, like expo-camera, expo-media-library and many more, in any React Native project.

The easiest way to use the library is to initialize a project with it already installed: npx create-react-native-app my-app.

You can also use expo-cli to do this - run npm i -g expo-cli and then expo init --template bare-minimum or expo init --template expo-template-bare-typescript if you prefer TypeScript.

If you have an existing project you'd like to install it into, please read the following instructions.

???? Installation

This project requires that you use CocoaPods on iOS, to set it up see this gist, or relevant parts of the this guide. React Native >= 0.60 ships with CocoaPods support by default, so this should be easy if you're already on that version.

npm install react-native-unimodules

Now you need to configure the library for iOS and/or Android.

???? Configure iOS

Advanced configuration

<summary>Need to customize node_modules path?</summary>

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!(modules_paths: ['./path/to/node_modules'])

<summary>Need to exclude some unimodules that are being automatically linked?</summary>

If you need to exclude some of the unimodules that you are not using but they got installed by your other dependencies (like expo), then you can pass in exclude param for this. For example, if you want to exclude expo-face-detector, you may want to use this: use_unimodules!(exclude: ['expo-face-detector'])

???? Configure Android

In android/settings.gradle

  1. At the top add apply from: '../node_modules/react-native-unimodules/gradle.groovy'
  2. Then call includeUnimodulesProjects() on the next line.

In android/app/build.gradle

  1. Add apply from: '../../node_modules/react-native-unimodules/gradle.groovy' anywhere before the dependencies {} block.
  2. Add addUnimodulesDependencies() inside dependencies {} block.
  3. We recommend you use Java 1.8, you can set this like this.

In android/build.gradle

  1. Update minSdkVersion to 21.

In MainApplication.java Make the changes outlined in the diff that correspondes to your react-native version.

Advanced configuration

<summary>Need to customize node_modules path?</summary>

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 modulesPaths for both of these functions: includeUnimodulesProjects([modulesPaths: ['./path/to/node_modules']]), addUnimodulesDependencies([modulesPaths: ['./path/to/node_modules']])

<summary>Need to exclude some unimodules that are being automatically linked?</summary>

If you need to exclude some of the unimodules that you are not using but they got installed by your other dependencies (like expo), then you can pass in exclude param for this. For example, if you want to exclude expo-face-detector, you may want to use this: addUnimodulesDependencies([exclude: ['expo-face-detector']])

<summary>Need to customize configuration of unimodule dependencies?</summary>

You can also customize the configuration of the unimodules dependencies (the default is implementation, if you're using Gradle older than 3.0, you will need to set configuration: "compile" in addUnimodulesDependencies, like: addUnimodulesDependencies([configuration: "compile"]))

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 'react-native-unimodules';

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

import * as Permissions from 'expo-permissions';

Current Tags

  • 0.11.0                                ...           latest (2 months ago)

38 Versions

  • 0.11.0                                ...           2 months ago
  • 0.10.1                                ...           5 months ago
  • 0.10.0                                ...           5 months ago
  • 0.9.1                                ...           6 months ago
  • 0.9.0                                ...           7 months ago
  • 0.8.1                                ...           7 months ago
  • 0.8.0                                ...           8 months ago
  • 0.7.0                                ...           a year ago
  • 0.7.0-rc.4                                ...           a year ago
  • 0.7.0-rc.3                                ...           a year ago
  • 0.7.0-rc.2                                ...           a year ago
  • 0.7.0-rc.1                                ...           a year ago
  • 0.7.0-rc.0                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.6.0-rc.1                                ...           a year ago
  • 0.6.0-rc.0                                ...           a year ago
  • 0.5.4                                ...           a year ago
  • 0.5.3                                ...           a year ago
  • 0.5.2                                ...           a year ago
  • 0.5.1                                ...           a year ago
  • 0.5.0                                ...           a year ago
  • 0.5.0-rc.0                                ...           a year ago
  • 0.4.2                                ...           a year ago
  • 0.4.1-alpha.0                                ...           a year ago
  • 0.4.1                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.4.0-alpha.3                                ...           a year ago
  • 0.4.0-alpha.2                                ...           a year ago
  • 0.4.0-alpha.1                                ...           a year ago
  • 0.4.0-alpha.0                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.2.0-beta.0                                ...           2 years ago
  • 0.1.0-rc.2                                ...           2 years ago
  • 0.1.0-rc.1                                ...           2 years ago
  • 0.1.0-rc.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Downloads
Today 77
This Week 77
This Month 2,108
Last Day 24
Last Week 869
Last Month 3,566
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |