mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-11 22:33:32 +08:00
* Let UINavController control subcontroller view's frames. This PR changes the way we've been handling yoga <> NavController layout interactions. Now we ignore frame updates coming from react for the main Screen view to allow NavController take the controll. In order to keep yoga working we now use `setSize` to pass the dimensions of the view back to yoga such that it can properly calculate layout of the views under Screen component. * Header resizing fixes for Android. In this change we use CoordinatorLayout as a stack screen container to handle rendering of toolbar and screen content. Thanks to this approach we can support collapsable bars in the future. Instead of relying on RN to layout screen container when renered under ScreenStack we rely on Android native layout to measure and position screen content and then use UIManager.setNodeSize to communicate that back to react.
126 lines
3.4 KiB
Groovy
126 lines
3.4 KiB
Groovy
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.3.1'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: 'maven'
|
|
|
|
def safeExtGet(prop, fallback) {
|
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion safeExtGet('compileSdkVersion', 28)
|
|
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
|
|
|
|
defaultConfig {
|
|
minSdkVersion safeExtGet('minSdkVersion', 16)
|
|
targetSdkVersion safeExtGet('targetSdkVersion', 22)
|
|
versionCode 1
|
|
versionName "1.0"
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
// Matches the RN Hello World template
|
|
// https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/local-cli/templates/HelloWorld/android/build.gradle#L21
|
|
url "$projectDir/../node_modules/react-native/android"
|
|
}
|
|
mavenCentral()
|
|
mavenLocal()
|
|
google()
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.facebook.react:react-native:+'
|
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
|
|
implementation 'com.google.android.material:material:1.0.0'
|
|
}
|
|
|
|
def configureReactNativePom(def pom) {
|
|
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
|
|
|
|
pom.project {
|
|
name packageJson.title
|
|
artifactId packageJson.name
|
|
version = packageJson.version
|
|
group = "com.swmansion.rnscreens"
|
|
description packageJson.description
|
|
url packageJson.repository.baseUrl
|
|
|
|
licenses {
|
|
license {
|
|
name packageJson.license
|
|
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
|
|
distribution 'repo'
|
|
}
|
|
}
|
|
|
|
developers {
|
|
developer {
|
|
id packageJson.author.username
|
|
name packageJson.author.name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
afterEvaluate { project ->
|
|
|
|
task androidJavadoc(type: Javadoc) {
|
|
source = android.sourceSets.main.java.srcDirs
|
|
classpath += files(android.bootClasspath)
|
|
classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
include '**/*.java'
|
|
}
|
|
|
|
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
archiveClassifier.set('javadoc')
|
|
from androidJavadoc.destinationDir
|
|
}
|
|
|
|
task androidSourcesJar(type: Jar) {
|
|
archiveClassifier.set('sources')
|
|
from android.sourceSets.main.java.srcDirs
|
|
include '**/*.java'
|
|
}
|
|
|
|
android.libraryVariants.all { variant ->
|
|
def name = variant.name.capitalize()
|
|
task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
|
|
from variant.javaCompileProvider.get().destinationDir
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
archives androidSourcesJar
|
|
archives androidJavadocJar
|
|
}
|
|
|
|
task installArchives(type: Upload) {
|
|
configuration = configurations.archives
|
|
repositories.mavenDeployer {
|
|
// Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
repository url: "file://${projectDir}/../android/maven"
|
|
|
|
configureReactNativePom pom
|
|
}
|
|
}
|
|
}
|