Skip to content

Commit

Permalink
Breaking: Remove BaseViewManagerInterface (facebook#46809)
Browse files Browse the repository at this point in the history
Summary:

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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 9, 2024
1 parent 3102a58 commit 57bfd89
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 271 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ package ${packageName};
${imports}
public class ${className}<T extends ${extendClasses}, U extends BaseViewManagerInterface<T> & ${interfaceClassName}<T>> extends BaseViewManagerDelegate<T, U> {
public class ${className}<T extends ${extendClasses}, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ${interfaceClassName}<T>> extends BaseViewManagerDelegate<T, U> {
public ${className}(U viewManager) {
super(viewManager);
}
Expand Down Expand Up @@ -272,7 +272,8 @@ function getDelegateImports(component: ComponentShape) {
}
imports.add('import androidx.annotation.Nullable;');
imports.add('import com.facebook.react.uimanager.BaseViewManagerDelegate;');
imports.add('import com.facebook.react.uimanager.BaseViewManagerInterface;');
imports.add('import com.facebook.react.uimanager.BaseViewManager;');
imports.add('import com.facebook.react.uimanager.LayoutShadowNode;');

return imports;
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.LayoutShadowNode;

public class AndroidPopupMenuManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & AndroidPopupMenuManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public class AndroidPopupMenuManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & AndroidPopupMenuManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public AndroidPopupMenuManagerDelegate(U viewManager) {
super(viewManager);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.LayoutShadowNode;

public class SampleNativeComponentManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & SampleNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public class SampleNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SampleNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public SampleNativeComponentManagerDelegate(U viewManager) {
super(viewManager);
}
Expand Down
62 changes: 13 additions & 49 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -4118,7 +4118,7 @@ public final class com/facebook/react/uimanager/BackgroundStyleApplicator {
public static final fun setOutlineWidth (Landroid/view/View;F)V
}

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

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

public abstract interface class com/facebook/react/uimanager/BaseViewManagerInterface {
public abstract fun setAccessibilityActions (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
public abstract fun setAccessibilityCollection (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
public abstract fun setAccessibilityCollectionItem (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
public abstract fun setAccessibilityHint (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setAccessibilityLabel (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setAccessibilityLabelledBy (Landroid/view/View;Lcom/facebook/react/bridge/Dynamic;)V
public abstract fun setAccessibilityLiveRegion (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setAccessibilityRole (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setBackgroundColor (Landroid/view/View;I)V
public abstract fun setBorderBottomLeftRadius (Landroid/view/View;F)V
public abstract fun setBorderBottomRightRadius (Landroid/view/View;F)V
public abstract fun setBorderRadius (Landroid/view/View;F)V
public abstract fun setBorderTopLeftRadius (Landroid/view/View;F)V
public abstract fun setBorderTopRightRadius (Landroid/view/View;F)V
public abstract fun setElevation (Landroid/view/View;F)V
public abstract fun setFilter (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
public abstract fun setImportantForAccessibility (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setMixBlendMode (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setNativeId (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setOpacity (Landroid/view/View;F)V
public abstract fun setRenderToHardwareTexture (Landroid/view/View;Z)V
public abstract fun setRole (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setRotation (Landroid/view/View;F)V
public abstract fun setScaleX (Landroid/view/View;F)V
public abstract fun setScaleY (Landroid/view/View;F)V
public abstract fun setShadowColor (Landroid/view/View;I)V
public abstract fun setTestId (Landroid/view/View;Ljava/lang/String;)V
public abstract fun setTransform (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
public abstract fun setTransformOrigin (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
public abstract fun setTranslateX (Landroid/view/View;F)V
public abstract fun setTranslateY (Landroid/view/View;F)V
public abstract fun setViewState (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
public abstract fun setZIndex (Landroid/view/View;F)V
}

public abstract interface class com/facebook/react/uimanager/ComponentNameResolver {
public abstract fun getComponentNames ()[Ljava/lang/String;
}
Expand Down Expand Up @@ -6307,7 +6271,7 @@ public final class com/facebook/react/util/RNLog {
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Expand Down
Loading

0 comments on commit 57bfd89

Please sign in to comment.