mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-13 22:30:41 +08:00
This change fixes two crashes related to fragment library. The first issue was a crash caused by return transaction started while the previous transaction was ongoing (e.g., quickly adding new screen on top of the stack and immediately dismissing it). The main fix was applied in the fragment library and therefore as a part of this change we update the dependency to fragment:1.2.1 which is the current latest stable version. As a result of the fragment library change we started observing other issue. The second issue was caused by the fact that under certain circumstances the view associated with a fragment couldn't been added despite it still being attached to a parent. This was resulting in a crash. This change adds a cleanup code that properly detaches the view: we do it in onCreateView but also when the fragment destroys its view (in onViewDestroy callback). The latter is necessary because when fragments are restored the order of onCreateView calls is reversed which causes inner views to attach despite their fragment managers not being initialized.
127 lines
3.5 KiB
Groovy
127 lines
3.5 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.fragment:fragment:1.2.1'
|
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
|
|
implementation 'com.google.android.material:material:1.1.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) {
|
|
classifier = 'javadoc'
|
|
from androidJavadoc.destinationDir
|
|
}
|
|
|
|
task androidSourcesJar(type: Jar) {
|
|
classifier = '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
|
|
}
|
|
}
|
|
}
|