@@ -608,94 +608,92 @@ ScrollViewComponentView::ScrollViewComponentView(
608608 compContext,
609609 tag,
610610 reactContext,
611- ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {
612- // m_element.Content(m_contentPanel);
611+ ComponentViewFeatures::Default & ~ComponentViewFeatures::Background),
612+ m_element(winrt::Windows::UI::Xaml::Controls::ScrollViewer()),
613+ m_contentPanel(winrt::Windows::UI::Xaml::Controls::StackPanel()) {
614+
615+ m_element.Content (m_contentPanel);
613616
614617 /*
615- m_scrollViewerViewChangingRevoker =
616- m_element.ViewChanging(winrt::auto_revoke, [this](const auto &sender, const auto &args) {
617- const auto scrollViewerNotNull = sender.as<xaml::Controls::ScrollViewer>();
618-
619- facebook::react::ScrollViewMetrics scrollMetrics;
620- scrollMetrics.containerSize.height = static_cast<facebook::react::Float>(m_element.ActualHeight());
621- scrollMetrics.containerSize.width = static_cast<facebook::react::Float>(m_element.ActualWidth());
622- scrollMetrics.contentOffset.x = static_cast<facebook::react::Float>(args.NextView().HorizontalOffset());
623- scrollMetrics.contentOffset.y = static_cast<facebook::react::Float>(args.NextView().VerticalOffset());
624- scrollMetrics.zoomScale = args.NextView().ZoomFactor();
625- scrollMetrics.contentSize.height = static_cast<facebook::react::Float>(m_contentPanel.ActualHeight());
626- scrollMetrics.contentSize.width = static_cast<facebook::react::Float>(m_contentPanel.ActualWidth());
627-
628- // If we are transitioning to inertial scrolling.
629- if (m_isScrolling && !m_isScrollingFromInertia && args.IsInertial()) {
630- m_isScrollingFromInertia = true;
631-
632- if (m_eventEmitter) {
633- std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
634- ->onScrollEndDrag(scrollMetrics);
635- std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
636- ->onMomentumScrollBegin(scrollMetrics);
637- }
638- }
618+ m_scrollViewerViewChangingRevoker =
619+ m_element.ViewChanging(winrt::auto_revoke, [this](const auto &sender, const auto &args) {
620+ const auto scrollViewerNotNull = sender.as<xaml::Controls::ScrollViewer>();
621+
622+ facebook::react::ScrollViewMetrics scrollMetrics;
623+ scrollMetrics.containerSize.height = static_cast<facebook::react::Float>(m_element.ActualHeight());
624+ scrollMetrics.containerSize.width = static_cast<facebook::react::Float>(m_element.ActualWidth());
625+ scrollMetrics.contentOffset.x = static_cast<facebook::react::Float>(args.NextView().HorizontalOffset());
626+ scrollMetrics.contentOffset.y = static_cast<facebook::react::Float>(args.NextView().VerticalOffset());
627+ scrollMetrics.zoomScale = args.NextView().ZoomFactor();
628+ scrollMetrics.contentSize.height = static_cast<facebook::react::Float>(m_contentPanel.ActualHeight());
629+ scrollMetrics.contentSize.width = static_cast<facebook::react::Float>(m_contentPanel.ActualWidth());
630+
631+ // If we are transitioning to inertial scrolling.
632+ if (m_isScrolling && !m_isScrollingFromInertia && args.IsInertial()) {
633+ m_isScrollingFromInertia = true;
639634
640635 if (m_eventEmitter) {
641636 std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
642- ->onScroll(scrollMetrics);
643- }
644- });
645-
646- m_scrollViewerDirectManipulationStartedRevoker =
647- m_element.DirectManipulationStarted(winrt::auto_revoke, [this](const auto &sender, const auto &) {
648- m_isScrolling = true;
649-
650-
651- //if (m_dismissKeyboardOnDrag && m_SIPEventHandler) {
652- // m_SIPEventHandler->TryHide();
653- //}
654-
655-
656- facebook::react::ScrollViewMetrics scrollMetrics;
657- scrollMetrics.containerSize.height = static_cast<facebook::react::Float>(m_element.ActualHeight());
658- scrollMetrics.containerSize.width = static_cast<facebook::react::Float>(m_element.ActualWidth());
659- scrollMetrics.contentOffset.x = static_cast<facebook::react::Float>(m_element.HorizontalOffset());
660- scrollMetrics.contentOffset.y = static_cast<facebook::react::Float>(m_element.VerticalOffset());
661- scrollMetrics.zoomScale = m_element.ZoomFactor();
662- scrollMetrics.contentSize.height = static_cast<facebook::react::Float>(m_contentPanel.ActualHeight());
663- scrollMetrics.contentSize.width = static_cast<facebook::react::Float>(m_contentPanel.ActualWidth());
664-
665- const auto scrollViewer = sender.as<xaml::Controls::ScrollViewer>();
666- if (m_eventEmitter) {
637+ ->onScrollEndDrag(scrollMetrics);
667638 std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
668- ->onScrollBeginDrag (scrollMetrics);
639+ ->onMomentumScrollBegin (scrollMetrics);
669640 }
670- });
671-
672- m_scrollViewerDirectManipulationCompletedRevoker =
673- m_element.DirectManipulationCompleted(winrt::auto_revoke, [this](const auto &sender, const auto &args) {
674- const auto scrollViewer = sender.as<xaml::Controls::ScrollViewer>();
641+ }
675642
676- facebook::react::ScrollViewMetrics scrollMetrics;
677- scrollMetrics.containerSize.height = static_cast<facebook::react::Float>(m_element.ActualHeight());
678- scrollMetrics.containerSize.width = static_cast<facebook::react::Float>(m_element.ActualWidth());
679- scrollMetrics.contentOffset.x = static_cast<facebook::react::Float>(m_element.HorizontalOffset());
680- scrollMetrics.contentOffset.y = static_cast<facebook::react::Float>(m_element.VerticalOffset());
681- scrollMetrics.zoomScale = m_element.ZoomFactor();
682- scrollMetrics.contentSize.height = static_cast<facebook::react::Float>(m_contentPanel.ActualHeight());
683- scrollMetrics.contentSize.width = static_cast<facebook::react::Float>(m_contentPanel.ActualWidth());
643+ if (m_eventEmitter) {
644+ std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
645+ ->onScroll(scrollMetrics);
646+ }
647+ });
648+ */
649+
650+ m_scrollViewerDirectManipulationStartedRevoker =
651+ m_element.DirectManipulationStarted (winrt::auto_revoke, [this ](const auto &sender, const auto &) {
652+ m_isScrolling = true ;
653+
654+ facebook::react::ScrollViewMetrics scrollMetrics;
655+ scrollMetrics.containerSize .height = static_cast <facebook::react::Float>(m_element.ActualHeight ());
656+ scrollMetrics.containerSize .width = static_cast <facebook::react::Float>(m_element.ActualWidth ());
657+ scrollMetrics.contentOffset .x = static_cast <facebook::react::Float>(m_element.HorizontalOffset ());
658+ scrollMetrics.contentOffset .y = static_cast <facebook::react::Float>(m_element.VerticalOffset ());
659+ scrollMetrics.zoomScale = m_element.ZoomFactor ();
660+ scrollMetrics.contentSize .height = static_cast <facebook::react::Float>(m_contentPanel.ActualHeight ());
661+ scrollMetrics.contentSize .width = static_cast <facebook::react::Float>(m_contentPanel.ActualWidth ());
662+
663+ const auto scrollViewer = sender.as <xaml::Controls::ScrollViewer>();
664+ if (m_eventEmitter) {
665+ std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const >(m_eventEmitter)
666+ ->onScrollBeginDrag (scrollMetrics);
667+ }
668+ });
684669
685- if (m_eventEmitter) {
686- if (m_isScrollingFromInertia) {
687- std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
688- ->onMomentumScrollEnd(scrollMetrics);
689- } else {
690- std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
691- ->onScrollEndDrag(scrollMetrics);
692- }
670+ /*
671+ m_scrollViewerDirectManipulationCompletedRevoker =
672+ m_element.DirectManipulationCompleted(winrt::auto_revoke, [this](const auto &sender, const auto &args) {
673+ const auto scrollViewer = sender.as<xaml::Controls::ScrollViewer>();
674+
675+ facebook::react::ScrollViewMetrics scrollMetrics;
676+ scrollMetrics.containerSize.height = static_cast<facebook::react::Float>(m_element.ActualHeight());
677+ scrollMetrics.containerSize.width = static_cast<facebook::react::Float>(m_element.ActualWidth());
678+ scrollMetrics.contentOffset.x = static_cast<facebook::react::Float>(m_element.HorizontalOffset());
679+ scrollMetrics.contentOffset.y = static_cast<facebook::react::Float>(m_element.VerticalOffset());
680+ scrollMetrics.zoomScale = m_element.ZoomFactor();
681+ scrollMetrics.contentSize.height = static_cast<facebook::react::Float>(m_contentPanel.ActualHeight());
682+ scrollMetrics.contentSize.width = static_cast<facebook::react::Float>(m_contentPanel.ActualWidth());
683+
684+ if (m_eventEmitter) {
685+ if (m_isScrollingFromInertia) {
686+ std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
687+ ->onMomentumScrollEnd(scrollMetrics);
688+ } else {
689+ std::static_pointer_cast<facebook::react::ScrollViewEventEmitter const>(m_eventEmitter)
690+ ->onScrollEndDrag(scrollMetrics);
693691 }
692+ }
694693
695- m_isScrolling = false;
696- m_isScrollingFromInertia = false;
697- });
698- */
694+ m_isScrolling = false;
695+ m_isScrollingFromInertia = false;
696+ });*/
699697}
700698
701699void ScrollViewComponentView::MountChildComponentView (
0 commit comments