mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ecf967a51d
Summary: This adds support for the `maintainVisibleContentPosition` in iOS fabric. This was previously only implemented in the old renderer. The implementation is very similar to what we currently have. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [iOS] [Added] - Add fabric support for maintainVisibleContentPosition on iOS Pull Request resolved: https://github.com/facebook/react-native/pull/35319 Test Plan: Test in RN tester example. https://user-images.githubusercontent.com/2677334/201484543-f7944e34-6cb7-48d6-aa28-e2a7ccdfa666.mov Reviewed By: sammy-SC Differential Revision: D41273822 Pulled By: jacdebug fbshipit-source-id: 7900898f28280ff01619a4af609d2a37437c7240
82 lines
2.3 KiB
C++
82 lines
2.3 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 <react/renderer/components/scrollview/primitives.h>
|
|
#include <react/renderer/components/view/ViewProps.h>
|
|
#include <react/renderer/core/PropsParserContext.h>
|
|
|
|
#include <optional>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
// TODO (T28334063): Consider for codegen.
|
|
class ScrollViewProps final : public ViewProps {
|
|
public:
|
|
ScrollViewProps() = default;
|
|
ScrollViewProps(
|
|
const PropsParserContext &context,
|
|
ScrollViewProps const &sourceProps,
|
|
RawProps const &rawProps);
|
|
|
|
void setProp(
|
|
const PropsParserContext &context,
|
|
RawPropsPropNameHash hash,
|
|
const char *propName,
|
|
RawValue const &value);
|
|
|
|
#pragma mark - Props
|
|
|
|
bool alwaysBounceHorizontal{};
|
|
bool alwaysBounceVertical{};
|
|
bool bounces{true};
|
|
bool bouncesZoom{true};
|
|
bool canCancelContentTouches{true};
|
|
bool centerContent{};
|
|
bool automaticallyAdjustContentInsets{};
|
|
bool automaticallyAdjustsScrollIndicatorInsets{true};
|
|
Float decelerationRate{0.998f};
|
|
bool directionalLockEnabled{};
|
|
ScrollViewIndicatorStyle indicatorStyle{};
|
|
ScrollViewKeyboardDismissMode keyboardDismissMode{};
|
|
std::optional<ScrollViewMaintainVisibleContentPosition>
|
|
maintainVisibleContentPosition{};
|
|
Float maximumZoomScale{1.0f};
|
|
Float minimumZoomScale{1.0f};
|
|
bool scrollEnabled{true};
|
|
bool pagingEnabled{};
|
|
bool pinchGestureEnabled{true};
|
|
bool scrollsToTop{true};
|
|
bool showsHorizontalScrollIndicator{true};
|
|
bool showsVerticalScrollIndicator{true};
|
|
Float scrollEventThrottle{};
|
|
Float zoomScale{1.0f};
|
|
EdgeInsets contentInset{};
|
|
Point contentOffset{};
|
|
EdgeInsets scrollIndicatorInsets{};
|
|
Float snapToInterval{};
|
|
ScrollViewSnapToAlignment snapToAlignment{};
|
|
bool disableIntervalMomentum{false};
|
|
std::vector<Float> snapToOffsets{};
|
|
bool snapToStart{true};
|
|
bool snapToEnd{true};
|
|
ContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{
|
|
ContentInsetAdjustmentBehavior::Never};
|
|
bool scrollToOverflowEnabled{false};
|
|
|
|
#pragma mark - DebugStringConvertible
|
|
|
|
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
SharedDebugStringConvertibleList getDebugProps() const override;
|
|
#endif
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|