Expose ScrollView's persistentScrollIndicator and horizontal to the C++ side props (#43655)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43655

## Changelog:
[Internal] -

The corresponding prop `ScrollBar.persistentScrollIndicator` was only passed to the Android platform code an `ScrollBar.horizontal` wasn't passed to native at all.

On other platforms we need those props to be available on the C++ side, so this exposes them to the corresponding C++ ScrollViewProps.

Reviewed By: sammy-SC

Differential Revision: D55367445

fbshipit-source-id: e8abca3a2b56a8e7c03593a6c4297f90749ac8fd
This commit is contained in:
Ruslan Shestopalyuk
2024-03-26 10:08:24 -07:00
committed by Facebook GitHub Bot
parent 3a0bf7d89e
commit a4592fdc1d
4 changed files with 29 additions and 1 deletions
@@ -29,6 +29,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
overScrollMode: true,
pagingEnabled: true,
persistentScrollbar: true,
horizontal: true,
scrollEnabled: true,
scrollPerfTag: true,
sendMomentumEvents: true,
@@ -72,6 +72,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
process: require('../../StyleSheet/processColor').default,
},
persistentScrollbar: true,
horizontal: true,
endFillColor: {
process: require('../../StyleSheet/processColor').default,
},
@@ -225,6 +225,23 @@ ScrollViewProps::ScrollViewProps(
"showsVerticalScrollIndicator",
sourceProps.showsVerticalScrollIndicator,
true)),
persistentScrollbar(
CoreFeatures::enablePropIteratorSetter
? sourceProps.persistentScrollbar
: convertRawProp(
context,
rawProps,
"persistentScrollbar",
sourceProps.persistentScrollbar,
true)),
horizontal(
CoreFeatures::enablePropIteratorSetter ? sourceProps.horizontal
: convertRawProp(
context,
rawProps,
"horizontal",
sourceProps.horizontal,
true)),
scrollEventThrottle(
CoreFeatures::enablePropIteratorSetter
? sourceProps.scrollEventThrottle
@@ -383,7 +400,8 @@ void ScrollViewProps::setProp(
RAW_SET_PROP_SWITCH_CASE_BASIC(pinchGestureEnabled);
RAW_SET_PROP_SWITCH_CASE_BASIC(scrollsToTop);
RAW_SET_PROP_SWITCH_CASE_BASIC(showsHorizontalScrollIndicator);
RAW_SET_PROP_SWITCH_CASE_BASIC(showsVerticalScrollIndicator);
RAW_SET_PROP_SWITCH_CASE_BASIC(persistentScrollbar);
RAW_SET_PROP_SWITCH_CASE_BASIC(horizontal);
RAW_SET_PROP_SWITCH_CASE_BASIC(scrollEventThrottle);
RAW_SET_PROP_SWITCH_CASE_BASIC(zoomScale);
RAW_SET_PROP_SWITCH_CASE_BASIC(contentInset);
@@ -489,6 +507,12 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
"showsVerticalScrollIndicator",
showsVerticalScrollIndicator,
defaultScrollViewProps.showsVerticalScrollIndicator),
debugStringConvertibleItem(
"persistentScrollbar",
persistentScrollbar,
defaultScrollViewProps.persistentScrollbar),
debugStringConvertibleItem(
"horizontal", horizontal, defaultScrollViewProps.horizontal),
debugStringConvertibleItem(
"scrollEventThrottle",
scrollEventThrottle,
@@ -56,6 +56,8 @@ class ScrollViewProps final : public ViewProps {
bool scrollsToTop{true};
bool showsHorizontalScrollIndicator{true};
bool showsVerticalScrollIndicator{true};
bool persistentScrollbar{false};
bool horizontal{false};
Float scrollEventThrottle{};
Float zoomScale{1.0f};
EdgeInsets contentInset{};