Skip to content

Commit 7fb3d83

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Breaking: Remove BaseViewManagerInterface (#46809)
Summary: Pull Request resolved: #46809 BaseViewManagerInterface isn't adding much value right now. It was added in D16984121 to allow codegen generated ViewManager delegates to apply to view managers which derive from ViewMangager instead of BaseViewManager (if they did some cleverness, to make VM delegate apply to a no-op class, still implementing all of BaseViewManager's methods). All of the cases where that was used have since been moved to `SimpleViewManager`, and `BaseViewManagerAdapter` (needed to wire this together) doesn't exist anymore, so it's not possible to take any advantage of this interface existing. We should remove it, since its existence is a source of error (e.g. it was missing setters for `accessibilityValue` or those related to pointer events), and is more generally confusing for anyone adding to `BaseViewManager` in the future. This is a breaking change, because there are some libraries which vendor a copy of generated ViewManagerDelegate when building against legacy arch to be able to share code normally generated at build time. That means these will need to be updated to maintain compatibility with RN versions of 0.77+ with new arch disabled. This will not effect compatibility of these libraries against the default new arch, and the updated delegate is still compatible with older RN version. ``` sourceSets.main { java { if (!isNewArchitectureEnabled()) { srcDirs += [ "src/paper/java", ] } } } ``` 1. `react-native-picker/picker` 2. `rnmapbox/maps` 3. `react-native-gesture-handler` 4. `react-native-screens` 5. `react-native-svg` 6. `react-native-safe-area-context` 7. `react-native-pdf` Changelog: [Android][Breaking] - Remove BaseViewManagerInterface Reviewed By: cortinico Differential Revision: D63819044 fbshipit-source-id: 7e4935c8e43706b168f0f599a6676e8abfa66937
1 parent c5a12df commit 7fb3d83

File tree

9 files changed

+172
-271
lines changed

9 files changed

+172
-271
lines changed

packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaDelegate-test.js.snap

Lines changed: 54 additions & 36 deletions
Large diffs are not rendered by default.

packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ package ${packageName};
5555
5656
${imports}
5757
58-
public class ${className}<T extends ${extendClasses}, U extends BaseViewManagerInterface<T> & ${interfaceClassName}<T>> extends BaseViewManagerDelegate<T, U> {
58+
public class ${className}<T extends ${extendClasses}, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ${interfaceClassName}<T>> extends BaseViewManagerDelegate<T, U> {
5959
public ${className}(U viewManager) {
6060
super(viewManager);
6161
}
@@ -272,7 +272,8 @@ function getDelegateImports(component: ComponentShape) {
272272
}
273273
imports.add('import androidx.annotation.Nullable;');
274274
imports.add('import com.facebook.react.uimanager.BaseViewManagerDelegate;');
275-
imports.add('import com.facebook.react.uimanager.BaseViewManagerInterface;');
275+
imports.add('import com.facebook.react.uimanager.BaseViewManager;');
276+
imports.add('import com.facebook.react.uimanager.LayoutShadowNode;');
276277

277278
return imports;
278279
}

packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap

Lines changed: 90 additions & 60 deletions
Large diffs are not rendered by default.

packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/viewmanagers/AndroidPopupMenuManagerDelegate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
import androidx.annotation.Nullable;
1414
import com.facebook.react.bridge.ReadableArray;
1515
import com.facebook.react.uimanager.BaseViewManagerDelegate;
16-
import com.facebook.react.uimanager.BaseViewManagerInterface;
16+
import com.facebook.react.uimanager.BaseViewManager;
17+
import com.facebook.react.uimanager.LayoutShadowNode;
1718

18-
public class AndroidPopupMenuManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & AndroidPopupMenuManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19+
public class AndroidPopupMenuManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & AndroidPopupMenuManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
1920
public AndroidPopupMenuManagerDelegate(U viewManager) {
2021
super(viewManager);
2122
}

packages/react-native-test-library/android/src/main/java/com/facebook/react/viewmanagers/SampleNativeComponentManagerDelegate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
import androidx.annotation.Nullable;
1414
import com.facebook.react.bridge.ReadableArray;
1515
import com.facebook.react.uimanager.BaseViewManagerDelegate;
16-
import com.facebook.react.uimanager.BaseViewManagerInterface;
16+
import com.facebook.react.uimanager.BaseViewManager;
17+
import com.facebook.react.uimanager.LayoutShadowNode;
1718

18-
public class SampleNativeComponentManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & SampleNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19+
public class SampleNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SampleNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
1920
public SampleNativeComponentManagerDelegate(U viewManager) {
2021
super(viewManager);
2122
}

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4118,7 +4118,7 @@ public final class com/facebook/react/uimanager/BackgroundStyleApplicator {
41184118
public static final fun setOutlineWidth (Landroid/view/View;F)V
41194119
}
41204120

4121-
public abstract class com/facebook/react/uimanager/BaseViewManager : com/facebook/react/uimanager/ViewManager, android/view/View$OnLayoutChangeListener, com/facebook/react/uimanager/BaseViewManagerInterface {
4121+
public abstract class com/facebook/react/uimanager/BaseViewManager : com/facebook/react/uimanager/ViewManager, android/view/View$OnLayoutChangeListener {
41224122
public fun <init> ()V
41234123
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
41244124
public fun getExportedCustomBubblingEventTypeConstants ()Ljava/util/Map;
@@ -4197,48 +4197,12 @@ public abstract class com/facebook/react/uimanager/BaseViewManager : com/faceboo
41974197
}
41984198

41994199
public abstract class com/facebook/react/uimanager/BaseViewManagerDelegate : com/facebook/react/uimanager/ViewManagerDelegate {
4200-
protected final field mViewManager Lcom/facebook/react/uimanager/BaseViewManagerInterface;
4201-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
4200+
protected final field mViewManager Lcom/facebook/react/uimanager/BaseViewManager;
4201+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
42024202
public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
42034203
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
42044204
}
42054205

4206-
public abstract interface class com/facebook/react/uimanager/BaseViewManagerInterface {
4207-
public abstract fun setAccessibilityActions (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
4208-
public abstract fun setAccessibilityCollection (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
4209-
public abstract fun setAccessibilityCollectionItem (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
4210-
public abstract fun setAccessibilityHint (Landroid/view/View;Ljava/lang/String;)V
4211-
public abstract fun setAccessibilityLabel (Landroid/view/View;Ljava/lang/String;)V
4212-
public abstract fun setAccessibilityLabelledBy (Landroid/view/View;Lcom/facebook/react/bridge/Dynamic;)V
4213-
public abstract fun setAccessibilityLiveRegion (Landroid/view/View;Ljava/lang/String;)V
4214-
public abstract fun setAccessibilityRole (Landroid/view/View;Ljava/lang/String;)V
4215-
public abstract fun setBackgroundColor (Landroid/view/View;I)V
4216-
public abstract fun setBorderBottomLeftRadius (Landroid/view/View;F)V
4217-
public abstract fun setBorderBottomRightRadius (Landroid/view/View;F)V
4218-
public abstract fun setBorderRadius (Landroid/view/View;F)V
4219-
public abstract fun setBorderTopLeftRadius (Landroid/view/View;F)V
4220-
public abstract fun setBorderTopRightRadius (Landroid/view/View;F)V
4221-
public abstract fun setElevation (Landroid/view/View;F)V
4222-
public abstract fun setFilter (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
4223-
public abstract fun setImportantForAccessibility (Landroid/view/View;Ljava/lang/String;)V
4224-
public abstract fun setMixBlendMode (Landroid/view/View;Ljava/lang/String;)V
4225-
public abstract fun setNativeId (Landroid/view/View;Ljava/lang/String;)V
4226-
public abstract fun setOpacity (Landroid/view/View;F)V
4227-
public abstract fun setRenderToHardwareTexture (Landroid/view/View;Z)V
4228-
public abstract fun setRole (Landroid/view/View;Ljava/lang/String;)V
4229-
public abstract fun setRotation (Landroid/view/View;F)V
4230-
public abstract fun setScaleX (Landroid/view/View;F)V
4231-
public abstract fun setScaleY (Landroid/view/View;F)V
4232-
public abstract fun setShadowColor (Landroid/view/View;I)V
4233-
public abstract fun setTestId (Landroid/view/View;Ljava/lang/String;)V
4234-
public abstract fun setTransform (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
4235-
public abstract fun setTransformOrigin (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
4236-
public abstract fun setTranslateX (Landroid/view/View;F)V
4237-
public abstract fun setTranslateY (Landroid/view/View;F)V
4238-
public abstract fun setViewState (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
4239-
public abstract fun setZIndex (Landroid/view/View;F)V
4240-
}
4241-
42424206
public abstract interface class com/facebook/react/uimanager/ComponentNameResolver {
42434207
public abstract fun getComponentNames ()[Ljava/lang/String;
42444208
}
@@ -6307,7 +6271,7 @@ public final class com/facebook/react/util/RNLog {
63076271
}
63086272

63096273
public class com/facebook/react/viewmanagers/ActivityIndicatorViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6310-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6274+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63116275
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63126276
}
63136277

@@ -6319,7 +6283,7 @@ public abstract interface class com/facebook/react/viewmanagers/ActivityIndicato
63196283
}
63206284

63216285
public class com/facebook/react/viewmanagers/AndroidDrawerLayoutManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6322-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6286+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63236287
public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
63246288
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63256289
}
@@ -6336,7 +6300,7 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidDrawerLay
63366300
}
63376301

63386302
public class com/facebook/react/viewmanagers/AndroidHorizontalScrollContentViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6339-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6303+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63406304
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63416305
}
63426306

@@ -6345,7 +6309,7 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidHorizonta
63456309
}
63466310

63476311
public class com/facebook/react/viewmanagers/AndroidProgressBarManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6348-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6312+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63496313
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63506314
}
63516315

@@ -6360,7 +6324,7 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidProgressB
63606324
}
63616325

63626326
public class com/facebook/react/viewmanagers/AndroidSwipeRefreshLayoutManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6363-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6327+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63646328
public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
63656329
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63666330
}
@@ -6376,7 +6340,7 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidSwipeRefr
63766340
}
63776341

63786342
public class com/facebook/react/viewmanagers/AndroidSwitchManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6379-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6343+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63806344
public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
63816345
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
63826346
}
@@ -6395,7 +6359,7 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidSwitchMan
63956359
}
63966360

63976361
public class com/facebook/react/viewmanagers/DebuggingOverlayManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6398-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6362+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
63996363
public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
64006364
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
64016365
}
@@ -6407,7 +6371,7 @@ public abstract interface class com/facebook/react/viewmanagers/DebuggingOverlay
64076371
}
64086372

64096373
public class com/facebook/react/viewmanagers/ModalHostViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6410-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6374+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
64116375
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
64126376
}
64136377

@@ -6424,15 +6388,15 @@ public abstract interface class com/facebook/react/viewmanagers/ModalHostViewMan
64246388
}
64256389

64266390
public class com/facebook/react/viewmanagers/SafeAreaViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6427-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6391+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
64286392
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
64296393
}
64306394

64316395
public abstract interface class com/facebook/react/viewmanagers/SafeAreaViewManagerInterface {
64326396
}
64336397

64346398
public class com/facebook/react/viewmanagers/UnimplementedNativeViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
6435-
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
6399+
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
64366400
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
64376401
}
64386402

0 commit comments

Comments
 (0)