Skip to content

Commit edf5b98

Browse files
committed
new: blurRadius prop is available. A bit code fixes and new example
1 parent 138f389 commit edf5b98

38 files changed

Lines changed: 14872 additions & 3829 deletions

.eslintrc.js

Lines changed: 67 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,77 @@
11
module.exports = {
22
root: true,
3-
extends: [
4-
"@react-native-community",
5-
"airbnb-typescript",
6-
"prettier",
7-
"prettier/@typescript-eslint",
8-
"prettier/react"
9-
],
10-
parser: "babel-eslint",
11-
plugins: ["react", "react-native"],
12-
env: {
13-
jest: true,
14-
"react-native/react-native": true
3+
extends: "@react-native-community",
4+
parser: "@typescript-eslint/parser",
5+
plugins: ["import", "eslint-plugin-import", "@typescript-eslint"],
6+
settings: {
7+
"import/resolver": {
8+
node: {
9+
extensions: [
10+
".js",
11+
".jsx",
12+
".ts",
13+
".tsx",
14+
".d.ts",
15+
".android.js",
16+
".android.jsx",
17+
".android.ts",
18+
".android.tsx",
19+
".ios.js",
20+
".ios.jsx",
21+
".ios.ts",
22+
".ios.tsx",
23+
".web.js",
24+
".web.jsx",
25+
".web.ts",
26+
".web.tsx",
27+
],
28+
},
29+
},
1530
},
1631
rules: {
17-
// allow js file extension
18-
"react/jsx-filename-extension": [
32+
quotes: [
1933
"error",
34+
"double",
2035
{
21-
extensions: [".js", ".jsx", ".tsx", ".ts"]
22-
}
36+
avoidEscape: true,
37+
},
2338
],
24-
// for post defining style object in react-native
25-
"no-use-before-define": ["error", { variables: false }],
26-
// react-native rules
39+
"max-len": ["error", 120],
40+
"@typescript-eslint/ban-ts-comment": 2,
41+
"@typescript-eslint/no-explicit-any": 2,
42+
"@typescript-eslint/explicit-module-boundary-types": 0,
43+
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
2744
"react-native/no-unused-styles": 2,
2845
"react-native/split-platform-components": 2,
29-
"react-native/no-inline-styles": 2,
30-
"react-native/no-raw-text": 2
31-
}
46+
"react-native/no-inline-styles": 0,
47+
"react-native/no-color-literals": 0,
48+
"react-native/no-raw-text": 0,
49+
"import/no-extraneous-dependencies": 2,
50+
"import/extensions": ["error", "never", { svg: "always" }],
51+
"import/no-named-as-default-member": 2,
52+
"import/order": ["error", { "newlines-between": "always" }],
53+
"import/no-duplicates": 2,
54+
"import/no-useless-path-segments": 2,
55+
"import/no-cycle": 2,
56+
"import/prefer-default-export": 0,
57+
"import/no-anonymous-default-export": 0,
58+
"import/named": 0,
59+
"@typescript-eslint/no-empty-interface": 0,
60+
"import/namespace": 0,
61+
"import/default": 0,
62+
"import/no-named-as-default": 0,
63+
"import/no-unused-modules": 0,
64+
"import/no-deprecated": 0,
65+
"@typescript-eslint/indent": 0,
66+
"react-hooks/rules-of-hooks": 2,
67+
"react-hooks/exhaustive-deps": [
68+
"error",
69+
{ additionalHooks: "(useMemoOne)" },
70+
],
71+
"jest/no-identical-title": 2,
72+
"jest/valid-expect": 2,
73+
camelcase: 2,
74+
"prefer-destructuring": 2,
75+
"no-nested-ternary": 2,
76+
},
3277
};

.gitignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
#
33
.DS_Store
44

5-
package-lock.json
6-
7-
node_modules
8-
95
# Xcode
106
#
117
build/
@@ -24,7 +20,6 @@ DerivedData
2420
*.hmap
2521
*.ipa
2622
*.xcuserstate
27-
project.xcworkspace
2823

2924
# Android/IntelliJ
3025
#
@@ -34,6 +29,10 @@ build/
3429
local.properties
3530
*.iml
3631

32+
# Visual Studio Code
33+
#
34+
.vscode/
35+
3736
# node.js
3837
#
3938
node_modules/
@@ -44,6 +43,7 @@ yarn-error.log
4443
buck-out/
4544
\.buckd/
4645
*.keystore
46+
!debug.keystore
4747

4848
# fastlane
4949
#
@@ -58,3 +58,6 @@ buck-out/
5858

5959
# Bundle artifact
6060
*.jsbundle
61+
62+
# CocoaPods
63+
/ios/Pods/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ useNativeDriver?: boolean;
7777
| loadingSource | ImageSourcePropType | undefined | set the error source of the image |
7878
| errorSource | ImageSourcePropType | undefined | set the loading source of the image |
7979
| loadingImageComponent | Component | default | WARNING: Read the below! |
80+
| blurRadius | number | 15 | change the blur radius level |
8081

8182
### `loadingImageComponent` Usage
8283

example/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files
2+
[*.bat]
3+
end_of_line = crlf

example/.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native-community',
4-
parser: '@typescript-eslint/parser',
5-
plugins: ['@typescript-eslint'],
64
};

example/.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*.pbxproj -text
1+
# Windows files should use crlf line endings
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
*.bat text eol=crlf

example/.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ build/
2929
local.properties
3030
*.iml
3131

32-
# Visual Studio Code
33-
#
34-
.vscode/
35-
3632
# node.js
3733
#
3834
node_modules/

example/.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
arrowParens: 'avoid',
7+
};

example/App.tsx

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,64 @@
1-
import React from "react";
2-
import { StatusBar, FlatList, Dimensions } from "react-native";
3-
import ProgressiveImage from "@freakycoder/react-native-progressive-fast-image";
4-
const { width: ScreenWidth } = Dimensions.get("window");
1+
import React from 'react';
2+
import {StatusBar, FlatList, Dimensions} from 'react-native';
3+
// import ProgressiveImage from "@freakycoder/react-native-progressive-fast-image";
4+
import ProgressiveImage from './build/dist/ProgressiveFastImage';
5+
const {width: ScreenWidth} = Dimensions.get('window');
56
console.disableYellowBox = true;
67

78
const images = [
89
{
9-
uri:
10-
"https://images.unsplash.com/photo-1544627836-e63eb27c6e09?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjQzMzEwfQ&auto=format&fit=crop&w=2100&q=80",
10+
uri: 'https://images.unsplash.com/photo-1544627836-e63eb27c6e09?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjQzMzEwfQ&auto=format&fit=crop&w=2100&q=80',
1111
},
1212
{
13-
uri:
14-
"https://images.unsplash.com/photo-1544621660-1a179ba542a9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
13+
uri: 'https://images.unsplash.com/photo-1544621660-1a179ba542a9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
1514
},
1615
{
17-
uri:
18-
"https://images.unsplash.com/photo-1544945582-3b466d874eac?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2389&q=80",
16+
uri: 'https://images.unsplash.com/photo-1544945582-3b466d874eac?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2389&q=80',
1917
},
2018
{
21-
uri:
22-
"https://images.unsplash.com/photo-1544979407-1204ff29f490?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
19+
uri: 'https://images.unsplash.com/photo-1544979407-1204ff29f490?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
2320
},
2421
{
25-
uri:
26-
"https://images.unsplash.com/photo-1544807459-eb0ae8cda3e0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2110&q=80",
22+
uri: 'https://images.unsplash.com/photo-1544807459-eb0ae8cda3e0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2110&q=80',
2723
},
2824
{
29-
uri:
30-
"https://images.unsplash.com/photo-1544954617-f5c6b0d16164?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2064&q=80",
25+
uri: 'https://images.unsplash.com/photo-1544954617-f5c6b0d16164?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2064&q=80',
3126
},
3227
{
33-
uri:
34-
"https://images.unsplash.com/photo-1544914118-b7a55a9ecca6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
28+
uri: 'https://images.unsplash.com/photo-1544914118-b7a55a9ecca6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
3529
},
3630
{
37-
uri:
38-
"https://images.unsplash.com/photo-1544913776-90c1223073a3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2102&q=80",
31+
uri: 'https://images.unsplash.com/photo-1544913776-90c1223073a3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2102&q=80',
3932
},
4033
{
41-
uri:
42-
"https://images.unsplash.com/photo-1545128309-686a71a99f76?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
34+
uri: 'https://images.unsplash.com/photo-1545128309-686a71a99f76?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
4335
},
4436
{
45-
uri:
46-
"https://images.unsplash.com/photo-1545140976-8c17471ba12d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2340&q=80",
37+
uri: 'https://images.unsplash.com/photo-1545140976-8c17471ba12d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2340&q=80',
4738
},
4839
{
49-
uri:
50-
"https://images.unsplash.com/photo-1545105511-839f4a45a030?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
40+
uri: 'https://images.unsplash.com/photo-1545105511-839f4a45a030?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
5141
},
5242
{
53-
uri:
54-
"https://images.unsplash.com/photo-1545079968-1feb95494244?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1867&q=80",
43+
uri: 'https://images.unsplash.com/photo-1545079968-1feb95494244?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1867&q=80',
5544
},
5645
{
57-
uri:
58-
"https://images.unsplash.com/photo-1545128337-6c5cf2684520?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
46+
uri: 'https://images.unsplash.com/photo-1545128337-6c5cf2684520?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
5947
},
6048
{
61-
uri:
62-
"https://images.unsplash.com/photo-1544933411-f64b01485fd3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2102&q=80",
49+
uri: 'https://images.unsplash.com/photo-1544933411-f64b01485fd3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2102&q=80',
6350
},
6451
{
65-
uri:
66-
"https://images.unsplash.com/photo-1544177817-454e1238e05f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80",
52+
uri: 'https://images.unsplash.com/photo-1544177817-454e1238e05f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80',
6753
},
6854
{
69-
uri:
70-
"https://images.unsplash.com/photo-1544946632-b73cacef16ad?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2389&q=80",
55+
uri: 'https://images.unsplash.com/photo-1544946632-b73cacef16ad?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2389&q=80',
7156
},
7257
];
7358

7459
const App = () => {
7560
const renderItem = (data: any) => {
76-
const { item, index } = data;
61+
const {item, index} = data;
7762

7863
return (
7964
<ProgressiveImage
@@ -87,10 +72,10 @@ const App = () => {
8772
loadingImageStyle={{
8873
width: 50,
8974
height: 50,
90-
alignSelf: "center",
75+
alignSelf: 'center',
9176
}}
9277
imageAnimationDuration={10000}
93-
loadingSource={require("./assets/loading3.gif")}
78+
loadingSource={require('./assets/loading3.gif')}
9479
/>
9580
);
9681
};

example/android/app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
121121
def enableHermes = project.ext.react.get("enableHermes", false);
122122

123123
android {
124+
ndkVersion rootProject.ext.ndkVersion
125+
124126
compileSdkVersion rootProject.ext.compileSdkVersion
125127

126128
compileOptions {
@@ -169,11 +171,12 @@ android {
169171
variant.outputs.each { output ->
170172
// For each separate APK per architecture, set a unique version code as described here:
171173
// https://developer.android.com/studio/build/configure-apk-splits.html
174+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
172175
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
173176
def abi = output.getFilter(OutputFile.ABI)
174177
if (abi != null) { // null for the universal-debug, universal-release variants
175178
output.versionCodeOverride =
176-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
179+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
177180
}
178181

179182
}

0 commit comments

Comments
 (0)