Skip to content

Unable to create custom Hyperlink using HyperLinkButton and TextBlock #6392

Description

@vijay-kadam

Microsoft.Reactnative exposes interface IViewManager which only works with Frameworkelement. Also there are no shadow nodes in current 0.63 version. I have codebase which is from 0.59-legacy version but now i want to create custom native component in CS using HyperlinkButton and TextBlock. Here is my component class from 0.59-legacy how can i convert below snippet in 0.63 version.

public class ReactHyperlinkButtonViewManager : BaseControlViewManager<HyperlinkButton, ReactSimpleTextShadowNode>
  {
    public override string Name => "RCTHyperlinkButtonView";

    protected override HyperlinkButton CreateViewInstance(ThemedReactContext reactContext)
    {
      var view = new HyperlinkButton();

      view.Content = new TextBlock();
      return view;
    }



    protected override void AddEventEmitters(ThemedReactContext reactContext, HyperlinkButton view)
    {

    }

    public override void OnDropViewInstance(ThemedReactContext reactContext, HyperlinkButton view)
    {
    }

    private void OnPointerEntered(object sender, RoutedEventArgs e)
    {
    }

    private void OnPointerExited(object sender, RoutedEventArgs e)
    {

    }

    private void OnClick(object sender, RoutedEventArgs e)
    {

    }

    private void OnBlur(object sender, RoutedEventArgs e)
    {
    }

    private void OnFocus(object sender, RoutedEventArgs e)
    {

    }



    public override ReactSimpleTextShadowNode CreateShadowNodeInstance()
    {
      return new ReactSimpleTextShadowNode();
    }

    public override void UpdateExtraData(HyperlinkButton view, object extraData)
    {
      var textNode = extraData as ReactSimpleTextShadowNode;
      if (textNode != null)
      {
        textNode.UpdateTextBlock((TextBlock)view.Content);
      }
    }
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions