Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected String getMainComponentName() {
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override

protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
Expand All @@ -31,7 +31,7 @@ protected boolean getUseDeveloperSupport() {
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override

protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
Expand Down
73 changes: 69 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,78 @@ A full screen image gallery with captions, selections and grid view support for

The component has both iOS and Android support.

### Neogrowth Contribution
Neogrowth bring the support for zoom in and zoom out of the image and some minor bug fixes are taken care. For which the following is the dependency.

[react-native-photo-view](https://github.com/alwx/react-native-photo-view/)



![](screenshots/photo-browser.gif)

![](screenshots/screenshot-1.png)
![](screenshots/screenshot-2.png)

### Installation
```npm install react-native-photo-browser --save```
### Installation
```npm install https://github.com/NeoGrowth-Credit-Pvt-Limited/react-native-photo-browser.git --save```

#### android/settings.gradle
Add the following line

include ':react-native-photo-view'
project(':react-native-photo-view').projectDir = file('../node_modules/react-native-photo-view/android')

#### android/build.gradle
add `compile project` in dependencies

dependencies {
.
.
compile project(':react-native-photo-view')
}

#### android/app/build.gradle
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://jitpack.io" } // <-- Add this
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}

#### MainApplication.java

import com.reactnative.photoview.PhotoViewPackage; // add this import
public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSimpleAlertDialogPackage(),
.
.
.
new PhotoViewPackage() // add this manager
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}

### Properties

Expand Down Expand Up @@ -46,7 +111,7 @@ const media = {

#### Android

Built-in [ProgressBarAndroid](https://facebook.github.io/react-native/docs/progressbarandroid.html) component is used for Android. Any additional configuration is not needed.
Built-in [ActivityIndicator](https://facebook.github.io/react-native/docs/activityindicator.html) component is used for Android. Any additional configuration is not needed. [ProgressBarAndroid](https://facebook.github.io/react-native/docs/progressbarandroid.html) is deprecated now.

#### iOS

Expand All @@ -62,7 +127,7 @@ See [PhotoBrowserExample.js](Example/PhotoBrowserExample.js) file.

Follow those steps to run the example:

1. Clone the repo `git clone https://github.com/halilb/react-native-photo-browser && cd react-native-photo-browser/Example`
1. Clone the repo `git clone https://github.com/NeoGrowth-Credit-Pvt-Limited/react-native-photo-browser/Example`
2. Install dependencies `npm install`
3. Follow [official instructions](https://facebook.github.io/react-native/docs/getting-started.html) to run the example project in a simulator or device.

Expand Down
27 changes: 15 additions & 12 deletions lib/media/Photo.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { PropTypes, Component } from 'react';
import {
Dimensions,
Image,
StyleSheet,
View,
TouchableWithoutFeedback,
ProgressBarAndroid,
ActivityIndicator,
Platform,
Image
} from 'react-native';

import * as Progress from 'react-native-progress';
import PhotoView from 'react-native-photo-view';

export default class Photo extends Component {

Expand Down Expand Up @@ -150,7 +151,7 @@ export default class Photo extends Component {
}

if (Platform.OS === 'android') {
return <ProgressBarAndroid progress={progress} />;
return <ActivityIndicator progress={progress} />;
}

const ProgressElement = useCircleProgress ? Progress.Circle : Progress.Bar;
Expand Down Expand Up @@ -239,15 +240,17 @@ export default class Photo extends Component {
return (
<View style={[styles.container, sizeStyle]}>
{error ? this._renderErrorIcon() : this._renderProgressIndicator()}
<Image
{...this.props}
style={[styles.image, sizeStyle]}
source={source}
onProgress={this._onProgress}
onError={this._onError}
onLoad={this._onLoad}
resizeMode={resizeMode}
/>
<PhotoView
{...this.props}
source={source}
minimumZoomScale={0.5}
maximumZoomScale={3}
androidScaleType="center"
onProgress={this._onProgress}
onError={this._onError}
onLoad={this._onLoad}
style={[styles.image, sizeStyle]}
resizeMode={resizeMode} />
{this._renderSelectionButton()}
</View>
);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"author": "Halil Bilir <hbilir@gmail.com>",
"homepage": "https://github.com/halilb/react-native-photo-browser#readme",
"dependencies": {
"react-native-progress": "^3.0.0"
"react-native-progress": "^3.0.0",
"react-native-photo-view": "^1.2.0"
}
}