随便修改下

This commit is contained in:
Jerry Yan 2020-02-26 11:44:52 +08:00
parent 414d7e5e45
commit 9728ae88e2
7 changed files with 101 additions and 13 deletions

2
.gitignore vendored
View File

@ -65,3 +65,5 @@ buck-out/
*.idea
yarn*
**gradle*

14
android/README.md Normal file
View File

@ -0,0 +1,14 @@
README
======
If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
```
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
sdk.dir=/Users/{username}/Library/Android/sdk
```
3. Delete the `maven` folder
4. Run `./gradlew installArchives`
5. Verify that latest set of generated files is in the maven folder with the correct version number

View File

@ -1,5 +1,4 @@
<manifest
package="top.jerryyan.RN.A.FitFullScreen"
xmlns:android="http://schemas.android.com/apk/res/android">
<application/>
</manifest>
</manifest>

View File

@ -1,4 +1,26 @@
package top.jerryyan.RN.A.FitFullScreen;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
public class FitModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext reactContext;
public FitModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@Override
public String getName() {
return "Fit";
}
@ReactMethod
public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
// TODO: Implement some actually useful functionality
callback.invoke("Received numberArgument: " + numberArgument + " stringArgument: " + stringArgument);
}
}

View File

@ -0,0 +1,22 @@
package top.jerryyan.RN.A.FitFullScreen;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class FitPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(new FitModule(reactContext));
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}

View File

@ -1,28 +1,49 @@
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 28)
apply plugin: 'com.android.library'
apply plugin: 'maven'
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
minSdkVersion safeExtGet('minSdkVersion', 19)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
lintOptions {
abortOnError false
}
}
repositories {
// ref: https://www.baeldung.com/maven-local-repository
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
jcenter()
}
dependencies {

View File

@ -20,5 +20,13 @@
"bugs": {
"url": "http://git.jerryyan.top/q792602257/jerry-rn-a-fitfullscreen"
},
"homepage": "http://git.jerryyan.top/q792602257/jerry-rn-a-fitfullscreen"
"homepage": "http://git.jerryyan.top/q792602257/jerry-rn-a-fitfullscreen",
"peerDependencies": {
"react": "^16.8.1",
"react-native": ">=0.60.0-rc.0 <1.0.x"
},
"devDependencies": {
"react": "^16.9.0",
"react-native": "^0.61.5"
}
}