Skip to content

Commit a4cc6f4

Browse files
author
Edward Paget
committed
Initial Commit
0 parents  commit a4cc6f4

17 files changed

+908
-0
lines changed

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
# react-native-web-view-local-cache
3+
4+
## Getting started
5+
6+
`$ npm install react-native-web-view-local-cache --save`
7+
8+
### Mostly automatic installation
9+
10+
`$ react-native link react-native-web-view-local-cache`
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-web-view-local-cache` and add `RNWebViewLocalCache.xcodeproj`
19+
3. In XCode, in the project navigator, select your project. Add `libRNWebViewLocalCache.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.reactlibrary.RNWebViewLocalCachePackage;` to the imports at the top of the file
26+
- Add `new RNWebViewLocalCachePackage()` to the list returned by the `getPackages()` method
27+
2. Append the following lines to `android/settings.gradle`:
28+
```
29+
include ':react-native-web-view-local-cache'
30+
project(':react-native-web-view-local-cache').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-web-view-local-cache/android')
31+
```
32+
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
33+
```
34+
compile project(':react-native-web-view-local-cache')
35+
```
36+
37+
#### Windows
38+
[Read it! :D](https://github.com/ReactWindows/react-native)
39+
40+
1. In Visual Studio add the `RNWebViewLocalCache.sln` in `node_modules/react-native-web-view-local-cache/windows/RNWebViewLocalCache.sln` folder to their solution, reference from their app.
41+
2. Open up your `MainPage.cs` app
42+
- Add `using Cl.Json.RNWebViewLocalCache;` to the usings at the top of the file
43+
- Add `new RNWebViewLocalCachePackage()` to the `List<IReactPackage>` returned by the `Packages` method
44+
45+
46+
## Usage
47+
```javascript
48+
import RNWebViewLocalCache from 'react-native-web-view-local-cache';
49+
50+
// TODO: What do with the module?
51+
RNWebViewLocalCache;
52+
```
53+

android/build.gradle

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
apply plugin: 'com.android.library'
3+
4+
android {
5+
compileSdkVersion 23
6+
buildToolsVersion "23.0.1"
7+
8+
defaultConfig {
9+
minSdkVersion 16
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
ndk {
14+
abiFilters "armeabi-v7a", "x86"
15+
}
16+
}
17+
lintOptions {
18+
warning 'InvalidPackage'
19+
}
20+
}
21+
22+
dependencies {
23+
compile 'com.facebook.react:react-native:0.20.+'
24+
}
25+

android/src/main/AndroidManifest.xml

+6
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.reactlibrary">
4+
5+
</manifest>
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.reactlibrary;
2+
3+
import java.util.Arrays;
4+
import java.util.Collections;
5+
import java.util.List;
6+
7+
import com.facebook.react.ReactPackage;
8+
import com.facebook.react.bridge.NativeModule;
9+
import com.facebook.react.bridge.ReactApplicationContext;
10+
import com.facebook.react.uimanager.ViewManager;
11+
import com.facebook.react.bridge.JavaScriptModule;
12+
13+
public class RNWebViewLocalCachePackage implements ReactPackage {
14+
@Override
15+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16+
return Collections.emptyList();
17+
}
18+
19+
@Override
20+
public List<Class<? extends JavaScriptModule>> createJSModules() {
21+
return Collections.emptyList();
22+
}
23+
24+
@Override
25+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26+
return Arrays.<ViewManager>asList(new WebViewLocalCacheManager());
27+
}
28+
}

index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import { NativeModules } from 'react-native';
3+
4+
const { RNWebViewLocalCache } = NativeModules;
5+
6+
export default RNWebViewLocalCache;

ios/RNWebViewLocalCache.h

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
#import "RCTBridgeModule.h"
3+
4+
@interface RNWebViewLocalCache : NSObject <RCTBridgeModule>
5+
6+
@end
7+

ios/RNWebViewLocalCache.m

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

0 commit comments

Comments
 (0)