Skip to content

Commit 4f08e43

Browse files
committed
initial commit
1 parent 178774c commit 4f08e43

File tree

12 files changed

+477
-1
lines changed

12 files changed

+477
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
# react-native-progress-bar-android
1+
2+
# react-native-androidprogressbar
3+
4+
## Getting started
5+
6+
`$ npm install react-native-androidprogressbar --save`
7+
8+
### Mostly automatic installation
9+
10+
`$ react-native link react-native-androidprogressbar`
11+
12+
### Manual installation
13+
14+
15+
#### iOS
16+
17+
1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
18+
2. Go to `node_modules``react-native-androidprogressbar` and add `RNCAndroidprogressbar.xcodeproj`
19+
3. In XCode, in the project navigator, select your project. Add `libRNCAndroidprogressbar.a` to your project's `Build Phases``Link Binary With Libraries`
20+
4. Run your project (`Cmd+R`)<
21+
22+
#### Android
23+
24+
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
25+
- Add `import com.reactnativecommunity.androidprogressbar.RNCAndroidprogressbarPackage;` to the imports at the top of the file
26+
- Add `new RNCAndroidprogressbarPackage()` to the list returned by the `getPackages()` method
27+
2. Append the following lines to `android/settings.gradle`:
28+
```
29+
include ':react-native-androidprogressbar'
30+
project(':react-native-androidprogressbar').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-androidprogressbar/android')
31+
```
32+
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
33+
```
34+
compile project(':react-native-androidprogressbar')
35+
```
36+
37+
38+
## Usage
39+
```javascript
40+
import RNCAndroidprogressbar from 'react-native-androidprogressbar';
41+
42+
// TODO: What to do with the module?
43+
RNCAndroidprogressbar;
44+
```
45+

android/build.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
buildscript {
3+
repositories {
4+
jcenter()
5+
}
6+
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:1.3.1'
9+
}
10+
}
11+
12+
apply plugin: 'com.android.library'
13+
14+
android {
15+
compileSdkVersion 23
16+
buildToolsVersion "23.0.1"
17+
18+
defaultConfig {
19+
minSdkVersion 16
20+
targetSdkVersion 22
21+
versionCode 1
22+
versionName "1.0"
23+
}
24+
lintOptions {
25+
abortOnError false
26+
}
27+
}
28+
29+
repositories {
30+
mavenCentral()
31+
}
32+
33+
dependencies {
34+
compile 'com.facebook.react:react-native:+'
35+
}
36+

android/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.reactnativecommunity.androidprogressbar">
4+
5+
</manifest>
6+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
package com.reactnativecommunity.androidprogressbar;
3+
4+
import com.facebook.react.bridge.ReactApplicationContext;
5+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
6+
import com.facebook.react.bridge.ReactMethod;
7+
import com.facebook.react.bridge.Callback;
8+
9+
public class RNCAndroidprogressbarModule extends ReactContextBaseJavaModule {
10+
11+
private final ReactApplicationContext reactContext;
12+
13+
public RNCAndroidprogressbarModule(ReactApplicationContext reactContext) {
14+
super(reactContext);
15+
this.reactContext = reactContext;
16+
}
17+
18+
@Override
19+
public String getName() {
20+
return "RNCAndroidprogressbar";
21+
}
22+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
package com.reactnativecommunity.androidprogressbar;
3+
4+
import java.util.Arrays;
5+
import java.util.Collections;
6+
import java.util.List;
7+
8+
import com.facebook.react.ReactPackage;
9+
import com.facebook.react.bridge.NativeModule;
10+
import com.facebook.react.bridge.ReactApplicationContext;
11+
import com.facebook.react.uimanager.ViewManager;
12+
import com.facebook.react.bridge.JavaScriptModule;
13+
public class RNCAndroidprogressbarPackage implements ReactPackage {
14+
@Override
15+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16+
return Arrays.<NativeModule>asList(new RNCAndroidprogressbarModule(reactContext));
17+
}
18+
19+
// Deprecated from RN 0.47
20+
public List<Class<? extends JavaScriptModule>> createJSModules() {
21+
return Collections.emptyList();
22+
}
23+
24+
@Override
25+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26+
return Collections.emptyList();
27+
}
28+
}

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import { NativeModules } from 'react-native';
3+
4+
const { RNCAndroidprogressbar } = NativeModules;
5+
6+
export default RNCAndroidprogressbar;

ios/RNCAndroidprogressbar.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
#if __has_include("RCTBridgeModule.h")
3+
#import "RCTBridgeModule.h"
4+
#else
5+
#import <React/RCTBridgeModule.h>
6+
#endif
7+
8+
@interface RNCAndroidprogressbar : NSObject <RCTBridgeModule>
9+
10+
@end
11+

ios/RNCAndroidprogressbar.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#import "RNCAndroidprogressbar.h"
3+
4+
@implementation RNCAndroidprogressbar
5+
6+
- (dispatch_queue_t)methodQueue
7+
{
8+
return dispatch_get_main_queue();
9+
}
10+
RCT_EXPORT_MODULE()
11+
12+
@end
13+

ios/RNCAndroidprogressbar.podspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Pod::Spec.new do |s|
3+
s.name = "RNCAndroidprogressbar"
4+
s.version = "1.0.0"
5+
s.summary = "RNCAndroidprogressbar"
6+
s.description = <<-DESC
7+
RNCAndroidprogressbar
8+
DESC
9+
s.homepage = ""
10+
s.license = "MIT"
11+
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
12+
s.author = { "author" => "[email protected]" }
13+
s.platform = :ios, "7.0"
14+
s.source = { :git => "https://github.com/author/RNCAndroidprogressbar.git", :tag => "master" }
15+
s.source_files = "RNCAndroidprogressbar/**/*.{h,m}"
16+
s.requires_arc = true
17+
18+
19+
s.dependency "React"
20+
#s.dependency "others"
21+
22+
end
23+
24+

0 commit comments

Comments
 (0)