-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support animating shared elements on pop (#6385)
This PR introduces support to run shared element transition animations on stack pop.
- Loading branch information
Showing
32 changed files
with
519 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
lib/android/app/src/main/java/com/reactnativenavigation/options/SharedElements.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
lib/android/app/src/main/java/com/reactnativenavigation/options/SharedElements.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.reactnativenavigation.options | ||
|
||
import org.json.JSONException | ||
import org.json.JSONObject | ||
import java.util.* | ||
|
||
class SharedElements { | ||
private var transitions: MutableList<SharedElementTransitionOptions> = ArrayList() | ||
fun get(): List<SharedElementTransitionOptions> { | ||
return transitions | ||
} | ||
|
||
fun hasValue() = transitions.isNotEmpty() | ||
|
||
fun mergeWith(other: SharedElements) { | ||
if (other.hasValue()) transitions = other.transitions | ||
} | ||
|
||
fun mergeWithDefault(defaultOptions: SharedElements) { | ||
if (!hasValue()) transitions = defaultOptions.transitions | ||
} | ||
|
||
private fun add(transition: SharedElementTransitionOptions) { | ||
transitions.add(transition) | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun parse(json: JSONObject): SharedElements { | ||
val result = SharedElements() | ||
return try { | ||
val sharedElements = json.getJSONArray("sharedElementTransitions") | ||
if (sharedElements == null || sharedElements.length() == 0) return result | ||
for (i in 0 until sharedElements.length()) { | ||
result.add(SharedElementTransitionOptions.parse(sharedElements.getJSONObject(i))) | ||
} | ||
result | ||
} catch (e: JSONException) { | ||
result | ||
} | ||
} | ||
} | ||
} |
158 changes: 0 additions & 158 deletions
158
...roid/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.