Files
react-native/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js
T
Joshua Gross 4e243ca7a3 Fix RTL scrolling
Summary:
We recently fixed RTL scrolling in Fabric on iOS: D26608231 (https://github.com/facebook/react-native/commit/e5921f7f384af45df4f355fa3fa1b58a20a269d3)

Turns out, the mechanism for RTL scrolling on Android is completely different. It requires that content be wrapped in a "directional content view", which is `View` in LTR and `AndroidHorizontalScrollContentView` in RTL, backed by `ReactHorizontalScrollContainerView.java`.

iOS doesn't require that and just uses View and some custom logic in ScrollView itself.

In the future it would be great to align the platforms, but for now, for backwards-compat with non-Fabric and so we don't have to tear apart ScrollView.js, we codegen the AndroidHorizontalScrollContentView so it exists in C++, register the component, and stop mapping it to View explicitly in C++.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D26659686

fbshipit-source-id: 3b9c646dbdb7fe9527d24d42bdc6acb1aca00945
2021-02-25 10:09:32 -08:00

24 lines
642 B
JavaScript

/**
* 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.
*
* @format
* @flow strict-local
*/
import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
import type {ViewProps} from '../View/ViewPropTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
|}>;
type NativeType = HostComponent<NativeProps>;
export default (codegenNativeComponent<NativeProps>(
'AndroidHorizontalScrollContentView',
): NativeType);