mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43532 changelog: [internal] - use designated initializers. - make ScrollViewMetrics a struct. - move ScrollViewMetrics inside of ScrollViewEventEmitter. This is to be more consistent with other event emitters. Reviewed By: rubennorte Differential Revision: D54896331 fbshipit-source-id: 01aecd1835b23bdaccff1355d33eb7b4c5ba8d92
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <folly/dynamic.h>
|
|
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
#include <react/renderer/core/EventEmitter.h>
|
|
|
|
namespace facebook::react {
|
|
|
|
class ScrollViewEventEmitter : public ViewEventEmitter {
|
|
public:
|
|
using ViewEventEmitter::ViewEventEmitter;
|
|
|
|
struct Metrics {
|
|
Size contentSize;
|
|
Point contentOffset;
|
|
EdgeInsets contentInset;
|
|
Size containerSize;
|
|
Float zoomScale{};
|
|
};
|
|
|
|
void onScroll(const Metrics& scrollViewMetrics) const;
|
|
void onScrollBeginDrag(const Metrics& scrollViewMetrics) const;
|
|
void onScrollEndDrag(const Metrics& scrollViewMetrics) const;
|
|
void onMomentumScrollBegin(const Metrics& scrollViewMetrics) const;
|
|
void onMomentumScrollEnd(const Metrics& scrollViewMetrics) const;
|
|
void onScrollToTop(const Metrics& scrollViewMetrics) const;
|
|
|
|
private:
|
|
void dispatchScrollViewEvent(
|
|
std::string name,
|
|
const Metrics& scrollViewMetrics) const;
|
|
};
|
|
|
|
} // namespace facebook::react
|