React-native-windows: Integration with existing uwp applications

Created on 10 Oct 2018  路  3Comments  路  Source: microsoft/react-native-windows

I'm not sure if this is the best forum to ask, but I'm struggling to find any documentation for this.

Is it possible to integrative react-native-windows into existing UWP applications?

Something like https://facebook.github.io/react-native/docs/integration-with-existing-apps would be what I'm searching for, if it were to exist.

Please let me know if there's somewhere else this question should live and I'll move it there. :)

Most helpful comment

Unfortunately, there are not good docs on this right now, but it is definitely possible. Rather than deriving from the ReactApplication (the default setup generated by the CLI), you'll need to instantiate and manage the lifecycle of your React Native instance via the ReactNativeHost class. There's an extension method for ReactNativeHost - OnCreate - which will hand you a FrameworkElement (the root view of the React Native app) and call startApplication / render. For passing data back and forth between the "host" UWP app and the embedded react-native app, you can use native modules or initial props.

All 3 comments

Bump.

Unfortunately, there are not good docs on this right now, but it is definitely possible. Rather than deriving from the ReactApplication (the default setup generated by the CLI), you'll need to instantiate and manage the lifecycle of your React Native instance via the ReactNativeHost class. There's an extension method for ReactNativeHost - OnCreate - which will hand you a FrameworkElement (the root view of the React Native app) and call startApplication / render. For passing data back and forth between the "host" UWP app and the embedded react-native app, you can use native modules or initial props.

Interesting. If I ever get the chance to experiment one day, I'll try write up some docs.

Was this page helpful?
0 / 5 - 0 ratings