Use ViewManagerDelegate if provided instead of $$PropsSetter to update view props

Summary:
This diff introduces an interface `ViewManagerDelegate` and its base implementation `BaseViewManagerDelegate`, which is used as a parent class for all view manager delegates generated by the JS codegen. Before the changes in this diff, generated delegates didn't support setting the base view properties such as background color, rotation, opacity, etc. Now it's possible to do by using `BaseViewManagerDelegate.setProperty(...)`, and since all generated delegates extend BaseViewManagerDelegate, they can just call `super.setProperty(...)` for properties they don't want to handle.

This diff also introduced a new method `ViewManager.getDelegate()`. This will allow view managers to return an instance of the delegate generated by JS and ensure that the view properties are set in a type-safe manner. If this method returns null (it does by default), we fall back to the default implementation of setting view properties using Java-generated `$$PropsSetter`
classes.

This is an example of an interface class generated by JS:

```
public interface RCTAxialGradientViewViewManagerInterface<T extends View> {
  void setColors(T view, Nullable ReadableArray value);
  void setLocations(T view, Nullable ReadableArray value);
  void setEndX(T view, Float value);
  void setEndY(T view, Float value);
  void setStartX(T view, Float value);
  void setStartY(T view, Float value);
}
```

This is an example of a delegate class generated by JS:

```
public class RCTAxialGradientViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RCTAxialGradientViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
  public RCTAxialGradientViewManagerDelegate(U viewManager) {
    super(viewManager);
  }
  Override
  public void setProperty(T view, String propName, Nullable Object value) {
    switch (propName) {
      case "colors":
        mViewManager.setColors(view, (ReadableArray) value);
        break;
      case "locations":
        mViewManager.setLocations(view, (ReadableArray) value);
        break;
      case "endX":
        mViewManager.setEndX(view, value == null ? Float.NaN : ((Double) value).floatValue());
        break;
      case "endY":
        mViewManager.setEndY(view, value == null ? Float.NaN : ((Double) value).floatValue());
        break;
      case "startX":
        mViewManager.setStartX(view, value == null ? Float.NaN : ((Double) value).floatValue());
        break;
      case "startY":
        mViewManager.setStartY(view, value == null ? Float.NaN : ((Double) value).floatValue());
        break;
      default:
        super.setProperty(view, propName, value);
    }
  }
}
```

NOTE: What if a view manager, for instance ReactAxialGradientManager, wanted to add support for the borderRadius prop? In the old Java codegen, it would just need to create a method and annotate it with ReactProp (name = ViewProps.BORDER_RADIUS) and $$PropsSetter would call this method when a property with this name must be set. With the new JS codegen, borderRadius is a part of the basic view props, so setBorderRadius is not generated as a part of the ViewManagerInterface, so it’s not possible to set this value. I see two options: 1) add a method boolean setProperty (String propName, Object value) and let the view manager handle it in a non-type safe way (return true if it’s been handled). 2) Generate BaseViewManagerInterface which will include all basic view props and make BaseViewManager implement this interface, leaving all methods empty so that it stays compatible with the current implementation. Override these methods in a view manager that needs to handle a specific property in a custom way (so we would override setBorderRadius in ReactAxialGradientManager).

Reviewed By: mdvacca

Differential Revision: D16667686

fbshipit-source-id: 06a15a92f8af55640b7a53c5a34f40366d1be2a8
This commit is contained in:
Oleksandr Melnykov 2019-08-12 06:32:20 -07:00 коммит произвёл Facebook Github Bot
Родитель bef87b648c
Коммит 50fe8119de
39 изменённых файлов: 596 добавлений и 239 удалений

Просмотреть файл

@ -34,35 +34,9 @@ import java.util.Map;
public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode>
extends ViewManager<T, C> {
private static final String PROP_BACKGROUND_COLOR = ViewProps.BACKGROUND_COLOR;
private static final String PROP_TRANSFORM = "transform";
private static final String PROP_ELEVATION = "elevation";
private static final String PROP_Z_INDEX = "zIndex";
private static final String PROP_RENDER_TO_HARDWARE_TEXTURE = "renderToHardwareTextureAndroid";
private static final String PROP_ACCESSIBILITY_LABEL = "accessibilityLabel";
private static final String PROP_ACCESSIBILITY_HINT = "accessibilityHint";
private static final String PROP_ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion";
private static final String PROP_ACCESSIBILITY_ROLE = "accessibilityRole";
private static final String PROP_ACCESSIBILITY_STATES = "accessibilityStates";
private static final String PROP_ACCESSIBILITY_STATE = "accessibilityState";
private static final String PROP_ACCESSIBILITY_ACTIONS = "accessibilityActions";
private static final String PROP_IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility";
// DEPRECATED
private static final String PROP_ROTATION = "rotation";
private static final String PROP_SCALE_X = "scaleX";
private static final String PROP_SCALE_Y = "scaleY";
private static final String PROP_TRANSLATE_X = "translateX";
private static final String PROP_TRANSLATE_Y = "translateY";
private static final int PERSPECTIVE_ARRAY_INVERTED_CAMERA_DISTANCE_INDEX = 2;
private static final float CAMERA_DISTANCE_NORMALIZATION_MULTIPLIER = (float) Math.sqrt(5);
/** Used to locate views in end-to-end (UI) tests. */
public static final String PROP_TEST_ID = "testID";
public static final String PROP_NATIVE_ID = "nativeID";
private static MatrixMathHelper.MatrixDecompositionContext sMatrixDecompositionContext =
new MatrixMathHelper.MatrixDecompositionContext();
private static double[] sTransformDecompositionArray = new double[16];
@ -84,12 +58,15 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
private static final String STATE_EXPANDED = "expanded";
private static final String STATE_MIXED = "mixed";
@ReactProp(name = PROP_BACKGROUND_COLOR, defaultInt = Color.TRANSPARENT, customType = "Color")
@ReactProp(
name = ViewProps.BACKGROUND_COLOR,
defaultInt = Color.TRANSPARENT,
customType = "Color")
public void setBackgroundColor(@NonNull T view, int backgroundColor) {
view.setBackgroundColor(backgroundColor);
}
@ReactProp(name = PROP_TRANSFORM)
@ReactProp(name = ViewProps.TRANSFORM)
public void setTransform(@NonNull T view, @Nullable ReadableArray matrix) {
if (matrix == null) {
resetTransformProperty(view);
@ -103,12 +80,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setAlpha(opacity);
}
@ReactProp(name = PROP_ELEVATION)
@ReactProp(name = ViewProps.ELEVATION)
public void setElevation(@NonNull T view, float elevation) {
ViewCompat.setElevation(view, PixelUtil.toPixelFromDIP(elevation));
}
@ReactProp(name = PROP_Z_INDEX)
@ReactProp(name = ViewProps.Z_INDEX)
public void setZIndex(@NonNull T view, float zIndex) {
int integerZIndex = Math.round(zIndex);
ViewGroupManager.setViewZIndex(view, integerZIndex);
@ -118,12 +95,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
}
@ReactProp(name = PROP_RENDER_TO_HARDWARE_TEXTURE)
@ReactProp(name = ViewProps.RENDER_TO_HARDWARE_TEXTURE)
public void setRenderToHardwareTexture(@NonNull T view, boolean useHWTexture) {
view.setLayerType(useHWTexture ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
}
@ReactProp(name = PROP_TEST_ID)
@ReactProp(name = ViewProps.TEST_ID)
public void setTestId(@NonNull T view, String testId) {
view.setTag(R.id.react_test_id, testId);
@ -131,25 +108,25 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setTag(testId);
}
@ReactProp(name = PROP_NATIVE_ID)
@ReactProp(name = ViewProps.NATIVE_ID)
public void setNativeId(@NonNull T view, String nativeId) {
view.setTag(R.id.view_tag_native_id, nativeId);
ReactFindViewUtil.notifyViewRendered(view);
}
@ReactProp(name = PROP_ACCESSIBILITY_LABEL)
@ReactProp(name = ViewProps.ACCESSIBILITY_LABEL)
public void setAccessibilityLabel(@NonNull T view, String accessibilityLabel) {
view.setTag(R.id.accessibility_label, accessibilityLabel);
updateViewContentDescription(view);
}
@ReactProp(name = PROP_ACCESSIBILITY_HINT)
@ReactProp(name = ViewProps.ACCESSIBILITY_HINT)
public void setAccessibilityHint(@NonNull T view, String accessibilityHint) {
view.setTag(R.id.accessibility_hint, accessibilityHint);
updateViewContentDescription(view);
}
@ReactProp(name = PROP_ACCESSIBILITY_ROLE)
@ReactProp(name = ViewProps.ACCESSIBILITY_ROLE)
public void setAccessibilityRole(@NonNull T view, @Nullable String accessibilityRole) {
if (accessibilityRole == null) {
return;
@ -157,7 +134,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setTag(R.id.accessibility_role, AccessibilityRole.fromValue(accessibilityRole));
}
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
@ReactProp(name = ViewProps.ACCESSIBILITY_STATES)
public void setViewStates(@NonNull T view, @Nullable ReadableArray accessibilityStates) {
boolean shouldUpdateContentDescription =
view.getTag(R.id.accessibility_states) != null && accessibilityStates == null;
@ -182,7 +159,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
}
@ReactProp(name = PROP_ACCESSIBILITY_STATE)
@ReactProp(name = ViewProps.ACCESSIBILITY_STATE)
public void setViewState(@NonNull T view, @Nullable ReadableMap accessibilityState) {
if (accessibilityState == null) {
return;
@ -257,7 +234,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
}
@ReactProp(name = PROP_ACCESSIBILITY_ACTIONS)
@ReactProp(name = ViewProps.ACCESSIBILITY_ACTIONS)
public void setAccessibilityActions(T view, ReadableArray accessibilityActions) {
if (accessibilityActions == null) {
return;
@ -266,7 +243,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setTag(R.id.accessibility_actions, accessibilityActions);
}
@ReactProp(name = PROP_IMPORTANT_FOR_ACCESSIBILITY)
@ReactProp(name = ViewProps.IMPORTANT_FOR_ACCESSIBILITY)
public void setImportantForAccessibility(
@NonNull T view, @Nullable String importantForAccessibility) {
if (importantForAccessibility == null || importantForAccessibility.equals("auto")) {
@ -282,36 +259,36 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
}
@Deprecated
@ReactProp(name = PROP_ROTATION)
@ReactProp(name = ViewProps.ROTATION)
public void setRotation(@NonNull T view, float rotation) {
view.setRotation(rotation);
}
@Deprecated
@ReactProp(name = PROP_SCALE_X, defaultFloat = 1f)
@ReactProp(name = ViewProps.SCALE_X, defaultFloat = 1f)
public void setScaleX(@NonNull T view, float scaleX) {
view.setScaleX(scaleX);
}
@Deprecated
@ReactProp(name = PROP_SCALE_Y, defaultFloat = 1f)
@ReactProp(name = ViewProps.SCALE_Y, defaultFloat = 1f)
public void setScaleY(@NonNull T view, float scaleY) {
view.setScaleY(scaleY);
}
@Deprecated
@ReactProp(name = PROP_TRANSLATE_X, defaultFloat = 0f)
@ReactProp(name = ViewProps.TRANSLATE_X, defaultFloat = 0f)
public void setTranslateX(@NonNull T view, float translateX) {
view.setTranslationX(PixelUtil.toPixelFromDIP(translateX));
}
@Deprecated
@ReactProp(name = PROP_TRANSLATE_Y, defaultFloat = 0f)
@ReactProp(name = ViewProps.TRANSLATE_Y, defaultFloat = 0f)
public void setTranslateY(@NonNull T view, float translateY) {
view.setTranslationY(PixelUtil.toPixelFromDIP(translateY));
}
@ReactProp(name = PROP_ACCESSIBILITY_LIVE_REGION)
@ReactProp(name = ViewProps.ACCESSIBILITY_LIVE_REGION)
public void setAccessibilityLiveRegion(@NonNull T view, @Nullable String liveRegion) {
if (liveRegion == null || liveRegion.equals("none")) {
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);

Просмотреть файл

@ -0,0 +1,90 @@
package com.facebook.react.uimanager;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
/**
* This is a base implementation of {@link ViewManagerDelegate} which supports setting properties
* that every view should support, such as rotation, background color, etc.
*/
public abstract class BaseViewManagerDelegate<
T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode>>
implements ViewManagerDelegate<T> {
protected final U mViewManager;
public BaseViewManagerDelegate(U viewManager) {
mViewManager = viewManager;
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case ViewProps.ACCESSIBILITY_ACTIONS:
mViewManager.setAccessibilityActions(view, (ReadableArray) value);
break;
case ViewProps.ACCESSIBILITY_HINT:
mViewManager.setAccessibilityHint(view, (String) value);
break;
case ViewProps.ACCESSIBILITY_LABEL:
mViewManager.setAccessibilityLabel(view, (String) value);
break;
case ViewProps.ACCESSIBILITY_LIVE_REGION:
mViewManager.setAccessibilityLiveRegion(view, (String) value);
break;
case ViewProps.ACCESSIBILITY_ROLE:
mViewManager.setAccessibilityRole(view, (String) value);
break;
case ViewProps.ACCESSIBILITY_STATE:
mViewManager.setViewState(view, (ReadableMap) value);
break;
case ViewProps.ACCESSIBILITY_STATES:
mViewManager.setViewStates(view, (ReadableArray) value);
break;
case ViewProps.BACKGROUND_COLOR:
mViewManager.setBackgroundColor(view, value == null ? 0 : ((Double) value).intValue());
break;
case ViewProps.ELEVATION:
mViewManager.setElevation(view, value == null ? 0.0f : ((Double) value).floatValue());
break;
case ViewProps.IMPORTANT_FOR_ACCESSIBILITY:
mViewManager.setImportantForAccessibility(view, (String) value);
break;
case ViewProps.NATIVE_ID:
mViewManager.setNativeId(view, (String) value);
break;
case ViewProps.OPACITY:
mViewManager.setOpacity(view, value == null ? 1.0f : ((Double) value).floatValue());
break;
case ViewProps.RENDER_TO_HARDWARE_TEXTURE:
//noinspection SimplifiableConditionalExpression
mViewManager.setRenderToHardwareTexture(view, value == null ? false : (boolean) value);
break;
case ViewProps.ROTATION:
mViewManager.setRotation(view, value == null ? 0.0f : ((Double) value).floatValue());
break;
case ViewProps.SCALE_X:
mViewManager.setScaleX(view, value == null ? 1.0f : ((Double) value).floatValue());
break;
case ViewProps.SCALE_Y:
mViewManager.setScaleY(view, value == null ? 1.0f : ((Double) value).floatValue());
break;
case ViewProps.TEST_ID:
mViewManager.setTestId(view, (String) value);
break;
case ViewProps.TRANSFORM:
mViewManager.setTransform(view, (ReadableArray) value);
break;
case ViewProps.TRANSLATE_X:
mViewManager.setTranslateX(view, value == null ? 0.0f : ((Double) value).floatValue());
break;
case ViewProps.TRANSLATE_Y:
mViewManager.setTranslateY(view, value == null ? 0.0f : ((Double) value).floatValue());
break;
case ViewProps.Z_INDEX:
mViewManager.setZIndex(view, value == null ? 0.0f : ((Double) value).floatValue());
break;
}
}
}

Просмотреть файл

@ -40,10 +40,32 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* @param stateWrapper
*/
public void updateProperties(@NonNull T viewToUpdate, ReactStylesDiffMap props) {
ViewManagerPropertyUpdater.updateProps(this, viewToUpdate, props);
final ViewManagerDelegate<T> delegate = getDelegate();
if (delegate != null) {
ViewManagerPropertyUpdater.updateProps(delegate, viewToUpdate, props);
} else {
ViewManagerPropertyUpdater.updateProps(this, viewToUpdate, props);
}
onAfterUpdateTransaction(viewToUpdate);
}
/**
* Override this method and return an instance of {@link ViewManagerDelegate} if the props of the
* view managed by this view manager should be set via this delegate. The provided instance will
* then get calls to {@link ViewManagerDelegate#setProperty(View, String, Object)} for every prop
* that must be updated and it's the delegate's responsibility to apply these values to the view.
*
* <p>By default this method returns {@code null}, which means that the view manager doesn't have
* a delegate and the view props should be set internally by the view manager itself.
*
* @return an instance of {@link ViewManagerDelegate} if the props of the view managed by this
* view manager should be set via this delegate
*/
@Nullable
protected ViewManagerDelegate<T> getDelegate() {
return null;
}
/** Creates a view and installs event emitters on it. */
private final @NonNull T createView(
@NonNull ThemedReactContext reactContext, JSResponderHandler jsResponderHandler) {

Просмотреть файл

@ -0,0 +1,14 @@
package com.facebook.react.uimanager;
import android.view.View;
import androidx.annotation.Nullable;
/**
* This is an interface that must be implemented by classes that wish to take over the
* responsibility of setting properties of all views managed by the view manager.
*
* @param <T> the type of the view supported by this delegate
*/
public interface ViewManagerDelegate<T extends View> {
void setProperty(T view, String propName, @Nullable Object value);
}

Просмотреть файл

@ -36,6 +36,15 @@ public class ViewManagerPropertyUpdater {
SHADOW_NODE_SETTER_MAP.clear();
}
public static <T extends ViewManagerDelegate<V>, V extends View> void updateProps(
T delegate, V v, ReactStylesDiffMap props) {
Iterator<Map.Entry<String, Object>> iterator = props.mBackingMap.getEntryIterator();
while (iterator.hasNext()) {
Map.Entry<String, Object> entry = iterator.next();
delegate.setProperty(v, entry.getKey(), entry.getValue());
}
}
public static <T extends ViewManager, V extends View> void updateProps(
T manager, V v, ReactStylesDiffMap props) {
ViewManagerSetter<T, V> setter = findManagerSetter(manager.getClass());

Просмотреть файл

@ -131,6 +131,31 @@ public class ViewProps {
public static final String BORDER_END_COLOR = "borderEndColor";
public static final String ON_LAYOUT = "onLayout";
public static final String TRANSFORM = "transform";
public static final String ELEVATION = "elevation";
public static final String Z_INDEX = "zIndex";
public static final String RENDER_TO_HARDWARE_TEXTURE = "renderToHardwareTextureAndroid";
public static final String ACCESSIBILITY_LABEL = "accessibilityLabel";
public static final String ACCESSIBILITY_HINT = "accessibilityHint";
public static final String ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion";
public static final String ACCESSIBILITY_ROLE = "accessibilityRole";
public static final String ACCESSIBILITY_STATES = "accessibilityStates";
public static final String ACCESSIBILITY_STATE = "accessibilityState";
public static final String ACCESSIBILITY_ACTIONS = "accessibilityActions";
public static final String IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility";
// DEPRECATED
public static final String ROTATION = "rotation";
public static final String SCALE_X = "scaleX";
public static final String SCALE_Y = "scaleY";
public static final String TRANSLATE_X = "translateX";
public static final String TRANSLATE_Y = "translateY";
/** Used to locate views in end-to-end (UI) tests. */
public static final String TEST_ID = "testID";
public static final String NATIVE_ID = "nativeID";
public static final int[] BORDER_SPACING_TYPES = {
Spacing.ALL,
Spacing.START,

Просмотреть файл

@ -270,6 +270,7 @@ def rn_codegen(
deps = [
react_native_dep("third-party/android/androidx:annotation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/uimanager:uimanager"),
],
)

Просмотреть файл

@ -8,7 +8,7 @@ import com.facebook.react.viewmanagers.ArrayPropsNativeComponentViewManagerInter
public class ArrayPropsNativeComponentViewManager extends SimpleViewManager<ViewGroup>
implements ArrayPropsNativeComponentViewManagerInterface<ViewGroup> {
public static final String REACT_CLASS = "ArrayPropsNativeComponent";
public static final String REACT_CLASS = "ArrayPropsNativeComponentView";
@Override
public String getName() {
@ -16,8 +16,8 @@ public class ArrayPropsNativeComponentViewManager extends SimpleViewManager<View
}
private void test() {
ArrayPropsNativeComponentViewManagerDelegate delegate =
new ArrayPropsNativeComponentViewManagerDelegate<ViewGroup>();
ArrayPropsNativeComponentViewManagerDelegate<ViewGroup, ArrayPropsNativeComponentViewManager>
delegate = new ArrayPropsNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -6,6 +6,7 @@ import com.facebook.react.viewmanagers.BooleanPropNativeComponentViewManagerInte
public class BooleanPropNativeComponentViewManager extends SimpleViewManager<ViewGroup>
implements BooleanPropNativeComponentViewManagerInterface<ViewGroup> {
public static final String REACT_CLASS = "BooleanPropNativeComponentView";
@Override
@ -14,8 +15,8 @@ public class BooleanPropNativeComponentViewManager extends SimpleViewManager<Vie
}
private void test() {
BooleanPropNativeComponentViewManagerDelegate delegate =
new BooleanPropNativeComponentViewManagerDelegate<ViewGroup>();
BooleanPropNativeComponentViewManagerDelegate<ViewGroup, BooleanPropNativeComponentViewManager>
delegate = new BooleanPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class ColorPropNativeComponentViewManager extends SimpleViewManager<ViewG
}
private void test() {
ColorPropNativeComponentViewManagerDelegate delegate =
new ColorPropNativeComponentViewManagerDelegate<ViewGroup>();
ColorPropNativeComponentViewManagerDelegate<ViewGroup, ColorPropNativeComponentViewManager>
delegate = new ColorPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class EnumPropNativeComponentViewManager extends SimpleViewManager<ViewGr
}
private void test() {
EnumPropNativeComponentViewManagerDelegate delegate =
new EnumPropNativeComponentViewManagerDelegate<ViewGroup>();
EnumPropNativeComponentViewManagerDelegate<ViewGroup, EnumPropNativeComponentViewManager>
delegate = new EnumPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,9 @@ public class EventNestedObjectPropsNativeComponentViewManager extends SimpleView
}
private void test() {
EventNestedObjectPropsNativeComponentViewManagerDelegate delegate =
new EventNestedObjectPropsNativeComponentViewManagerDelegate<ViewGroup>();
EventNestedObjectPropsNativeComponentViewManagerDelegate<
ViewGroup, EventNestedObjectPropsNativeComponentViewManager>
delegate = new EventNestedObjectPropsNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class EventPropsNativeComponentViewManager extends SimpleViewManager<View
}
private void test() {
EventPropsNativeComponentViewManagerDelegate delegate =
new EventPropsNativeComponentViewManagerDelegate<ViewGroup>();
EventPropsNativeComponentViewManagerDelegate<ViewGroup, EventPropsNativeComponentViewManager>
delegate = new EventPropsNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class FloatPropsNativeComponentViewManager extends SimpleViewManager<View
}
private void test() {
FloatPropsNativeComponentViewManagerDelegate delegate =
new FloatPropsNativeComponentViewManagerDelegate<ViewGroup>();
FloatPropsNativeComponentViewManagerDelegate<ViewGroup, FloatPropsNativeComponentViewManager>
delegate = new FloatPropsNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -16,8 +16,8 @@ public class ImagePropNativeComponentViewManager extends SimpleViewManager<ViewG
}
private void test() {
ImagePropNativeComponentViewManagerDelegate delegate =
new ImagePropNativeComponentViewManagerDelegate<ViewGroup>();
ImagePropNativeComponentViewManagerDelegate<ViewGroup, ImagePropNativeComponentViewManager>
delegate = new ImagePropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class IntegerPropNativeComponentViewManager extends SimpleViewManager<Vie
}
private void test() {
IntegerPropNativeComponentViewManagerDelegate delegate =
new IntegerPropNativeComponentViewManagerDelegate<ViewGroup>();
IntegerPropNativeComponentViewManagerDelegate<ViewGroup, IntegerPropNativeComponentViewManager>
delegate = new IntegerPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,9 @@ public class InterfaceOnlyNativeComponentViewManager extends SimpleViewManager<V
}
private void test() {
InterfaceOnlyNativeComponentViewManagerDelegate delegate =
new InterfaceOnlyNativeComponentViewManagerDelegate<ViewGroup>();
InterfaceOnlyNativeComponentViewManagerDelegate<
ViewGroup, InterfaceOnlyNativeComponentViewManager>
delegate = new InterfaceOnlyNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -16,8 +16,9 @@ public class MultiNativePropNativeComponentViewManager extends SimpleViewManager
}
private void test() {
MultiNativePropNativeComponentViewManagerDelegate delegate =
new MultiNativePropNativeComponentViewManagerDelegate<ViewGroup>();
MultiNativePropNativeComponentViewManagerDelegate<
ViewGroup, MultiNativePropNativeComponentViewManager>
delegate = new MultiNativePropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,9 @@ public class NoPropsNoEventsNativeComponentViewManager extends SimpleViewManager
}
private void test() {
NoPropsNoEventsNativeComponentViewManagerDelegate delegate =
new NoPropsNoEventsNativeComponentViewManagerDelegate<ViewGroup>();
NoPropsNoEventsNativeComponentViewManagerDelegate<
ViewGroup, NoPropsNoEventsNativeComponentViewManager>
delegate = new NoPropsNoEventsNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -16,8 +16,8 @@ public class PointPropNativeComponentViewManager extends SimpleViewManager<ViewG
}
private void test() {
PointPropNativeComponentViewManagerDelegate delegate =
new PointPropNativeComponentViewManagerDelegate<ViewGroup>();
PointPropNativeComponentViewManagerDelegate<ViewGroup, PointPropNativeComponentViewManager>
delegate = new PointPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -15,8 +15,8 @@ public class StringPropNativeComponentViewManager extends SimpleViewManager<View
}
private void test() {
StringPropNativeComponentViewManagerDelegate delegate =
new StringPropNativeComponentViewManagerDelegate<ViewGroup>();
StringPropNativeComponentViewManagerDelegate<ViewGroup, StringPropNativeComponentViewManager>
delegate = new StringPropNativeComponentViewManagerDelegate<>(this);
}
@Override

Просмотреть файл

@ -39,5 +39,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'ArrayPropsNativeComponent',
'ArrayPropsNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -23,5 +23,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'BooleanPropNativeComponent',
'BooleanPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -23,5 +23,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'ColorPropNativeComponent',
'ColorPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -23,5 +23,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'EnumPropNativeComponent',
'EnumPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -40,5 +40,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'EventNestedObjectPropsNativeComponent',
'EventNestedObjectPropsNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -61,5 +61,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'EventPropsNativeComponent',
'EventPropsNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -31,5 +31,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'FloatPropsNativeComponent',
'FloatPropsNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -23,5 +23,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'ImagePropNativeComponent',
'ImagePropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -28,5 +28,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'IntegerPropNativeComponent',
'IntegerPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -29,7 +29,7 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'InterfaceOnlyNativeComponent',
'InterfaceOnlyNativeComponentView',
{
interfaceOnly: true,
paperComponentName: 'RCTInterfaceOnlyComponent',

Просмотреть файл

@ -30,5 +30,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'MultiNativePropNativeComponent',
'MultiNativePropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -21,5 +21,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'NoPropsNoEventsNativeComponent',
'NoPropsNoEventsNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -23,5 +23,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'PointPropNativeComponent',
'PointPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -24,5 +24,5 @@ type NativeProps = $ReadOnly<{|
|}>;
export default (codegenNativeComponent<NativeProps>(
'StringPropNativeComponent',
'StringPropNativeComponentView',
): NativeComponentType<NativeProps>);

Просмотреть файл

@ -26,13 +26,17 @@ package com.facebook.react.viewmanagers;
::_IMPORTS_::
public class ::_CLASSNAME_::<T extends ::_EXTEND_CLASSES_::> {
public class ::_CLASSNAME_::<T extends ::_EXTEND_CLASSES_::, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ::_INTERFACE_CLASSNAME_::<T>> extends BaseViewManagerDelegate<T, U> {
public ::_CLASSNAME_::(U viewManager) {
super(viewManager);
}
::_METHODS_::
}
`;
const propSetterTemplate = `
public void setProperty(::_INTERFACE_CLASSNAME_::<T> viewManager, T view, String propName, Object value) {
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
::_PROP_CASES_::
}
`;
@ -104,7 +108,7 @@ function generatePropCasesString(
const cases = component.props
.map(prop => {
return `case "${prop.name}":
viewManager.set${toSafeJavaString(
mViewManager.set${toSafeJavaString(
prop.name,
)}(view, ${getJavaValueForProp(prop, componentName)});
break;`;
@ -113,6 +117,8 @@ function generatePropCasesString(
return `switch (propName) {
${cases}
default:
super.setProperty(view, propName, value);
}`;
}
@ -192,6 +198,10 @@ function getDelegateImports(component) {
if (component.commands.length > 0) {
imports.add('import com.facebook.react.bridge.ReadableArray;');
}
imports.add('import androidx.annotation.Nullable;');
imports.add('import com.facebook.react.uimanager.BaseViewManager;');
imports.add('import com.facebook.react.uimanager.BaseViewManagerDelegate;');
imports.add('import com.facebook.react.uimanager.LayoutShadowNode;');
return imports;
}
@ -223,8 +233,8 @@ module.exports = {
return Object.keys(components).forEach(componentName => {
const component = components[componentName];
const className = `${componentName}ViewManagerDelegate`;
const interfaceClassName = `${componentName}ViewManagerInterface`;
const className = `${componentName}ManagerDelegate`;
const interfaceClassName = `${componentName}ManagerInterface`;
const fileName = `${className}.java`;
const imports = getDelegateImports(component);

Просмотреть файл

@ -173,7 +173,7 @@ module.exports = {
return Object.keys(components).forEach(componentName => {
const component = components[componentName];
const className = `${componentName}ViewManagerInterface`;
const className = `${componentName}ManagerInterface`;
const fileName = `${className}.java`;
const imports = getImports(component);

Просмотреть файл

@ -2,39 +2,49 @@
exports[`GeneratePropsJavaDelegate can generate fixture ARRAY_PROPS 1`] = `
Map {
"ArrayPropsNativeComponentViewManagerDelegate.java" => "
"ArrayPropsNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class ArrayPropsNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(ArrayPropsNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class ArrayPropsNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ArrayPropsNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public ArrayPropsNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"names\\":
viewManager.setNames(view, (ReadableArray) value);
mViewManager.setNames(view, (ReadableArray) value);
break;
case \\"disableds\\":
viewManager.setDisableds(view, (ReadableArray) value);
mViewManager.setDisableds(view, (ReadableArray) value);
break;
case \\"progress\\":
viewManager.setProgress(view, (ReadableArray) value);
mViewManager.setProgress(view, (ReadableArray) value);
break;
case \\"radii\\":
viewManager.setRadii(view, (ReadableArray) value);
mViewManager.setRadii(view, (ReadableArray) value);
break;
case \\"colors\\":
viewManager.setColors(view, (ReadableArray) value);
mViewManager.setColors(view, (ReadableArray) value);
break;
case \\"srcs\\":
viewManager.setSrcs(view, (ReadableArray) value);
mViewManager.setSrcs(view, (ReadableArray) value);
break;
case \\"points\\":
viewManager.setPoints(view, (ReadableArray) value);
mViewManager.setPoints(view, (ReadableArray) value);
break;
case \\"sizes\\":
viewManager.setSizes(view, (ReadableArray) value);
mViewManager.setSizes(view, (ReadableArray) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -44,17 +54,27 @@ public class ArrayPropsNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture BOOLEAN_PROP 1`] = `
Map {
"BooleanPropNativeComponentViewManagerDelegate.java" => "
"BooleanPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class BooleanPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(BooleanPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class BooleanPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & BooleanPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public BooleanPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? false : (boolean) value);
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -64,17 +84,27 @@ public class BooleanPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture COLOR_PROP 1`] = `
Map {
"ColorPropNativeComponentViewManagerDelegate.java" => "
"ColorPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class ColorPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(ColorPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class ColorPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ColorPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public ColorPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"tintColor\\":
viewManager.setTintColor(view, value == null ? null : ((Double) value).intValue());
mViewManager.setTintColor(view, value == null ? null : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -84,18 +114,26 @@ public class ColorPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture COMMANDS 1`] = `
Map {
"CommandNativeComponentViewManagerDelegate.java" => "
"CommandNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class CommandNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(CommandNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class CommandNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & CommandNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public CommandNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
// No props
}
public void receiveCommand(CommandNativeComponentViewManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
public void receiveCommand(CommandNativeComponentManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
case \\"flashScrollIndicators\\":
viewManager.flashScrollIndicators(view);
break;
@ -110,22 +148,32 @@ public class CommandNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture COMMANDS_AND_PROPS 1`] = `
Map {
"CommandNativeComponentViewManagerDelegate.java" => "
"CommandNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class CommandNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(CommandNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class CommandNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & CommandNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public CommandNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"accessibilityHint\\":
viewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
mViewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
public void receiveCommand(CommandNativeComponentViewManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
public void receiveCommand(CommandNativeComponentManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
case \\"hotspotUpdate\\":
viewManager.hotspotUpdate(view, args.getInt(0), args.getInt(1));
break;
@ -137,17 +185,27 @@ public class CommandNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture ENUM_PROP 1`] = `
Map {
"EnumPropsNativeComponentViewManagerDelegate.java" => "
"EnumPropsNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class EnumPropsNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(EnumPropsNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class EnumPropsNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & EnumPropsNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public EnumPropsNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"alignment\\":
viewManager.setAlignment(view, (String) value);
mViewManager.setAlignment(view, (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -157,17 +215,27 @@ public class EnumPropsNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = `
Map {
"EventsNestedObjectNativeComponentViewManagerDelegate.java" => "
"EventsNestedObjectNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class EventsNestedObjectNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(EventsNestedObjectNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class EventsNestedObjectNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & EventsNestedObjectNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public EventsNestedObjectNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? false : (boolean) value);
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -177,17 +245,27 @@ public class EventsNestedObjectNativeComponentViewManagerDelegate<T extends View
exports[`GeneratePropsJavaDelegate can generate fixture EVENT_PROPS 1`] = `
Map {
"EventsNativeComponentViewManagerDelegate.java" => "
"EventsNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class EventsNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(EventsNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class EventsNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & EventsNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public EventsNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? false : (boolean) value);
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -197,13 +275,21 @@ public class EventsNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture EVENTS_WITH_PAPER_NAME 1`] = `
Map {
"InterfaceOnlyComponentViewManagerDelegate.java" => "
"InterfaceOnlyComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class InterfaceOnlyComponentViewManagerDelegate<T extends View> {
public void setProperty(InterfaceOnlyComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class InterfaceOnlyComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & InterfaceOnlyComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public InterfaceOnlyComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
// No props
}
}
@ -213,32 +299,42 @@ public class InterfaceOnlyComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture FLOAT_PROPS 1`] = `
Map {
"FloatPropNativeComponentViewManagerDelegate.java" => "
"FloatPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class FloatPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(FloatPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class FloatPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & FloatPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public FloatPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"blurRadius\\":
viewManager.setBlurRadius(view, value == null ? Float.NaN : ((Double) value).floatValue());
mViewManager.setBlurRadius(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case \\"blurRadius2\\":
viewManager.setBlurRadius2(view, value == null ? 0.001f : ((Double) value).floatValue());
mViewManager.setBlurRadius2(view, value == null ? 0.001f : ((Double) value).floatValue());
break;
case \\"blurRadius3\\":
viewManager.setBlurRadius3(view, value == null ? 2.1f : ((Double) value).floatValue());
mViewManager.setBlurRadius3(view, value == null ? 2.1f : ((Double) value).floatValue());
break;
case \\"blurRadius4\\":
viewManager.setBlurRadius4(view, value == null ? 0f : ((Double) value).floatValue());
mViewManager.setBlurRadius4(view, value == null ? 0f : ((Double) value).floatValue());
break;
case \\"blurRadius5\\":
viewManager.setBlurRadius5(view, value == null ? 1f : ((Double) value).floatValue());
mViewManager.setBlurRadius5(view, value == null ? 1f : ((Double) value).floatValue());
break;
case \\"blurRadius6\\":
viewManager.setBlurRadius6(view, value == null ? 0f : ((Double) value).floatValue());
mViewManager.setBlurRadius6(view, value == null ? 0f : ((Double) value).floatValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -248,18 +344,28 @@ public class FloatPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture IMAGE_PROP 1`] = `
Map {
"ImagePropNativeComponentViewManagerDelegate.java" => "
"ImagePropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class ImagePropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(ImagePropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class ImagePropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ImagePropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public ImagePropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"thumbImage\\":
viewManager.setThumbImage(view, (ReadableMap) value);
mViewManager.setThumbImage(view, (ReadableMap) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -269,23 +375,33 @@ public class ImagePropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture INTEGER_PROPS 1`] = `
Map {
"IntegerPropNativeComponentViewManagerDelegate.java" => "
"IntegerPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class IntegerPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(IntegerPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class IntegerPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & IntegerPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public IntegerPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"progress1\\":
viewManager.setProgress1(view, value == null ? 0 : ((Double) value).intValue());
mViewManager.setProgress1(view, value == null ? 0 : ((Double) value).intValue());
break;
case \\"progress2\\":
viewManager.setProgress2(view, value == null ? -1 : ((Double) value).intValue());
mViewManager.setProgress2(view, value == null ? -1 : ((Double) value).intValue());
break;
case \\"progress3\\":
viewManager.setProgress3(view, value == null ? 10 : ((Double) value).intValue());
mViewManager.setProgress3(view, value == null ? 10 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -295,17 +411,27 @@ public class IntegerPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture INTERFACE_ONLY 1`] = `
Map {
"InterfaceOnlyComponentViewManagerDelegate.java" => "
"InterfaceOnlyComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class InterfaceOnlyComponentViewManagerDelegate<T extends View> {
public void setProperty(InterfaceOnlyComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class InterfaceOnlyComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & InterfaceOnlyComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public InterfaceOnlyComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"accessibilityHint\\":
viewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
mViewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -315,27 +441,37 @@ public class InterfaceOnlyComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture MULTI_NATIVE_PROP 1`] = `
Map {
"ImageColorPropNativeComponentViewManagerDelegate.java" => "
"ImageColorPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class ImageColorPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(ImageColorPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class ImageColorPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ImageColorPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public ImageColorPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"thumbImage\\":
viewManager.setThumbImage(view, (ReadableMap) value);
mViewManager.setThumbImage(view, (ReadableMap) value);
break;
case \\"color\\":
viewManager.setColor(view, value == null ? null : ((Double) value).intValue());
mViewManager.setColor(view, value == null ? null : ((Double) value).intValue());
break;
case \\"thumbTintColor\\":
viewManager.setThumbTintColor(view, value == null ? null : ((Double) value).intValue());
mViewManager.setThumbTintColor(view, value == null ? null : ((Double) value).intValue());
break;
case \\"point\\":
viewManager.setPoint(view, (ReadableMap) value);
mViewManager.setPoint(view, (ReadableMap) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -345,13 +481,21 @@ public class ImageColorPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture NO_PROPS_NO_EVENTS 1`] = `
Map {
"NoPropsNoEventsComponentViewManagerDelegate.java" => "
"NoPropsNoEventsComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class NoPropsNoEventsComponentViewManagerDelegate<T extends View> {
public void setProperty(NoPropsNoEventsComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class NoPropsNoEventsComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & NoPropsNoEventsComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public NoPropsNoEventsComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
// No props
}
}
@ -361,18 +505,28 @@ public class NoPropsNoEventsComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture POINT_PROP 1`] = `
Map {
"PointPropNativeComponentViewManagerDelegate.java" => "
"PointPropNativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class PointPropNativeComponentViewManagerDelegate<T extends View> {
public void setProperty(PointPropNativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class PointPropNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & PointPropNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public PointPropNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"startPoint\\":
viewManager.setStartPoint(view, (ReadableMap) value);
mViewManager.setStartPoint(view, (ReadableMap) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -382,20 +536,30 @@ public class PointPropNativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture STRING_PROP 1`] = `
Map {
"StringPropComponentViewManagerDelegate.java" => "
"StringPropComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class StringPropComponentViewManagerDelegate<T extends View> {
public void setProperty(StringPropComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class StringPropComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & StringPropComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public StringPropComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"accessibilityHint\\":
viewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
mViewManager.setAccessibilityHint(view, value == null ? \\"\\" : (String) value);
break;
case \\"accessibilityRole\\":
viewManager.setAccessibilityRole(view, value == null ? null : (String) value);
mViewManager.setAccessibilityRole(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -405,32 +569,52 @@ public class StringPropComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = `
Map {
"MultiFile1NativeComponentViewManagerDelegate.java" => "
"MultiFile1NativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class MultiFile1NativeComponentViewManagerDelegate<T extends View> {
public void setProperty(MultiFile1NativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class MultiFile1NativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & MultiFile1NativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public MultiFile1NativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? false : (boolean) value);
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
",
"MultiFile2NativeComponentViewManagerDelegate.java" => "
"MultiFile2NativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class MultiFile2NativeComponentViewManagerDelegate<T extends View> {
public void setProperty(MultiFile2NativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class MultiFile2NativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & MultiFile2NativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public MultiFile2NativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? true : (boolean) value);
mViewManager.setDisabled(view, value == null ? true : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
@ -440,32 +624,52 @@ public class MultiFile2NativeComponentViewManagerDelegate<T extends View> {
exports[`GeneratePropsJavaDelegate can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = `
Map {
"MultiComponent1NativeComponentViewManagerDelegate.java" => "
"MultiComponent1NativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class MultiComponent1NativeComponentViewManagerDelegate<T extends View> {
public void setProperty(MultiComponent1NativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class MultiComponent1NativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & MultiComponent1NativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public MultiComponent1NativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? false : (boolean) value);
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}
",
"MultiComponent2NativeComponentViewManagerDelegate.java" => "
"MultiComponent2NativeComponentManagerDelegate.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class MultiComponent2NativeComponentViewManagerDelegate<T extends View> {
public void setProperty(MultiComponent2NativeComponentViewManagerInterface<T> viewManager, T view, String propName, Object value) {
public class MultiComponent2NativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & MultiComponent2NativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public MultiComponent2NativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case \\"disabled\\":
viewManager.setDisabled(view, value == null ? true : (boolean) value);
mViewManager.setDisabled(view, value == null ? true : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

Просмотреть файл

@ -2,14 +2,14 @@
exports[`GeneratePropsJavaInterface can generate fixture ARRAY_PROPS 1`] = `
Map {
"ArrayPropsNativeComponentViewManagerInterface.java" => "
"ArrayPropsNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> {
public interface ArrayPropsNativeComponentManagerInterface<T extends View> {
void setNames(T view, @Nullable ReadableArray value);
void setDisableds(T view, @Nullable ReadableArray value);
void setProgress(T view, @Nullable ReadableArray value);
@ -25,12 +25,12 @@ public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture BOOLEAN_PROP 1`] = `
Map {
"BooleanPropNativeComponentViewManagerInterface.java" => "
"BooleanPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface BooleanPropNativeComponentViewManagerInterface<T extends View> {
public interface BooleanPropNativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
@ -39,13 +39,13 @@ public interface BooleanPropNativeComponentViewManagerInterface<T extends View>
exports[`GeneratePropsJavaInterface can generate fixture COLOR_PROP 1`] = `
Map {
"ColorPropNativeComponentViewManagerInterface.java" => "
"ColorPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface ColorPropNativeComponentViewManagerInterface<T extends View> {
public interface ColorPropNativeComponentManagerInterface<T extends View> {
void setTintColor(T view, @Nullable Integer value);
}
",
@ -54,12 +54,12 @@ public interface ColorPropNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture COMMANDS 1`] = `
Map {
"CommandNativeComponentViewManagerInterface.java" => "
"CommandNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface CommandNativeComponentViewManagerInterface<T extends View> {
public interface CommandNativeComponentManagerInterface<T extends View> {
// No props
void flashScrollIndicators(T view);
void allTypes(T view, int x, String message, boolean animated);
@ -70,13 +70,13 @@ public interface CommandNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture COMMANDS_AND_PROPS 1`] = `
Map {
"CommandNativeComponentViewManagerInterface.java" => "
"CommandNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface CommandNativeComponentViewManagerInterface<T extends View> {
public interface CommandNativeComponentManagerInterface<T extends View> {
void setAccessibilityHint(T view, @Nullable String value);
void hotspotUpdate(T view, int x, int y);
}
@ -86,13 +86,13 @@ public interface CommandNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture ENUM_PROP 1`] = `
Map {
"EnumPropsNativeComponentViewManagerInterface.java" => "
"EnumPropsNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface EnumPropsNativeComponentViewManagerInterface<T extends View> {
public interface EnumPropsNativeComponentManagerInterface<T extends View> {
void setAlignment(T view, @Nullable String value);
}
",
@ -101,12 +101,12 @@ public interface EnumPropsNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = `
Map {
"EventsNestedObjectNativeComponentViewManagerInterface.java" => "
"EventsNestedObjectNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface EventsNestedObjectNativeComponentViewManagerInterface<T extends View> {
public interface EventsNestedObjectNativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
@ -115,12 +115,12 @@ public interface EventsNestedObjectNativeComponentViewManagerInterface<T extends
exports[`GeneratePropsJavaInterface can generate fixture EVENT_PROPS 1`] = `
Map {
"EventsNativeComponentViewManagerInterface.java" => "
"EventsNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface EventsNativeComponentViewManagerInterface<T extends View> {
public interface EventsNativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
@ -129,12 +129,12 @@ public interface EventsNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture EVENTS_WITH_PAPER_NAME 1`] = `
Map {
"InterfaceOnlyComponentViewManagerInterface.java" => "
"InterfaceOnlyComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface InterfaceOnlyComponentViewManagerInterface<T extends View> {
public interface InterfaceOnlyComponentManagerInterface<T extends View> {
// No props
}
",
@ -143,13 +143,13 @@ public interface InterfaceOnlyComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture FLOAT_PROPS 1`] = `
Map {
"FloatPropNativeComponentViewManagerInterface.java" => "
"FloatPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface FloatPropNativeComponentViewManagerInterface<T extends View> {
public interface FloatPropNativeComponentManagerInterface<T extends View> {
void setBlurRadius(T view, Float value);
void setBlurRadius2(T view, Float value);
void setBlurRadius3(T view, Float value);
@ -163,14 +163,14 @@ public interface FloatPropNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture IMAGE_PROP 1`] = `
Map {
"ImagePropNativeComponentViewManagerInterface.java" => "
"ImagePropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
public interface ImagePropNativeComponentViewManagerInterface<T extends View> {
public interface ImagePropNativeComponentManagerInterface<T extends View> {
void setThumbImage(T view, @Nullable ReadableMap value);
}
",
@ -179,12 +179,12 @@ public interface ImagePropNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture INTEGER_PROPS 1`] = `
Map {
"IntegerPropNativeComponentViewManagerInterface.java" => "
"IntegerPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface IntegerPropNativeComponentViewManagerInterface<T extends View> {
public interface IntegerPropNativeComponentManagerInterface<T extends View> {
void setProgress1(T view, int value);
void setProgress2(T view, int value);
void setProgress3(T view, int value);
@ -195,13 +195,13 @@ public interface IntegerPropNativeComponentViewManagerInterface<T extends View>
exports[`GeneratePropsJavaInterface can generate fixture INTERFACE_ONLY 1`] = `
Map {
"InterfaceOnlyComponentViewManagerInterface.java" => "
"InterfaceOnlyComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface InterfaceOnlyComponentViewManagerInterface<T extends View> {
public interface InterfaceOnlyComponentManagerInterface<T extends View> {
void setAccessibilityHint(T view, @Nullable String value);
}
",
@ -210,14 +210,14 @@ public interface InterfaceOnlyComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture MULTI_NATIVE_PROP 1`] = `
Map {
"ImageColorPropNativeComponentViewManagerInterface.java" => "
"ImageColorPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
public interface ImageColorPropNativeComponentViewManagerInterface<T extends View> {
public interface ImageColorPropNativeComponentManagerInterface<T extends View> {
void setThumbImage(T view, @Nullable ReadableMap value);
void setColor(T view, @Nullable Integer value);
void setThumbTintColor(T view, @Nullable Integer value);
@ -229,12 +229,12 @@ public interface ImageColorPropNativeComponentViewManagerInterface<T extends Vie
exports[`GeneratePropsJavaInterface can generate fixture NO_PROPS_NO_EVENTS 1`] = `
Map {
"NoPropsNoEventsComponentViewManagerInterface.java" => "
"NoPropsNoEventsComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface NoPropsNoEventsComponentViewManagerInterface<T extends View> {
public interface NoPropsNoEventsComponentManagerInterface<T extends View> {
// No props
}
",
@ -243,14 +243,14 @@ public interface NoPropsNoEventsComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture POINT_PROP 1`] = `
Map {
"PointPropNativeComponentViewManagerInterface.java" => "
"PointPropNativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
public interface PointPropNativeComponentViewManagerInterface<T extends View> {
public interface PointPropNativeComponentManagerInterface<T extends View> {
void setStartPoint(T view, @Nullable ReadableMap value);
}
",
@ -259,13 +259,13 @@ public interface PointPropNativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture STRING_PROP 1`] = `
Map {
"StringPropComponentViewManagerInterface.java" => "
"StringPropComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface StringPropComponentViewManagerInterface<T extends View> {
public interface StringPropComponentManagerInterface<T extends View> {
void setAccessibilityHint(T view, @Nullable String value);
void setAccessibilityRole(T view, @Nullable String value);
}
@ -275,21 +275,21 @@ public interface StringPropComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = `
Map {
"MultiFile1NativeComponentViewManagerInterface.java" => "
"MultiFile1NativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface MultiFile1NativeComponentViewManagerInterface<T extends View> {
public interface MultiFile1NativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
"MultiFile2NativeComponentViewManagerInterface.java" => "
"MultiFile2NativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface MultiFile2NativeComponentViewManagerInterface<T extends View> {
public interface MultiFile2NativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
@ -298,21 +298,21 @@ public interface MultiFile2NativeComponentViewManagerInterface<T extends View> {
exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = `
Map {
"MultiComponent1NativeComponentViewManagerInterface.java" => "
"MultiComponent1NativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface MultiComponent1NativeComponentViewManagerInterface<T extends View> {
public interface MultiComponent1NativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",
"MultiComponent2NativeComponentViewManagerInterface.java" => "
"MultiComponent2NativeComponentManagerInterface.java" => "
package com.facebook.react.viewmanagers;
import android.view.View;
public interface MultiComponent2NativeComponentViewManagerInterface<T extends View> {
public interface MultiComponent2NativeComponentManagerInterface<T extends View> {
void setDisabled(T view, boolean value);
}
",