Skip to content

Commit

Permalink
Merge pull request #15 from archriss/dev
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
Exilz authored Sep 15, 2017
2 parents 4681ac6 + 6a63993 commit 1c474bd
Show file tree
Hide file tree
Showing 60 changed files with 4,236 additions and 107 deletions.
36 changes: 36 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"plugins": ["react"],
"extends": ["eslint:recommended", "plugin:react/recommended"]
},
"extends": [
"standard",
"standard-react"
],
"env": {
"browser": true
},
"globals": {
"__DEV__": false
},
"rules": {
"indent": [2, 4],
"generator-star-spacing": 0,
"react/jsx-indent": [0, 4],
"jsx-indent-props": [0, 4],
"react/jsx-curly-spacing": [0, "never"],
"react/jsx-boolean-value": [0, "never"],
"semi": [2, "always"],
"operator-linebreak": [2, "after"],
"no-warning-comments": [1, {
"terms": ["todo", "fixme", "xxx"],
"location": "start"
}]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
yarn.lock
package-lock.json
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Demo
18 changes: 18 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## v2.0.0

This is the first major update since we've taken over this project. It includes numerous changes, breaking changes, and perfs improvements.

Huge thanks to [@chrusart](https://github.com/chrusart) who started these changes and helped highlighting problems.

* **Breaking change** : remove the `loader`. Instead, you should use the `imageComponent` prop and implement your own image loading logic yourself so it doesn't affect the gallery's performance.
* A demo has been added ! It shows a basic usage of this module, with a slide counter on top and captions displayed at the bottom. Un-comment `addImages()` and `removeImages()` to check out the new improvements and fixes when the gallery re-renders.
* Refactor : `TransformableImage` and `ViewPager` dependencies are now backed-in the module. They weren't being maintained, so we won't have to wait for their respective pull requests to be merged. This allowed us to fix numerous bugs, faster.
* Refactor : Huge refactor of the whole codebase. We've rewritten a lot of code, most of the logic is intact but the library is now easier to read, and more importantly, it follows the good practices of react. There is still work to do, but most of it has been done.
* Removed the `initialListSize` prop. This was confusing, and it's not required anymore.
* Feature : the underlying `ListView` has been replaced with `FlatList` ! This should result in a significant improvement in performance.
* Feature : `errorComponent` prop. You can now provide a function to render the page of an image that couldn't be loaded. This is usually rendered with a remote image that has a broken URL.
* Feature : `scrollViewStyle` prop. Style the `FlatList` as you wish.
* Feature : you can now use the `dimensions` key in your remote images just like with your local images. That circumvents the `Image.getSize` logic, it's a little perf boost if you already know the dimensions of your remote images.
* Fix : the gallery won't crash if your remote image's URL is broken. It will now display a nice error that you can customize with the `errorComponent` prop.
* Fix : the gallery won't crash when adding or removing images.

## v1.1.0

* Feature : add `onLongPress` prop
Expand Down
3 changes: 3 additions & 0 deletions Demo/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
6 changes: 6 additions & 0 deletions Demo/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
45 changes: 45 additions & 0 deletions Demo/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/

[options]
emoji=true

module.system=haste

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.49.1
1 change: 1 addition & 0 deletions Demo/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
56 changes: 56 additions & 0 deletions Demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots

yarn.lock
package-lock.json
1 change: 1 addition & 0 deletions Demo/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
12 changes: 12 additions & 0 deletions Demo/__tests__/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'react-native';
import React from 'react';
import Index from '../index.android.js';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
12 changes: 12 additions & 0 deletions Demo/__tests__/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'react-native';
import React from 'react';
import Index from '../index.ios.js';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
65 changes: 65 additions & 0 deletions Demo/android/app/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#

lib_deps = []

for jarfile in glob(['libs/*.jar']):
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)

for aarfile in glob(['libs/*.aar']):
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)

android_library(
name = "all-libs",
exported_deps = lib_deps,
)

android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)

android_build_config(
name = "build_config",
package = "com.demo",
)

android_resource(
name = "res",
package = "com.demo",
res = "src/main/res",
)

android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)
Loading

0 comments on commit 1c474bd

Please sign in to comment.