@@ -592,4 +592,273 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
592592}
593593#endif
594594
595+ #ifdef ANDROID
596+
597+ static folly::dynamic convertScrollViewMaintainVisibleContentPosition (
598+ const ScrollViewMaintainVisibleContentPosition& value) {
599+ folly::dynamic result = folly::dynamic::object ();
600+ result[" minIndexForVisible" ] = value.minIndexForVisible ;
601+ if (value.autoscrollToTopThreshold .has_value ()) {
602+ result[" autoscrollToTopThreshold" ] = value.autoscrollToTopThreshold .value ();
603+ }
604+ return result;
605+ }
606+
607+ static folly::dynamic convertEdgeInsets (const EdgeInsets& edgeInsets) {
608+ folly::dynamic edgeInsetsResult = folly::dynamic::object ();
609+ edgeInsetsResult[" left" ] = edgeInsets.left ;
610+ edgeInsetsResult[" top" ] = edgeInsets.top ;
611+ edgeInsetsResult[" right" ] = edgeInsets.right ;
612+ edgeInsetsResult[" bottom" ] = edgeInsets.bottom ;
613+ return edgeInsetsResult;
614+ }
615+
616+ static folly::dynamic convertPoint (const Point& point) {
617+ folly::dynamic pointResult = folly::dynamic::object ();
618+ pointResult[" y" ] = point.y ;
619+ pointResult[" x" ] = point.x ;
620+ return pointResult;
621+ }
622+
623+ folly::dynamic ScrollViewProps::getDiffProps (const Props* prevProps) const {
624+ static const auto defaultProps = ScrollViewProps ();
625+ const ScrollViewProps* oldProps = prevProps == nullptr
626+ ? &defaultProps
627+ : static_cast <const ScrollViewProps*>(prevProps);
628+
629+ folly::dynamic result = ViewProps::getDiffProps (oldProps);
630+
631+ if (alwaysBounceHorizontal != oldProps->alwaysBounceHorizontal ) {
632+ result[" alwaysBounceHorizontal" ] = alwaysBounceHorizontal;
633+ }
634+
635+ if (alwaysBounceVertical != oldProps->alwaysBounceVertical ) {
636+ result[" alwaysBounceVertical" ] = alwaysBounceVertical;
637+ }
638+
639+ if (bounces != oldProps->bounces ) {
640+ result[" bounces" ] = bounces;
641+ }
642+
643+ if (bouncesZoom != oldProps->bouncesZoom ) {
644+ result[" bouncesZoom" ] = bouncesZoom;
645+ }
646+
647+ if (canCancelContentTouches != oldProps->canCancelContentTouches ) {
648+ result[" canCancelContentTouches" ] = canCancelContentTouches;
649+ }
650+
651+ if (centerContent != oldProps->centerContent ) {
652+ result[" centerContent" ] = centerContent;
653+ }
654+
655+ if (automaticallyAdjustContentInsets !=
656+ oldProps->automaticallyAdjustContentInsets ) {
657+ result[" automaticallyAdjustContentInsets" ] =
658+ automaticallyAdjustContentInsets;
659+ }
660+
661+ if (automaticallyAdjustsScrollIndicatorInsets !=
662+ oldProps->automaticallyAdjustsScrollIndicatorInsets ) {
663+ result[" automaticallyAdjustsScrollIndicatorInsets" ] =
664+ automaticallyAdjustsScrollIndicatorInsets;
665+ }
666+
667+ if (automaticallyAdjustKeyboardInsets !=
668+ oldProps->automaticallyAdjustKeyboardInsets ) {
669+ result[" automaticallyAdjustKeyboardInsets" ] =
670+ automaticallyAdjustKeyboardInsets;
671+ }
672+
673+ if (decelerationRate != oldProps->decelerationRate ) {
674+ result[" decelerationRate" ] = decelerationRate;
675+ }
676+
677+ if (endDraggingSensitivityMultiplier !=
678+ oldProps->endDraggingSensitivityMultiplier ) {
679+ result[" endDraggingSensitivityMultiplier" ] =
680+ endDraggingSensitivityMultiplier;
681+ }
682+
683+ if (directionalLockEnabled != oldProps->directionalLockEnabled ) {
684+ result[" directionalLockEnabled" ] = directionalLockEnabled;
685+ }
686+
687+ if (indicatorStyle != oldProps->indicatorStyle ) {
688+ switch (indicatorStyle) {
689+ case ScrollViewIndicatorStyle::Default:
690+ result[" indicatorStyle" ] = " default" ;
691+ break ;
692+ case ScrollViewIndicatorStyle::Black:
693+ result[" indicatorStyle" ] = " black" ;
694+ break ;
695+ case ScrollViewIndicatorStyle::White:
696+ result[" indicatorStyle" ] = " white" ;
697+ break ;
698+ }
699+ }
700+
701+ if (keyboardDismissMode != oldProps->keyboardDismissMode ) {
702+ switch (keyboardDismissMode) {
703+ case ScrollViewKeyboardDismissMode::None:
704+ result[" keyboardDismissMode" ] = " none" ;
705+ break ;
706+ case ScrollViewKeyboardDismissMode::OnDrag:
707+ result[" keyboardDismissMode" ] = " on-drag" ;
708+ break ;
709+ case ScrollViewKeyboardDismissMode::Interactive:
710+ result[" keyboardDismissMode" ] = " interactive" ;
711+ break ;
712+ }
713+ }
714+
715+ if (maintainVisibleContentPosition !=
716+ oldProps->maintainVisibleContentPosition ) {
717+ if (maintainVisibleContentPosition.has_value ()) {
718+ result[" maintainVisibleContentPosition" ] =
719+ convertScrollViewMaintainVisibleContentPosition (
720+ maintainVisibleContentPosition.value ());
721+ } else {
722+ result[" maintainVisibleContentPosition" ] = folly::dynamic (nullptr );
723+ }
724+ }
725+
726+ if (maximumZoomScale != oldProps->maximumZoomScale ) {
727+ result[" maximumZoomScale" ] = maximumZoomScale;
728+ }
729+
730+ if (minimumZoomScale != oldProps->minimumZoomScale ) {
731+ result[" minimumZoomScale" ] = minimumZoomScale;
732+ }
733+
734+ if (scrollEnabled != oldProps->scrollEnabled ) {
735+ result[" scrollEnabled" ] = scrollEnabled;
736+ }
737+
738+ if (pagingEnabled != oldProps->pagingEnabled ) {
739+ result[" pagingEnabled" ] = pagingEnabled;
740+ }
741+
742+ if (pinchGestureEnabled != oldProps->pinchGestureEnabled ) {
743+ result[" pinchGestureEnabled" ] = pinchGestureEnabled;
744+ }
745+
746+ if (scrollsToTop != oldProps->scrollsToTop ) {
747+ result[" scrollsToTop" ] = scrollsToTop;
748+ }
749+
750+ if (showsHorizontalScrollIndicator !=
751+ oldProps->showsHorizontalScrollIndicator ) {
752+ result[" showsHorizontalScrollIndicator" ] = showsHorizontalScrollIndicator;
753+ }
754+
755+ if (showsVerticalScrollIndicator != oldProps->showsVerticalScrollIndicator ) {
756+ result[" showsVerticalScrollIndicator" ] = showsVerticalScrollIndicator;
757+ }
758+
759+ if (persistentScrollbar != oldProps->persistentScrollbar ) {
760+ result[" persistentScrollbar" ] = persistentScrollbar;
761+ }
762+
763+ if (horizontal != oldProps->horizontal ) {
764+ result[" horizontal" ] = horizontal;
765+ }
766+
767+ if (scrollEventThrottle != oldProps->scrollEventThrottle ) {
768+ result[" scrollEventThrottle" ] = scrollEventThrottle;
769+ }
770+
771+ if (zoomScale != oldProps->zoomScale ) {
772+ result[" zoomScale" ] = zoomScale;
773+ }
774+
775+ if (contentInset != oldProps->contentInset ) {
776+ result[" contentInset" ] = convertEdgeInsets (contentInset);
777+ }
778+
779+ if (contentOffset != oldProps->contentOffset ) {
780+ result[" contentOffset" ] = convertPoint (contentOffset);
781+ }
782+
783+ if (scrollIndicatorInsets != oldProps->scrollIndicatorInsets ) {
784+ result[" scrollIndicatorInsets" ] = convertEdgeInsets (scrollIndicatorInsets);
785+ }
786+
787+ if (snapToInterval != oldProps->snapToInterval ) {
788+ result[" snapToInterval" ] = snapToInterval;
789+ }
790+
791+ if (snapToAlignment != oldProps->snapToAlignment ) {
792+ switch (snapToAlignment) {
793+ case ScrollViewSnapToAlignment::Start:
794+ result[" snapToAlignment" ] = " start" ;
795+ break ;
796+ case ScrollViewSnapToAlignment::Center:
797+ result[" snapToAlignment" ] = " center" ;
798+ break ;
799+ case ScrollViewSnapToAlignment::End:
800+ result[" snapToAlignment" ] = " end" ;
801+ break ;
802+ }
803+ }
804+
805+ if (disableIntervalMomentum != oldProps->disableIntervalMomentum ) {
806+ result[" disableIntervalMomentum" ] = disableIntervalMomentum;
807+ }
808+
809+ if (snapToOffsets != oldProps->snapToOffsets ) {
810+ auto snapToOffsetsArray = folly::dynamic::array ();
811+ for (const auto & snapToOffset : snapToOffsets) {
812+ snapToOffsetsArray.push_back (snapToOffset);
813+ }
814+ result[" snapToOffsets" ] = snapToOffsetsArray;
815+ }
816+
817+ if (snapToStart != oldProps->snapToStart ) {
818+ result[" snapToStart" ] = snapToStart;
819+ }
820+
821+ if (snapToEnd != oldProps->snapToEnd ) {
822+ result[" snapToEnd" ] = snapToEnd;
823+ }
824+
825+ if (contentInsetAdjustmentBehavior !=
826+ oldProps->contentInsetAdjustmentBehavior ) {
827+ switch (contentInsetAdjustmentBehavior) {
828+ case ContentInsetAdjustmentBehavior::Never:
829+ result[" contentInsetAdjustmentBehavior" ] = " never" ;
830+ break ;
831+ case ContentInsetAdjustmentBehavior::Automatic:
832+ result[" contentInsetAdjustmentBehavior" ] = " automatic" ;
833+ break ;
834+ case ContentInsetAdjustmentBehavior::ScrollableAxes:
835+ result[" contentInsetAdjustmentBehavior" ] = " scrollableAxes" ;
836+ break ;
837+ case ContentInsetAdjustmentBehavior::Always:
838+ result[" contentInsetAdjustmentBehavior" ] = " always" ;
839+ break ;
840+ }
841+ }
842+
843+ if (scrollToOverflowEnabled != oldProps->scrollToOverflowEnabled ) {
844+ result[" scrollToOverflowEnabled" ] = scrollToOverflowEnabled;
845+ }
846+
847+ if (isInvertedVirtualizedList != oldProps->isInvertedVirtualizedList ) {
848+ result[" isInvertedVirtualizedList" ] = isInvertedVirtualizedList;
849+ }
850+
851+ if (sendMomentumEvents != oldProps->sendMomentumEvents ) {
852+ result[" sendMomentumEvents" ] = sendMomentumEvents;
853+ }
854+
855+ if (nestedScrollEnabled != oldProps->nestedScrollEnabled ) {
856+ result[" nestedScrollEnabled" ] = nestedScrollEnabled;
857+ }
858+
859+ return result;
860+ }
861+
862+ #endif
863+
595864} // namespace facebook::react
0 commit comments