|
1 | | - |
2 | 1 | # react-native-interactive-image-library |
3 | 2 |
|
| 3 | +<p> |
| 4 | +<img src="https://img.shields.io/npm/dm/react-native-interactive-image-library.svg" /> |
| 5 | +<img src="https://img.shields.io/npm/dt/react-native-interactive-image-library.svg" /> |
| 6 | +</p> |
| 7 | + |
| 8 | +A React Native component to display a gallery of images. |
| 9 | + |
| 10 | +<p align="center"> |
| 11 | +<img src="https://raw.githubusercontent.com/wiki/InterfaceKit/react-native-interactive-image-library/ios.gif" alt="iOS" width="400"> |
| 12 | +<img src="https://raw.githubusercontent.com/wiki/InterfaceKit/react-native-interactive-image-library/android.gif" alt="Android" width="400"> |
| 13 | +</p> |
| 14 | + |
4 | 15 | ## Getting started |
5 | 16 |
|
6 | | -`$ npm install react-native-interactive-image-library --save` |
| 17 | +`$ yarn add react-native-interactive-image-library` |
7 | 18 |
|
8 | 19 | ### Mostly automatic installation |
9 | 20 |
|
10 | 21 | `$ react-native link react-native-interactive-image-library` |
11 | 22 |
|
12 | 23 | ### Manual installation |
13 | 24 |
|
14 | | - |
15 | 25 | #### iOS |
16 | 26 |
|
17 | | -1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` |
18 | | -2. Go to `node_modules` ➜ `react-native-interactive-image-library` and add `RNIKInteractiveImageLibrary.xcodeproj` |
19 | | -3. In XCode, in the project navigator, select your project. Add `libRNIKInteractiveImageLibrary.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` |
| 27 | +1. In Xcode, in the project navigator, right click `Libraries` ➜ `Add Files to |
| 28 | + [your project's name]` |
| 29 | +2. Go to `node_modules` ➜ `react-native-interactive-image-library` and add |
| 30 | + `RNIKInteractiveImageLibrary.xcodeproj` |
| 31 | +3. In XCode, in the project navigator, select your project. Add |
| 32 | + `libRNIKInteractiveImageLibrary.a` to your project's `Build Phases` ➜ `Link |
| 33 | + Binary With Libraries` |
20 | 34 | 4. Run your project (`Cmd+R`)< |
21 | 35 |
|
22 | 36 | #### Android |
23 | 37 |
|
24 | | -1. Open up `android/app/src/main/java/[...]/MainActivity.java` |
25 | | - - Add `import com.apsl.interfacekit.RNIKInteractiveImageLibraryPackage;` to the imports at the top of the file |
26 | | - - Add `new RNIKInteractiveImageLibraryPackage()` to the list returned by the `getPackages()` method |
27 | | -2. Append the following lines to `android/settings.gradle`: |
28 | | - ``` |
29 | | - include ':react-native-interactive-image-library' |
30 | | - project(':react-native-interactive-image-library').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-interactive-image-library/android') |
31 | | - ``` |
32 | | -3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: |
33 | | - ``` |
34 | | - compile project(':react-native-interactive-image-library') |
35 | | - ``` |
36 | | - |
| 38 | +No additional setup needed. |
37 | 39 |
|
38 | 40 | ## Usage |
| 41 | + |
39 | 42 | ```javascript |
40 | | -import RNIKInteractiveImageLibrary from 'react-native-interactive-image-library'; |
| 43 | +import ImageBrowser from 'react-native-interactive-image-gallery'; |
41 | 44 |
|
42 | | -// TODO: What to do with the module? |
43 | | -RNIKInteractiveImageLibrary; |
| 45 | +class Images extends React.PureComponent<Props> { |
| 46 | + render() { |
| 47 | + const imageURLs: Array<Object> = this.props.images.map( |
| 48 | + (img: Object, index: number) => ({ |
| 49 | + URI: img.uri, |
| 50 | + id: String(index), |
| 51 | + title: img.title, |
| 52 | + description: img.description |
| 53 | + }) |
| 54 | + ); |
| 55 | + return <ImageBrowser images={imageURLs} />; |
| 56 | + } |
| 57 | +} |
44 | 58 | ``` |
45 | | - |
| 59 | + |
| 60 | +## API |
| 61 | + |
| 62 | +Work in progress. |
| 63 | + |
| 64 | +## License |
| 65 | + |
| 66 | +MIT. |
| 67 | + |
| 68 | +## Author |
| 69 | + |
| 70 | +Álvaro Medina Ballester `<amedina at apsl.net>` |
| 71 | + |
| 72 | +Built with 💛 by [APSL](https://github.com/apsl). |
0 commit comments