Skip to content

Commit d354bcf

Browse files
committed
- migrating to RN61+
1 parent df8dd00 commit d354bcf

File tree

9 files changed

+60
-177
lines changed

9 files changed

+60
-177
lines changed

android/build.gradle

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11

2+
apply plugin: 'com.android.library'
3+
4+
def safeExtGet(prop, fallback) {
5+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
6+
}
7+
28
buildscript {
3-
repositories {
4-
jcenter()
5-
maven { url "https://maven.google.com" }
6-
}
9+
if (project == rootProject) {
10+
repositories {
11+
google()
12+
jcenter()
13+
}
714

8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.0.1'
15+
dependencies {
16+
classpath("com.android.tools.build:gradle:3.5.3")
17+
}
1018
}
1119
}
1220

13-
apply plugin: 'com.android.library'
14-
1521
android {
16-
compileSdkVersion 27
17-
buildToolsVersion "27.0.3"
22+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
23+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
1824

1925
defaultConfig {
20-
minSdkVersion 16
21-
targetSdkVersion 27
26+
minSdkVersion safeExtGet('minSdkVersion', 16)
27+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
2228
versionCode 1
2329
versionName "1.0"
2430
}
@@ -28,13 +34,12 @@ android {
2834
}
2935

3036
repositories {
31-
jcenter()
32-
maven { url "https://maven.google.com" }
33-
maven { url "https://jitpack.io" }
37+
google()
38+
mavenCentral()
39+
maven { url 'https://jitpack.io' }
3440
}
3541

3642
dependencies {
3743
implementation 'com.facebook.react:react-native:+'
38-
// compile 'com.sackcentury:shinebutton:d992d780328ae8ccce3e9ea4acfeef69186986d3'
3944
implementation 'com.github.prscX:ShineButton:0.2.1'
40-
}
45+
}

android/src/main/java/ui/shine/RNShineButton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import android.graphics.drawable.BitmapDrawable;
1515
import android.graphics.drawable.Drawable;
1616
import android.os.StrictMode;
17-
import android.support.annotation.DrawableRes;
17+
import androidx.annotation.DrawableRes;
1818
import android.util.AttributeSet;
1919
import android.view.Gravity;
2020
import android.view.View;

ios/Podfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

ios/RNShineButton.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#endif
77

88
#import <WCLShineButton/WCLShineButton-Swift.h>
9+
#import <React/RCTComponentEvent.h>
910

1011
@interface RNShineButton : RCTViewManager
1112

ios/RNShineButton.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
#import "RNShineButton.h"
33

4-
54
@implementation RNShineButton
65

76
- (dispatch_queue_t)methodQueue
@@ -23,7 +22,11 @@ - (void)handleTap:(UITapGestureRecognizer *)recognizer
2322
@"value": selection ? @"YES" : @"NO",
2423
@"name": @"tap",
2524
};
26-
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
25+
26+
RCTComponentEvent *cEvent = [[RCTComponentEvent alloc] initWithName:@"topChange"
27+
viewTag:shineButton.reactTag
28+
body:event];
29+
[self.bridge.eventDispatcher sendEvent:cEvent];
2730
}
2831

2932
- (WCLShineButton *)view {

ios/RNShineButton.podspec

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
require 'json'
22

3-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
3+
package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
44

55
Pod::Spec.new do |s|
6-
s.name = "RNShineButton"
7-
s.version = package['version']
8-
s.summary = package['description']
9-
s.description = package["description"]
10-
s.homepage = "n/a"
11-
s.license = package['license']
12-
s.author = package['author']
13-
s.platform = :ios, "9.0"
14-
s.ios.deployment_target = '9.0'
15-
s.library = 'z'
16-
s.preserve_paths = '*.js'
17-
s.source = { :git => "https://github.com/author/RNShineButton.git", :tag => "master" }
18-
s.source_files = "RNShineButton/**/*.{h,m}"
19-
s.requires_arc = true
20-
s.static_framework = true
6+
s.name = 'RNShineButton'
7+
s.version = package['version']
8+
s.summary = package['description']
9+
s.description = package['description']
10+
s.homepage = package['homepage']
11+
s.license = package['license']
12+
s.author = package['author']
13+
s.source = { :git => 'https://github.com/prscX/react-native-shine-button.git', :tag => s.version }
2114

15+
s.platform = :ios, '9.0'
16+
s.ios.deployment_target = '8.0'
2217

23-
s.dependency "React"
24-
#s.dependency "others"
25-
26-
end
27-
28-
18+
s.preserve_paths = 'LICENSE', 'package.json'
19+
s.source_files = '**/*.{h,m}'
20+
s.dependency 'React'
21+
s.dependency 'WCLShineButton'
22+
end

js/RNVectorHelper.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,34 @@ import ZocialGlyphMap from "react-native-vector-icons/glyphmaps/Zocial.json";
1212

1313
import { Platform } from "react-native";
1414

15+
1516
class RNVectorHelper {
1617
static Resolve(family, name) {
17-
let glyph, fontFamily;
18+
let glyph, fontFamily
1819

1920
switch (family) {
2021
case "Entypo":
2122
glyph = EntypoGlyphMap[name];
2223
if (typeof glyph === "number") {
2324
glyph = String.fromCharCode(glyph);
2425
}
25-
fontFamily = "Entypo";
26+
fontFamily = "Entypo"
2627

2728
return { glyph: glyph, family: fontFamily };
2829
case "EvilIcons":
2930
glyph = EvilIconsGlyphMap[name];
3031
if (typeof glyph === "number") {
3132
glyph = String.fromCharCode(glyph);
3233
}
33-
fontFamily = "EvilIcons";
34+
fontFamily = "EvilIcons"
3435

3536
return { glyph: glyph, family: fontFamily };
3637
case "Feather":
3738
glyph = FeatherGlyphMap[name];
3839
if (typeof glyph === "number") {
3940
glyph = String.fromCharCode(glyph);
4041
}
41-
fontFamily = "Feather";
42+
fontFamily = "Feather"
4243

4344
return { glyph: glyph, family: fontFamily };
4445
case "FontAwesome":
@@ -56,7 +57,7 @@ class RNVectorHelper {
5657
}
5758

5859
if (Platform.OS === "ios") {
59-
fontFamily = "fontcustom";
60+
fontFamily = "fontcustom"
6061
} else {
6162
fontFamily = "Foundation";
6263
}
@@ -67,7 +68,7 @@ class RNVectorHelper {
6768
if (typeof glyph === "number") {
6869
glyph = String.fromCharCode(glyph);
6970
}
70-
fontFamily = "Ionicons";
71+
fontFamily = "Ionicons"
7172

7273
return { glyph: glyph, family: fontFamily };
7374
case "MaterialCommunityIcons":
@@ -77,7 +78,7 @@ class RNVectorHelper {
7778
}
7879

7980
if (Platform.OS === "ios") {
80-
fontFamily = "Material Design Icons";
81+
fontFamily = "Material Design Icons"
8182
} else {
8283
fontFamily = "MaterialCommunityIcons";
8384
}
@@ -90,7 +91,7 @@ class RNVectorHelper {
9091
}
9192

9293
if (Platform.OS === "ios") {
93-
fontFamily = "Material Icons";
94+
fontFamily = "Material Icons"
9495
} else {
9596
fontFamily = "MaterialIcons";
9697
}
@@ -110,10 +111,10 @@ class RNVectorHelper {
110111
glyph = String.fromCharCode(glyph);
111112
}
112113

113-
if (Platform.OS === "ios") {
114+
if (Platform.OS === 'ios') {
114115
fontFamily = "simple-line-icons";
115116
} else {
116-
fontFamily = "SimpleLineIcons";
117+
fontFamily = "SimpleLineIcons"
117118
}
118119

119120
return { glyph: glyph, family: fontFamily };
@@ -134,4 +135,4 @@ class RNVectorHelper {
134135
}
135136
}
136137

137-
export default RNVectorHelper;
138+
export default RNVectorHelper;

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "react-native-shine-button",
3-
"version": "0.0.12",
3+
"version": "1.0.0",
44
"description": "React Native Bridge for ChadCSong/ShineButton & imwcl/WCLShineButton",
55
"main": "js/RNShineButton.js",
6+
"homepage": "https://github.com/prscX/react-native-shine-button.git",
67
"repository": {
78
"type": "git",
89
"url": "https://github.com/prscX/react-native-shine-button.git"
910
},
1011
"scripts": {
11-
"test": "echo \"Error: no test specified\" && exit 1",
12-
"postinstall": "node scripts/installer.js"
12+
"test": "echo \"Error: no test specified\" && exit 1"
1313
},
1414
"keywords": [
1515
"react-native"

scripts/installer.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)