Skip to content

question about ReactPackageProvider.idl for creating a native UI module #290

Open

Description

When following the Sample ViewManager (C++) part of this tutorial

https://microsoft.github.io/react-native-windows/docs/view-managers

I just want to create the native view using visual c++ and the first line in the ViewManager(C++) tutorial says

For this sample, assume we already have the CustomUserControl defined in the C# example.

How can I create a native C++ view for use only within my existing react native project and not to create an entire native module for use by other people.

It's also unclear to me if the example given in the tutorial is possible with no C# code which I was trying to avoid in favor of only C++.

The part of the tutorial where you are supposed to create ReactPackageProvider.idl seems like it would be only if I was making a module for use in multiple projects, which I'm not, so any clarification here would be greatly appreciated.

Thanks

Activity

  1. asklar commented on Oct 2, 2020

    @asklar
    Member

    Bennett Rasmussen (@bibyzan) great question. Yes, it is possible to create a pure C++ native module (in fact, we'd recommend C++ over C# for a number of reasons). We should update our documentation to articulate this better.

    Regarding creating a WinRT component that implements a native module as a separate binary versus building the native module functionality into RNW: normally you would create this as a separate module. While it is possible to not create a module project and instead add a view manager in your own fork of the RNW code, this isn't really a scenario we expect people to follow for the most part.

    Recently we have added the ability to create a native module from the CLI which would pre-populate the right files/project references etc. See https://microsoft.github.io/react-native-windows/docs/native-modules-setup#creating-a-blank-native-module-project

    CC Steven Moyes (@stmoy) Vladimir Morozov (@vmoroz)

  2. chrisglein commented on Oct 12, 2020

    @chrisglein
    Member

    Feedback on the sample seems to be that

    1. It's in C#, and doesn't make clear how to do this from a pure C++ perspective
    2. It leads you down the path of creating a community module, and doesn't make clear how to just access some native code in your app and not package that up for others

    Bennett Rasmussen (@bibyzan) Does that capture what you're saying?
    Steven Moyes (@stmoy) This looks like good feedback on the native module samples and a place where we have a gap.

  3. added this to the 0.64 milestone on Oct 12, 2020
  4. bibyzan commented on Oct 12, 2020

    @bibyzan
    Author

    Chris Glein (@chrisglein) You've got it exactly, a friend of mine and I are doing a very dumb experiment where I am trying to use react native as a view/UI layer for a game we want to write using this C++ vulkan SDK https://vulkan.lunarg.com/sdk/home

    I learned C++ years ago but never got any industry experience in the language specifically after that point. I have experience writing a react native module in swift for an iOS project and I was able to do that without making any package since I was kind of just messing around for now, I may decide to package it up later but it seemed simpler on iOS to not make a module and that's kind of what I was hoping I could do here.

  5. modified the milestones: 0.64, 0.65 on Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions