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

Cache ViewManagerDelegate on ViewManagers #48550

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> {
public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setNames(T view, @Nullable ReadableArray value);
void setDisableds(T view, @Nullable ReadableArray value);
void setProgress(T view, @Nullable ReadableArray value);
Expand Down Expand Up @@ -50,8 +51,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface BooleanPropNativeComponentViewManagerInterface<T extends View> {
public interface BooleanPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
void setDisabledNullable(T view, @Nullable Boolean value);
}
Expand All @@ -74,8 +76,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface ColorPropNativeComponentViewManagerInterface<T extends View> {
public interface ColorPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTintColor(T view, @Nullable Integer value);
}
",
Expand All @@ -97,9 +100,10 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
import com.facebook.yoga.YogaValue;

public interface DimensionPropNativeComponentViewManagerInterface<T extends View> {
public interface DimensionPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMarginBack(T view, @Nullable YogaValue value);
}
",
Expand All @@ -120,8 +124,9 @@ Object {
package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface EdgeInsetsPropNativeComponentViewManagerInterface<T extends View> {
public interface EdgeInsetsPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
Expand All @@ -143,8 +148,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface EnumPropNativeComponentViewManagerInterface<T extends View> {
public interface EnumPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAlignment(T view, @Nullable String value);
void setIntervals(T view, @Nullable Integer value);
}
Expand All @@ -166,8 +172,9 @@ Object {
package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T extends View> {
public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
Expand All @@ -188,8 +195,9 @@ Object {
package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface EventPropsNativeComponentViewManagerInterface<T extends View> {
public interface EventPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
Expand All @@ -211,8 +219,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface FloatPropsNativeComponentViewManagerInterface<T extends View> {
public interface FloatPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setBlurRadius(T view, float value);
void setBlurRadius2(T view, float value);
void setBlurRadius3(T view, float value);
Expand Down Expand Up @@ -241,8 +250,9 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface ImagePropNativeComponentViewManagerInterface<T extends View> {
public interface ImagePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
}
",
Expand All @@ -263,8 +273,9 @@ Object {
package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface IntegerPropNativeComponentViewManagerInterface<T extends View> {
public interface IntegerPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setProgress1(T view, int value);
void setProgress2(T view, int value);
void setProgress3(T view, int value);
Expand All @@ -288,8 +299,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface InterfaceOnlyNativeComponentViewManagerInterface<T extends View> {
public interface InterfaceOnlyNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTitle(T view, @Nullable String value);
}
",
Expand All @@ -311,8 +323,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface MixedPropNativeComponentViewManagerInterface<T extends View> {
public interface MixedPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMixedProp(T view, Dynamic value);
}
",
Expand All @@ -335,8 +348,9 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface MultiNativePropNativeComponentViewManagerInterface<T extends View> {
public interface MultiNativePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
void setColor(T view, @Nullable Integer value);
void setThumbTintColor(T view, @Nullable Integer value);
Expand All @@ -360,8 +374,9 @@ Object {
package com.facebook.react.viewmanagers;

import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface NoPropsNoEventsNativeComponentViewManagerInterface<T extends View> {
public interface NoPropsNoEventsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
Expand All @@ -384,8 +399,9 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface ObjectPropsNativeComponentManagerInterface<T extends View> {
public interface ObjectPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setObjectProp(T view, @Nullable ReadableMap value);
void setObjectArrayProp(T view, @Nullable ReadableMap value);
void setObjectPrimitiveRequiredProp(T view, @Nullable ReadableMap value);
Expand All @@ -410,8 +426,9 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface PointPropNativeComponentViewManagerInterface<T extends View> {
public interface PointPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setStartPoint(T view, @Nullable ReadableMap value);
}
",
Expand All @@ -433,8 +450,9 @@ package com.facebook.react.viewmanagers;

import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;

public interface StringPropNativeComponentViewManagerInterface<T extends View> {
public interface StringPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setPlaceholder(T view, @Nullable String value);
void setDefaultValue(T view, @Nullable String value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ package ${packageName};

${imports}

public interface ${className}<T extends ${extendClasses}> {
public interface ${className}<T extends ${extendClasses}> extends ViewManagerWithGeneratedInterface {
${methods}
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function getImports(
): Set<string> {
const imports: Set<string> = new Set();

if (type === 'interface') {
imports.add(
'import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;',
);
}

component.extendsProps.forEach(extendProps => {
switch (extendProps.type) {
case 'ReactNativeBuiltInType':
Expand Down
Loading
Loading