Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<ScrollView/>: Add static ViewConfig for scrollEventThrottle #44366

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
validAttributes: {
decelerationRate: true,
disableIntervalMomentum: true,
maintainVisibleContentPosition: true,
endFillColor: {process: require('../../StyleSheet/processColor').default},
fadingEdgeLength: true,
nestedScrollEnabled: true,
Expand All @@ -31,6 +32,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
persistentScrollbar: true,
horizontal: true,
scrollEnabled: true,
scrollEventThrottle: true,
scrollPerfTag: true,
sendMomentumEvents: true,
showsHorizontalScrollIndicator: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ const validAttributesForEventProps = {

// Pointer events
onClick: true,
onClickCapture: true,
onPointerEnter: true,
onPointerEnterCapture: true,
onPointerLeave: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ const validAttributesForEventProps = ConditionallyIgnoredEventHandlers({

// Pointer events
onClick: true,
onClickCapture: true,
onPointerUp: true,
onPointerDown: true,
onPointerCancel: true,
Expand Down
133 changes: 133 additions & 0 deletions packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,55 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_SHADOW_PROPERTY(borderEndWidth, float)
RCT_EXPORT_SHADOW_PROPERTY(borderWidth, float)

RCT_CUSTOM_SHADOW_PROPERTY(inset, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetBlock, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetBlockStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetBlockEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetInline, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetInlineStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(insetInlineEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_EXPORT_SHADOW_PROPERTY(marginTop, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(marginRight, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(marginBottom, YGValue)
Expand All @@ -492,6 +541,48 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(margin, YGValue)

RCT_CUSTOM_SHADOW_PROPERTY(marginBlock, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(marginBlockEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(marginBlockStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(marginInline, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(marginInlineEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(marginInlineStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_EXPORT_SHADOW_PROPERTY(paddingTop, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(paddingRight, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, YGValue)
Expand All @@ -502,6 +593,48 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(padding, YGValue)

RCT_CUSTOM_SHADOW_PROPERTY(paddingBlock, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(paddingBlockEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(paddingBlockStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(paddingInline, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(paddingInlineEnd, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_CUSTOM_SHADOW_PROPERTY(paddingInlineStart, YGValue, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}

RCT_EXPORT_SHADOW_PROPERTY(flex, float)
RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float)
RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float)
Expand Down
13 changes: 12 additions & 1 deletion packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -4134,6 +4134,7 @@ public class com/facebook/react/uimanager/LayoutShadowNode : com/facebook/react/
public fun setAspectRatio (F)V
public fun setBorderWidths (IF)V
public fun setCollapsable (Z)V
public fun setCollapsableChildren (Z)V
public fun setColumnGap (Lcom/facebook/react/bridge/Dynamic;)V
public fun setDisplay (Ljava/lang/String;)V
public fun setFlex (F)V
Expand All @@ -4144,13 +4145,21 @@ public class com/facebook/react/uimanager/LayoutShadowNode : com/facebook/react/
public fun setFlexWrap (Ljava/lang/String;)V
public fun setGap (Lcom/facebook/react/bridge/Dynamic;)V
public fun setHeight (Lcom/facebook/react/bridge/Dynamic;)V
public fun setInset (Lcom/facebook/react/bridge/Dynamic;)V
public fun setInsetBlock (ILcom/facebook/react/bridge/Dynamic;)V
public fun setInsetInline (ILcom/facebook/react/bridge/Dynamic;)V
public fun setJustifyContent (Ljava/lang/String;)V
public fun setLayoutConformance (Ljava/lang/String;)V
public fun setMarginBlock (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMarginInline (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMargins (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMaxHeight (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMaxWidth (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMinHeight (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMinWidth (Lcom/facebook/react/bridge/Dynamic;)V
public fun setOverflow (Ljava/lang/String;)V
public fun setPaddingBlock (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPaddingInline (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPaddings (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPosition (Ljava/lang/String;)V
public fun setPositionValues (ILcom/facebook/react/bridge/Dynamic;)V
Expand Down Expand Up @@ -6305,6 +6314,7 @@ public class com/facebook/react/views/image/ReactImageManager : com/facebook/rea
public fun setResizeMethod (Lcom/facebook/react/views/image/ReactImageView;Ljava/lang/String;)V
public fun setResizeMode (Lcom/facebook/react/views/image/ReactImageView;Ljava/lang/String;)V
public fun setSource (Lcom/facebook/react/views/image/ReactImageView;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setSrc (Lcom/facebook/react/views/image/ReactImageView;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setTintColor (Lcom/facebook/react/views/image/ReactImageView;Ljava/lang/Integer;)V
}

Expand Down Expand Up @@ -6685,6 +6695,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager :
public fun setDecelerationRate (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;F)V
public fun setDisableIntervalMomentum (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;Z)V
public fun setFadingEdgeLength (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;I)V
public fun setHorizontal (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;Z)V
public fun setMaintainVisibleContentPosition (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;Lcom/facebook/react/bridge/ReadableMap;)V
public fun setNestedScrollEnabled (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;Z)V
public fun setOverScrollMode (Lcom/facebook/react/views/scroll/ReactHorizontalScrollView;Ljava/lang/String;)V
Expand Down Expand Up @@ -6920,6 +6931,7 @@ public class com/facebook/react/views/scroll/ReactScrollViewManager : com/facebo
public fun setDecelerationRate (Lcom/facebook/react/views/scroll/ReactScrollView;F)V
public fun setDisableIntervalMomentum (Lcom/facebook/react/views/scroll/ReactScrollView;Z)V
public fun setFadingEdgeLength (Lcom/facebook/react/views/scroll/ReactScrollView;I)V
public fun setHorizontal (Lcom/facebook/react/views/scroll/ReactScrollView;Z)V
public fun setIsInvertedVirtualizedList (Lcom/facebook/react/views/scroll/ReactScrollView;Z)V
public fun setMaintainVisibleContentPosition (Lcom/facebook/react/views/scroll/ReactScrollView;Lcom/facebook/react/bridge/ReadableMap;)V
public fun setNestedScrollEnabled (Lcom/facebook/react/views/scroll/ReactScrollView;Z)V
Expand Down Expand Up @@ -7935,7 +7947,6 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
public fun setTVPreferredFocus (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
protected synthetic fun setTransformProperty (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;)V
protected fun setTransformProperty (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setexperimental_layoutConformance (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;)V
}

public class com/facebook/react/views/view/ReactViewManager$$PropsSetter : com/facebook/react/uimanager/ViewManagerPropertyUpdater$ViewManagerSetter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ public void setMinWidth(Dynamic minWidth) {

boolean mCollapsable;

@ReactProp(name = "collapsableChildren")
public void setCollapsableChildren(boolean collapsableChildren) {
// Do Nothing: Align with static ViewConfigs

}

@ReactProp(name = "collapsable")
public void setCollapsable(boolean collapsable) {
mCollapsable = collapsable;
Expand Down Expand Up @@ -711,6 +717,71 @@ public void setDisplay(@Nullable String display) {
}
}

@ReactPropGroup(
names = {
"marginBlock",
"marginBlockEnd",
"marginBlockStart",
})
public void setMarginBlock(int index, Dynamic margin) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"marginInline",
"marginInlineEnd",
"marginInlineStart",
})
public void setMarginInline(int index, Dynamic margin) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"paddingBlock",
"paddingBlockEnd",
"paddingBlockStart",
})
public void setPaddingBlock(int index, Dynamic padding) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"paddingInline",
"paddingInlineEnd",
"paddingInlineStart",
})
public void setPaddingInline(int index, Dynamic padding) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"insetBlock",
"insetBlockEnd",
"insetBlockStart",
})
public void setInsetBlock(int index, Dynamic inset) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"insetInline",
"insetInlineEnd",
"insetInlineStart",
})
public void setInsetInline(int index, Dynamic inset) {
// Do Nothing: Align with static ViewConfigs
}

@ReactProp(name = "inset")
public void setInset(Dynamic inset) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
ViewProps.MARGIN,
Expand Down Expand Up @@ -889,19 +960,21 @@ public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) {

@ReactProp(name = "onPointerEnter")
public void setShouldNotifyPointerEnter(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
// Do Nothing: Align with static ViewConfigs
}

@ReactProp(name = "onPointerLeave")
public void setShouldNotifyPointerLeave(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
// Do Nothing: Align with static ViewConfigs
}

@ReactProp(name = "onPointerMove")
public void setShouldNotifyPointerMove(boolean value) {
// This method exists to inject Native View configs in RN Android VR
// DO NOTHING
// Do Nothing: Align with static ViewConfigs
}

@ReactProp(name = "experimental_layoutConformance")
public void setLayoutConformance(String value) {
// Do Nothing: Align with static ViewConfigs
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public void setAccessible(ReactImageView view, boolean accessible) {

// In JS this is Image.props.source
@ReactProp(name = "src")
public void setSrc(ReactImageView view, @Nullable ReadableArray sources) {
setSource(view, sources);
}

@ReactProp(name = "source")
public void setSource(ReactImageView view, @Nullable ReadableArray sources) {
view.setSource(sources);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,9 @@ public void setPointerEvents(ReactHorizontalScrollView view, @Nullable String po
public void setScrollEventThrottle(ReactHorizontalScrollView view, int scrollEventThrottle) {
view.setScrollEventThrottle(scrollEventThrottle);
}

@ReactProp(name = "horizontal")
public void setHorizontal(ReactHorizontalScrollView view, boolean horizontal) {
// Do Nothing: Align with static ViewConfigs
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ public void setScrollEventThrottle(ReactScrollView view, int scrollEventThrottle
view.setScrollEventThrottle(scrollEventThrottle);
}

@ReactProp(name = "horizontal")
public void setHorizontal(ReactScrollView view, boolean horizontal) {
// Do Nothing: Align with static ViewConfigs
}

@ReactProp(name = "isInvertedVirtualizedList")
public void setIsInvertedVirtualizedList(ReactScrollView view, boolean applyFix) {
// Usually when inverting the scroll view we are using scaleY: -1 on the list
Expand Down