From 2f014d2bcd686140f5d379b5e8e5125eefe0613f Mon Sep 17 00:00:00 2001 From: Dylan Vann Date: Wed, 25 Apr 2018 03:05:16 -0400 Subject: [PATCH] Move documentation on other linking methods into docs. --- README.md | 56 ++++--------------- .../MainApplication.java | 6 +- docs/installation-cocoapods.md | 24 ++++++++ docs/installation-manual.md | 55 ++++++++++++++++++ 4 files changed, 92 insertions(+), 49 deletions(-) create mode 100644 docs/installation-cocoapods.md create mode 100644 docs/installation-manual.md diff --git a/README.md b/README.md index da0d67d..bf0fe26 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ 🚩 FastImage, performant React Native image component. [![npm](https://img.shields.io/npm/v/react-native-fast-image.svg?style=flat-square)](https://www.npmjs.com/package/react-native-fast-image) +[![npm](https://img.shields.io/npm/dm/react-native-fast-image.svg?style=flat-square)](https://npmjs.com/package/react-native-fast-image) [![CircleCI](https://img.shields.io/circleci/project/github/DylanVann/react-native-fast-image.svg?style=flat-square)](https://circleci.com/gh/DylanVann/react-native-fast-image) [![license](https://img.shields.io/github/license/DylanVann/react-native-fast-image.svg?style=flat-square)](https://github.com/DylanVann/react-native-fast-image/blob/master/LICENSE) @@ -44,54 +45,12 @@ and ```bash yarn add react-native-fast-image + +# Automatic linking. (other linking methods listed below) react-native link ``` -## Installation (manual linking) - -```bash -yarn add react-native-fast-image -``` - -*MainApplication.java* -Add `new FastImageViewPackage()` into the _getPackages_ method. - -```java - @Override - protected List getPackages() { - return Arrays.asList( - new FastImageViewPackage(), -``` - -*build.gradle* -Add `compile project(':react-native-fast-image')` into the dependencies block. - -``` -dependencies { - compile project(':react-native-fast-image') -``` - -*settings.gradle* - -Add the following to the bottom of the document. -``` -include ':react-native-fast-image' -project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android') -``` - -*Podfile* - -Add the following under the :subspecs array: -``` -pod 'react-native-fast-image', :path => '../node_modules/react-native-fast-image' -``` - - - - -## Usage -```js - +```jsx import FastImage from 'react-native-fast-image' const YourImage = () => @@ -106,6 +65,11 @@ const YourImage = () => /> ``` +## Other Linking Methods + +- [Manual](docs/installation-manual.md) (might be needed if something went wrong with `react-native link`) +- [CocoaPods (iOS)](docs/installation-cocoapods.md) (you may wish to use this if you are already using CocoaPods) + ## Properties ### `source?: object` @@ -202,7 +166,7 @@ FastImage.preload([ ## Troubleshooting -If you have any problems using this library try the steps in [troubleshooting](https://github.com/DylanVann/react-native-fast-image/blob/master/docs/troubleshooting.md) and see if they fix it. +If you have any problems using this library try the steps in [troubleshooting](docs/troubleshooting.md) and see if they fix it. ## Development diff --git a/ReactNativeFastImageExample/android/app/src/main/java/com/reactnativefastimageexample/MainApplication.java b/ReactNativeFastImageExample/android/app/src/main/java/com/reactnativefastimageexample/MainApplication.java index 3a7ec19..07637af 100644 --- a/ReactNativeFastImageExample/android/app/src/main/java/com/reactnativefastimageexample/MainApplication.java +++ b/ReactNativeFastImageExample/android/app/src/main/java/com/reactnativefastimageexample/MainApplication.java @@ -24,9 +24,9 @@ public class MainApplication extends Application implements ReactApplication { @Override protected List getPackages() { return Arrays.asList( - new MainReactPackage(), - new VectorIconsPackage(), - new FastImageViewPackage() + new MainReactPackage() + ,new VectorIconsPackage() + ,new FastImageViewPackage() ); } diff --git a/docs/installation-cocoapods.md b/docs/installation-cocoapods.md new file mode 100644 index 0000000..0d67413 --- /dev/null +++ b/docs/installation-cocoapods.md @@ -0,0 +1,24 @@ +# Installation (CocoaPods) + +- Edit `ios/Podfile` + +```diff +platform :ios, '9.0' + +target 'ReactNativeFastImageCocoaPodsExample' do + pod 'React', :path => '../node_modules/react-native', :subspecs => [ + 'Core', + 'CxxBridge', + 'DevSupport', + 'RCTText', + 'RCTNetwork', + 'RCTWebSocket', + 'RCTImage', + ] + pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' + ++ pod 'react-native-fast-image', :path => '../node_modules/react-native-fast-image' +end +``` + +- Run `pod install` within `ios` \ No newline at end of file diff --git a/docs/installation-manual.md b/docs/installation-manual.md new file mode 100644 index 0000000..36ef17d --- /dev/null +++ b/docs/installation-manual.md @@ -0,0 +1,55 @@ +# Installation (Manual) + +## iOS + +Add `FastImage.xcodeproj` to **Libraries** and add `libFastImage.a` to **Link Binary With Libraries** under **Build Phases**. [More info.](http://facebook.github.io/react-native/docs/linking-libraries-ios.html#content). + +## Android + +* Edit `android/settings.gradle` + +```diff +rootProject.name = 'MyApp' + +include ':app' + ++ include ':react-native-fast-image' ++ project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android') +``` + +* Edit `android/app/build.gradle` + +```diff +apply plugin: 'com.android.application' + +android { + ... +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile "com.android.support:appcompat-v7:23.0.1" + compile "com.facebook.react:react-native:+" // From node_modules ++ compile project(':react-native-fast-image') +} +``` + +* Edit `android/app/src/main/java/.../MainApplication.java` + +```diff +package com.myapp; + ++ import com.dylanvann.fastimage.FastImageViewPackage; + +.... + + @Override + protected List getPackages() { + return Arrays.asList( + new MainReactPackage() ++ ,new FastImageViewPackage() + ); + } + +} +``` \ No newline at end of file