Files
react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h
T
Joshua Gross 0ef5beee85 Support ScrollAway in ReactScrollView
Summary:
Support ScrollAway in ReactScrollView for Fabric/non-Fabric.

Changelog: [Android][Added] Support for ScrollAway native nav bars added to ReactScrollView

Reviewed By: mdvacca

Differential Revision: D28308855

fbshipit-source-id: 9a922159ef50fb7c8e9c484a4b97ca57ab248496
2021-05-10 12:16:10 -07:00

57 lines
1.4 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its 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 <react/renderer/graphics/Geometry.h>
#ifdef ANDROID
#include <folly/dynamic.h>
#include <react/renderer/mapbuffer/MapBuffer.h>
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
#endif
namespace facebook {
namespace react {
/*
* State for <ScrollView> component.
*/
class ScrollViewState final {
public:
Point contentOffset;
Rect contentBoundingRect;
int scrollAwayPaddingTop;
/*
* Returns size of scrollable area.
*/
Size getContentSize() const;
#ifdef ANDROID
ScrollViewState() = default;
ScrollViewState(ScrollViewState const &previousState, folly::dynamic data)
: contentOffset(
{(Float)data["contentOffsetLeft"].getDouble(),
(Float)data["contentOffsetTop"].getDouble()}),
contentBoundingRect({}),
scrollAwayPaddingTop((Float)data["scrollAwayPaddingTop"].getDouble()){};
folly::dynamic getDynamic() const {
return folly::dynamic::object("contentOffsetLeft", contentOffset.x)(
"contentOffsetTop", contentOffset.y)(
"scrollAwayPaddingTop", scrollAwayPaddingTop);
};
MapBuffer getMapBuffer() const {
return MapBufferBuilder::EMPTY();
};
#endif
};
} // namespace react
} // namespace facebook