registerComponent function

  1. @Deprecated('4.0.0')
ReactDartComponentFactoryProxy<Component> registerComponent(
  1. Component dartComponentFactory(), {
  2. bool isWrapper = false,
  3. ReactDartComponentFactoryProxy<Component>? parentType,
  4. UiFactory<UiProps>? builderFactory,
  5. Type? componentClass,
})

Helper function that wraps react.registerComponent, and allows attachment of additional component factory metadata.

  • isWrapper: whether the component clones or passes through its children and needs to be treated as if it were the wrapped component.

  • builderFactory/componentClass: the UiFactory and UiComponent members to be potentially used as types for isComponentOfType/getComponentFactory.

  • displayName: (DEPRECATED) the name of the component for use when debugging.

Deprecated. Use registerComponent2 instead.

Implementation

@Deprecated('4.0.0')
ReactDartComponentFactoryProxy registerComponent(react.Component Function() dartComponentFactory, {
    bool isWrapper = false,
    // ignore: deprecated_member_use
    ReactDartComponentFactoryProxy? parentType,
    UiFactory? builderFactory,
    Type? componentClass,
}) {
  // ignore: deprecated_member_use
  final reactComponentFactory = react.registerComponent(dartComponentFactory) as ReactDartComponentFactoryProxy;

  registerComponentTypeAlias(reactComponentFactory, builderFactory);
  registerComponentTypeAlias(reactComponentFactory, componentClass);

  setComponentTypeMeta(reactComponentFactory.type, isWrapper: isWrapper, parentType: parentType?.type);

  return reactComponentFactory;
}