Skip to content

Commit

Permalink
Add missing BaseViewManager props to BaseViewManagerDelegate (faceboo…
Browse files Browse the repository at this point in the history
…k#46934)

Summary:
Pull Request resolved: facebook#46934

BaseViewManagerDelegate is a handcrafted second source of truth, used specifically for codegen.

The organization here has some problems, but this diff adds the props currently missing from it, so that these work correctly in generated view managers.

Changelog:
[Android][Fixed] - Add missing BaseViewManager props to BaseViewManagerDelegate

Reviewed By: mdvacca

Differential Revision: D64137615

fbshipit-source-id: 4ff85f2524e5472f3b768e212fd5f2d4d9a36e17
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 11, 2024
1 parent 9119c32 commit 6741fd9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -938,4 +938,6 @@ public void setTouchEnd(@NonNull T view, boolean value) {
public void setTouchCancel(@NonNull T view, boolean value) {
// no-op, handled by JSResponder
}

// Please add new props to BaseViewManagerDelegate as well!
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public abstract class BaseViewManagerDelegate<
ViewProps.ACCESSIBILITY_COLLECTION_ITEM ->
mViewManager.setAccessibilityCollectionItem(view, value as ReadableMap?)

ViewProps.ACCESSIBILITY_VALUE ->
mViewManager.setAccessibilityValue(view, value as ReadableMap?)

ViewProps.BACKGROUND_COLOR ->
mViewManager.setBackgroundColor(
view, if (value == null) 0 else ColorPropConverter.getColor(value, view.context))
Expand All @@ -68,6 +71,10 @@ public abstract class BaseViewManagerDelegate<

ViewProps.ELEVATION -> mViewManager.setElevation(view, (value as Double?)?.toFloat() ?: 0.0f)

ViewProps.FILTER -> mViewManager.setFilter(view, value as ReadableArray?)

ViewProps.MIX_BLEND_MODE -> mViewManager.setMixBlendMode(view, value as String?)

ViewProps.SHADOW_COLOR ->
mViewManager.setShadowColor(
view, if (value == null) 0 else ColorPropConverter.getColor(value, view.context))
Expand All @@ -84,6 +91,18 @@ public abstract class BaseViewManagerDelegate<

ViewProps.OPACITY -> mViewManager.setOpacity(view, (value as Double?)?.toFloat() ?: 1.0f)

ViewProps.OUTLINE_COLOR -> mViewManager.setOutlineColor(view, value as Int?)

ViewProps.OUTLINE_OFFSET ->
mViewManager.setOutlineOffset(
view, (value as Double?)?.toFloat() ?: YogaConstants.UNDEFINED)

ViewProps.OUTLINE_STYLE -> mViewManager.setOutlineStyle(view, value as String?)

ViewProps.OUTLINE_WIDTH ->
mViewManager.setOutlineWidth(
view, (value as Double?)?.toFloat() ?: YogaConstants.UNDEFINED)

ViewProps.RENDER_TO_HARDWARE_TEXTURE ->
mViewManager.setRenderToHardwareTexture(view, value as Boolean? ?: false)

Expand All @@ -103,6 +122,22 @@ public abstract class BaseViewManagerDelegate<
mViewManager.setTranslateY(view, (value as Double?)?.toFloat() ?: 0.0f)

ViewProps.Z_INDEX -> mViewManager.setZIndex(view, (value as Double?)?.toFloat() ?: 0.0f)

// Experimental pointer events
"onPointerEnter" -> mViewManager.setPointerEnter(view, value as Boolean? ?: false)
"onPointerEnterCapture" ->
mViewManager.setPointerEnterCapture(view, value as Boolean? ?: false)
"onPointerOver" -> mViewManager.setPointerOver(view, value as Boolean? ?: false)
"onPointerOverCapture" -> mViewManager.setPointerOverCapture(view, value as Boolean? ?: false)
"onPointerOut" -> mViewManager.setPointerOut(view, value as Boolean? ?: false)
"onPointerOutCapture" -> mViewManager.setPointerOutCapture(view, value as Boolean? ?: false)
"onPointerLeave" -> mViewManager.setPointerLeave(view, value as Boolean? ?: false)
"onPointerLeaveCapture" ->
mViewManager.setPointerLeaveCapture(view, value as Boolean? ?: false)
"onPointerMove" -> mViewManager.setPointerMove(view, value as Boolean? ?: false)
"onPointerMoveCapture" -> mViewManager.setPointerMoveCapture(view, value as Boolean? ?: false)
"onClick" -> mViewManager.setClick(view, value as Boolean? ?: false)
"onClickCapture" -> mViewManager.setClickCapture(view, value as Boolean? ?: false)
}
}

Expand Down

0 comments on commit 6741fd9

Please sign in to comment.