mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
45 lines
1.1 KiB
C++
45 lines
1.1 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 <optional>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
enum class ScrollViewSnapToAlignment { Start, Center, End };
|
|
|
|
enum class ScrollViewIndicatorStyle { Default, Black, White };
|
|
|
|
enum class ScrollViewKeyboardDismissMode { None, OnDrag, Interactive };
|
|
|
|
enum class ContentInsetAdjustmentBehavior {
|
|
Never,
|
|
Automatic,
|
|
ScrollableAxes,
|
|
Always
|
|
};
|
|
|
|
class ScrollViewMaintainVisibleContentPosition final {
|
|
public:
|
|
int minIndexForVisible{0};
|
|
std::optional<int> autoscrollToTopThreshold{};
|
|
|
|
bool operator==(const ScrollViewMaintainVisibleContentPosition &rhs) const {
|
|
return std::tie(this->minIndexForVisible, this->autoscrollToTopThreshold) ==
|
|
std::tie(rhs.minIndexForVisible, rhs.autoscrollToTopThreshold);
|
|
}
|
|
|
|
bool operator!=(const ScrollViewMaintainVisibleContentPosition &rhs) const {
|
|
return !(*this == rhs);
|
|
}
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|