mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
283512cc42
Summary: Changelog: [internal] Yoga offsets content view of scrollview in RTL environment. React Native Classis deals with it by using a separate component [ScrollContentView](https://github.com/facebook/react-native/blob/6e6443afd04a847ef23fb6254a84e48c70b45896/React/Views/ScrollView/RCTScrollContentShadowView.m#L18-L25 ) and making the adjustment there. In New React Native Renderer, it can be handled inside `ScrollViewShadowNode`. Reviewed By: JoshuaGross Differential Revision: D26817121 fbshipit-source-id: ad48374ef19b802d25e919ac0aae05c5890762f2
44 lines
1.3 KiB
C++
44 lines
1.3 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/components/scrollview/ScrollViewEventEmitter.h>
|
|
#include <react/renderer/components/scrollview/ScrollViewProps.h>
|
|
#include <react/renderer/components/scrollview/ScrollViewState.h>
|
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
#include <react/renderer/core/LayoutContext.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
extern const char ScrollViewComponentName[];
|
|
|
|
/*
|
|
* `ShadowNode` for <ScrollView> component.
|
|
*/
|
|
class ScrollViewShadowNode final : public ConcreteViewShadowNode<
|
|
ScrollViewComponentName,
|
|
ScrollViewProps,
|
|
ScrollViewEventEmitter,
|
|
ScrollViewState> {
|
|
public:
|
|
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
|
|
#pragma mark - LayoutableShadowNode
|
|
|
|
void layout(LayoutContext layoutContext) override;
|
|
Point getContentOriginOffset() const override;
|
|
|
|
private:
|
|
void updateStateIfNeeded();
|
|
void updateScrollContentOffsetIfNeeded();
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|