Skip to content

Fixed patch #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: rn-0.78.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ afterEvaluate {

tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:deprecation,unchecked")
options.compilerArgs.add("-Werror")
// PATCH: COMMENTED OUT TO AVOID BUILD ERROR
// options.compilerArgs.add("-Werror")
}

/* Publishing Configuration */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ internal class AdditionAnimatedNode(
if (animatedNode is ValueAnimatedNode) {
acc + animatedNode.getValue()
} else {
throw JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.Add node")
acc + 0.0
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.Add node")
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ internal abstract class AnimationDriver {
* start animating with the new properties (different destination or spring settings)
*/
open fun resetConfig(config: ReadableMap) {
throw JSApplicationCausedNativeException(
"Animation config for ${javaClass.simpleName} cannot be reset")
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Animation config for ${javaClass.simpleName} cannot be reset")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,27 @@ internal class DiffClampAnimatedNode(
}

override fun update() {
val value = inputNodeValue
val diff = value - lastValue
lastValue = value
nodeValue = min(max(nodeValue + diff, minValue), maxValue)
if (inputNodeValue != null) {
val value = inputNodeValue!!
val diff = value - lastValue
lastValue = value
nodeValue = min(max(nodeValue + diff, minValue), maxValue)
}
}

private val inputNodeValue: Double
private val inputNodeValue: Double?
get() {
val animatedNode = nativeAnimatedNodesManager.getNodeById(inputNodeTag)
if (animatedNode == null || animatedNode !is ValueAnimatedNode) {
throw JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.DiffClamp node")
return null
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.DiffClamp node")
}
return animatedNode.getValue()
}

override fun prettyPrint(): String =
"DiffClampAnimatedNode[$tag]: InputNodeTag: $inputNodeTag min: $minValue " +
"max: $maxValue lastValue: $lastValue super: ${super.prettyPrint()}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ internal class DivisionAnimatedNode(
if (i == 0) {
nodeValue = v
} else if (v == 0.0) {
throw JSApplicationCausedNativeException(
"Detected a division by zero in Animated.divide node with Animated ID $tag")
return
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Detected a division by zero in Animated.divide node with Animated ID $tag")
} else {
nodeValue /= v
}
} else {
throw JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.divide node with Animated ID $tag")
return
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.divide node with Animated ID $tag")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ internal class EventAnimationDriver(
touches: WritableArray,
changedIndices: WritableArray
) {
throw UnsupportedOperationException("receiveTouches is not support by native animated events")
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw UnsupportedOperationException("receiveTouches is not support by native animated events")
}

@Deprecated("Deprecated in Java")
override fun receiveTouches(event: TouchEvent) {
throw UnsupportedOperationException("receiveTouches is not support by native animated events")
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw UnsupportedOperationException("receiveTouches is not support by native animated events")
}

override fun receiveEvent(
Expand All @@ -60,7 +62,11 @@ internal class EventAnimationDriver(
params: WritableMap?,
@EventCategoryDef category: Int
) {
requireNotNull(params) { "Native animated events must have event data." }
// requireNotNull(params) { "Native animated events must have event data." }

if(params == null) {
return;
}

// Get the new value for the node by looking into the event map using the provided event path.
var currMap: ReadableMap? = params
Expand All @@ -76,7 +82,7 @@ internal class EventAnimationDriver(
currArray = currMap.getArray(key)
currMap = null
} else {
throw UnexpectedNativeTypeException("Unexpected type $keyType for key '$key'")
// throw UnexpectedNativeTypeException("Unexpected type $keyType for key '$key'")
}
} else {
val index = eventPath[i].toInt()
Expand All @@ -88,7 +94,7 @@ internal class EventAnimationDriver(
currArray = currArray?.getArray(index)
currMap = null
} else {
throw UnexpectedNativeTypeException("Unexpected type $keyType for index '$index'")
// throw UnexpectedNativeTypeException("Unexpected type $keyType for index '$index'")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,22 @@ public class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNode(
}

override fun onAttachedToNode(parent: AnimatedNode) {
check(this.parent == null) { "Parent already attached" }
require(parent is ValueAnimatedNode) { "Parent is of an invalid type" }
// check(this.parent == null) { "Parent already attached" }
// require(parent is ValueAnimatedNode) { "Parent is of an invalid type" }
if(this.parent != null) {
return;
}
if(parent !is ValueAnimatedNode ) {
return;
}
this.parent = parent
}

override fun onDetachedFromNode(parent: AnimatedNode) {
require(parent === this.parent) { "Invalid parent node provided" }
// require(parent === this.parent) { "Invalid parent node provided" }
if (parent != this.parent) {
return
}
this.parent = null
}

Expand Down Expand Up @@ -169,19 +178,21 @@ public class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNode(
EXTRAPOLATE_TYPE_IDENTITY -> return result
EXTRAPOLATE_TYPE_CLAMP -> result = inputMin
EXTRAPOLATE_TYPE_EXTEND -> {}
else ->
throw JSApplicationIllegalArgumentException(
"Invalid extrapolation type " + extrapolateLeft + "for left extrapolation")
else -> return result
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationIllegalArgumentException(
// "Invalid extrapolation type " + extrapolateLeft + "for left extrapolation")
}
}
if (result > inputMax) {
when (extrapolateRight) {
EXTRAPOLATE_TYPE_IDENTITY -> return result
EXTRAPOLATE_TYPE_CLAMP -> result = inputMax
EXTRAPOLATE_TYPE_EXTEND -> {}
else ->
throw JSApplicationIllegalArgumentException(
"Invalid extrapolation type " + extrapolateRight + "for right extrapolation")
else -> return result
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationIllegalArgumentException(
// "Invalid extrapolation type " + extrapolateRight + "for right extrapolation")
}
}
if (outputMin == outputMax) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ internal class ModulusAnimatedNode(
val animatedNodeValue = animatedNode.getValue()
nodeValue = (animatedNodeValue % modulus + modulus) % modulus
} else {
throw JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.modulus node")
// PATCH: COMMENTED OUT EXCEPTION THROWING
// throw JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.modulus node")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ internal class MultiplicationAnimatedNode(
if (animatedNode != null && animatedNode is ValueAnimatedNode) {
animatedNode.getValue()
} else {
throw JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.multiply node")
return
}
nodeValue *= multiplier
}
Expand Down
Loading