1111import androidx .annotation .Nullable ;
1212import androidx .annotation .UiThread ;
1313import com .facebook .common .logging .FLog ;
14+ import com .facebook .infer .annotation .Nullsafe ;
1415import com .facebook .react .bridge .Arguments ;
1516import com .facebook .react .bridge .Callback ;
1617import com .facebook .react .bridge .JSApplicationCausedNativeException ;
5152 *
5253 * <p>IMPORTANT: This class should be accessed only from the UI Thread
5354 */
55+ @ Nullsafe (Nullsafe .Mode .LOCAL )
5456public class NativeAnimatedNodesManager implements EventDispatcherListener {
5557
5658 private static final String TAG = "NativeAnimatedNodesManager" ;
@@ -252,7 +254,10 @@ public void extractAnimatedNodeOffset(int tag) {
252254
253255 @ UiThread
254256 public void startAnimatingNode (
255- int animationId , int animatedNodeTag , ReadableMap animationConfig , Callback endCallback ) {
257+ int animationId ,
258+ int animatedNodeTag ,
259+ ReadableMap animationConfig ,
260+ @ Nullable Callback endCallback ) {
256261 AnimatedNode node = mAnimatedNodes .get (animatedNodeTag );
257262 if (node == null ) {
258263 throw new JSApplicationIllegalArgumentException (
@@ -306,6 +311,7 @@ private void stopAnimationsForNode(AnimatedNode animatedNode) {
306311 // Invoke animation end callback with {finished: false}
307312 WritableMap endCallbackResponse = Arguments .createMap ();
308313 endCallbackResponse .putBoolean ("finished" , false );
314+ // NULLSAFE_FIXME[Nullable Dereference]
309315 endCallbackResponse .putDouble ("value" , animation .animatedValue .nodeValue );
310316 animation .endCallback .invoke (endCallbackResponse );
311317 } else if (mReactApplicationContext != null ) {
@@ -315,6 +321,7 @@ private void stopAnimationsForNode(AnimatedNode animatedNode) {
315321 WritableMap params = Arguments .createMap ();
316322 params .putInt ("animationId" , animation .id );
317323 params .putBoolean ("finished" , false );
324+ // NULLSAFE_FIXME[Nullable Dereference]
318325 params .putDouble ("value" , animation .animatedValue .nodeValue );
319326 if (events == null ) {
320327 events = Arguments .createArray ();
@@ -344,6 +351,7 @@ public void stopAnimation(int animationId) {
344351 // Invoke animation end callback with {finished: false}
345352 WritableMap endCallbackResponse = Arguments .createMap ();
346353 endCallbackResponse .putBoolean ("finished" , false );
354+ // NULLSAFE_FIXME[Nullable Dereference]
347355 endCallbackResponse .putDouble ("value" , animation .animatedValue .nodeValue );
348356 animation .endCallback .invoke (endCallbackResponse );
349357 } else if (mReactApplicationContext != null ) {
@@ -353,6 +361,7 @@ public void stopAnimation(int animationId) {
353361 WritableMap params = Arguments .createMap ();
354362 params .putInt ("animationId" , animation .id );
355363 params .putBoolean ("finished" , false );
364+ // NULLSAFE_FIXME[Nullable Dereference]
356365 params .putDouble ("value" , animation .animatedValue .nodeValue );
357366 if (events == null ) {
358367 events = Arguments .createArray ();
@@ -537,8 +546,11 @@ public void addAnimatedEventToView(
537546 }
538547
539548 ReadableArray path = eventMapping .getArray ("nativeEventPath" );
549+ // NULLSAFE_FIXME[Nullable Dereference]
540550 List <String > pathList = new ArrayList <>(path .size ());
551+ // NULLSAFE_FIXME[Nullable Dereference]
541552 for (int i = 0 ; i < path .size (); i ++) {
553+ // NULLSAFE_FIXME[Nullable Dereference]
542554 pathList .add (path .getString (i ));
543555 }
544556
@@ -562,8 +574,11 @@ public void removeAnimatedEventFromView(
562574 ListIterator <EventAnimationDriver > it = mEventDrivers .listIterator ();
563575 while (it .hasNext ()) {
564576 EventAnimationDriver driver = it .next ();
577+ // NULLSAFE_FIXME[Nullable Dereference]
565578 if (eventName .equals (driver .eventName )
579+ // NULLSAFE_FIXME[Nullable Dereference]
566580 && viewTag == driver .viewTag
581+ // NULLSAFE_FIXME[Nullable Dereference]
567582 && animatedValueTag == driver .valueNode .tag ) {
568583 it .remove ();
569584 break ;
@@ -664,6 +679,7 @@ public void runUpdates(long frameTimeNanos) {
664679 if (animation .endCallback != null ) {
665680 WritableMap endCallbackResponse = Arguments .createMap ();
666681 endCallbackResponse .putBoolean ("finished" , true );
682+ // NULLSAFE_FIXME[Nullable Dereference]
667683 endCallbackResponse .putDouble ("value" , animation .animatedValue .nodeValue );
668684 animation .endCallback .invoke (endCallbackResponse );
669685 } else if (mReactApplicationContext != null ) {
@@ -673,6 +689,7 @@ public void runUpdates(long frameTimeNanos) {
673689 WritableMap params = Arguments .createMap ();
674690 params .putInt ("animationId" , animation .id );
675691 params .putBoolean ("finished" , true );
692+ // NULLSAFE_FIXME[Nullable Dereference]
676693 params .putDouble ("value" , animation .animatedValue .nodeValue );
677694 if (events == null ) {
678695 events = Arguments .createArray ();
@@ -738,8 +755,11 @@ private void updateNodes(List<AnimatedNode> nodes) {
738755
739756 while (!nodesQueue .isEmpty ()) {
740757 AnimatedNode nextNode = nodesQueue .poll ();
758+ // NULLSAFE_FIXME[Nullable Dereference]
741759 if (nextNode .children != null ) {
760+ // NULLSAFE_FIXME[Nullable Dereference]
742761 for (int i = 0 ; i < nextNode .children .size (); i ++) {
762+ // NULLSAFE_FIXME[Nullable Dereference]
743763 AnimatedNode child = nextNode .children .get (i );
744764 child .activeIncomingNodes ++;
745765 if (child .BFSColor != mAnimatedGraphBFSColor ) {
@@ -780,6 +800,7 @@ private void updateNodes(List<AnimatedNode> nodes) {
780800 while (!nodesQueue .isEmpty ()) {
781801 AnimatedNode nextNode = nodesQueue .poll ();
782802 try {
803+ // NULLSAFE_FIXME[Nullable Dereference]
783804 nextNode .update ();
784805 if (nextNode instanceof PropsAnimatedNode ) {
785806 // Send property updates to native view manager
@@ -799,8 +820,11 @@ private void updateNodes(List<AnimatedNode> nodes) {
799820 // Potentially send events to JS when the node's value is updated
800821 ((ValueAnimatedNode ) nextNode ).onValueUpdate ();
801822 }
823+ // NULLSAFE_FIXME[Nullable Dereference]
802824 if (nextNode .children != null ) {
825+ // NULLSAFE_FIXME[Nullable Dereference]
803826 for (int i = 0 ; i < nextNode .children .size (); i ++) {
827+ // NULLSAFE_FIXME[Nullable Dereference]
804828 AnimatedNode child = nextNode .children .get (i );
805829 child .activeIncomingNodes --;
806830 if (child .BFSColor != mAnimatedGraphBFSColor && child .activeIncomingNodes == 0 ) {
0 commit comments