Skip to content

Commit

Permalink
- Migrating rn to 0.55.4
Browse files Browse the repository at this point in the history
- Migrating gradle to 3.0.1
- Hot fix's in android native wrapper
  • Loading branch information
prscms committed May 20, 2018
1 parent 17df27f commit dc7f707
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 24 deletions.
9 changes: 5 additions & 4 deletions Example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.shinebuttonexample"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
Expand Down Expand Up @@ -151,6 +151,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
Expand All @@ -159,7 +160,7 @@ dependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-shine-button')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:25.1.1"
compile "com.android.support:appcompat-v7:27.0.2"
compile "com.facebook.react:react-native:+" // From node_modules
}

Expand Down
4 changes: 3 additions & 1 deletion Example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,6 +17,7 @@ allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
Expand Down
4 changes: 2 additions & 2 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"test": "jest"
},
"dependencies": {
"react": "16.2.0",
"react-native": "0.52.0",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-shine-button": "../"
},
"devDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

<p align="center">
<img src="https://raw.githubusercontent.com/ChadCSong/ShineButton/master/demo_shine_others.gif" height="300" width="600" >
<img src="https://raw.githubusercontent.com/ChadCSong/ShineButton/master/demo_shine_others.gif" height="300" >
</p>

<p align="center">
<img src="./assets/hero.gif" height="300" width="600" >
<img src="./assets/hero.gif" height="300" >
</p>


Expand Down Expand Up @@ -44,6 +44,7 @@ jackOptions {
buildscript {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
Expand All @@ -52,10 +53,13 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
```
> **Note:** This library is supported on Android SDK 27 > above

#### iOS
- Run Command: `cd ../node_modules/react-native-shine-button/ios && pod install`. If it has error => try `pod repo update` then `pod install`
Expand Down
2 changes: 1 addition & 1 deletion android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Sun Apr 01 13:42:25 IST 2018
#Sun May 20 10:13:11 IST 2018
connection.project.dir=
40 changes: 40 additions & 0 deletions android/bin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

buildscript {
repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}

repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.sackcentury:shinebutton:d992d780328ae8ccce3e9ea4acfeef69186986d3'
// compile 'com.github.prscX:ShineButton:0.2.1'
}
12 changes: 7 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
buildscript {
repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
Expand All @@ -28,11 +29,12 @@ android {

repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.facebook.react:react-native:+'
// compile 'com.sackcentury:shinebutton:0.2.0'
// compile 'com.sackcentury:shinebutton:d992d780328ae8ccce3e9ea4acfeef69186986d3'
compile 'com.github.prscX:ShineButton:0.2.1'
}
8 changes: 5 additions & 3 deletions android/src/main/java/ui/shine/RNShineButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public void setShape(FrameLayout shineButtonFrame, ReadableMap shapeProps) {


private Drawable generateVectorIcon(ReadableMap icon) {
Context context = reactContext.getApplicationContext();

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

Expand All @@ -169,11 +171,11 @@ private Drawable generateVectorIcon(ReadableMap icon) {
String color = icon.getString("color");
int size = icon.getInt("size");

float scale = reactContext.getResources().getDisplayMetrics().density;
float scale = context.getResources().getDisplayMetrics().density;
String scaleSuffix = "@" + (scale == (int) scale ? Integer.toString((int) scale) : Float.toString(scale)) + "x";
int fontSize = Math.round(size * scale);

Typeface typeface = ReactFontManager.getInstance().getTypeface(family, 0, reactContext.getAssets());
Typeface typeface = ReactFontManager.getInstance().getTypeface(family, 0, context.getAssets());
Paint paint = new Paint();
paint.setTypeface(typeface);
paint.setColor(Color.parseColor(color));
Expand All @@ -186,6 +188,6 @@ private Drawable generateVectorIcon(ReadableMap icon) {
Canvas canvas = new Canvas(bitmap);
canvas.drawText(glyph, -textBounds.left, -textBounds.top, paint);

return new BitmapDrawable(reactContext.getResources(), bitmap);
return new BitmapDrawable(context.getResources(), bitmap);
}
}
3 changes: 0 additions & 3 deletions android/src/main/java/ui/shine/RNShineButtonModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@

public class RNShineButtonModule extends ReactContextBaseJavaModule {

private final ReactApplicationContext reactContext;

public RNShineButtonModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
"name": "react-native-shine-button",
"version": "0.0.8",
"version": "0.0.9",
"description":
"React Native Bridge for ChadCSong/ShineButton & imwcl/WCLShineButton",
"main": "js/RNShineButton.js",
Expand All @@ -15,10 +15,10 @@
"keywords": ["react-native"],
"author": "Pranav Raj Singh Chauhan",
"dependencies": {
"react-native-vector-icons": "4.5.0"
"react-native-vector-icons": "4.6.0"
},
"devDependencies": {
"prettier-pack": "0.0.4"
"prettier-pack": "0.0.6"
},
"license": "MIT"
}

0 comments on commit dc7f707

Please sign in to comment.