react-native-windows-samples icon indicating copy to clipboard operation
react-native-windows-samples copied to clipboard

Document best practices for native side of app to communicate with native module

Open asklar opened this issue 3 years ago • 3 comments

Autolinking will create a ReactPackageProvider for every linked module. However the native side of the app doesn't have a way to access the [native] instance of the native module to negotiate or communicate properties/call APIs.

Workaround: static APIs/properties It would be good to provide a mechanism to avoid this.

asklar avatar Mar 13 '21 09:03 asklar

Apart from the PropertyBag which you mentioned, ReactNotificationService can also help address this.

NickGerleman avatar Mar 13 '21 18:03 NickGerleman

Do we build a mechanism for this or do we just document best/available practices for how to set up this kind of communication? Are there existing samples we can point to that use ReactNotificationService or the PropertyBag that developers can use as a template? We really don't want people to try to invent their own static pattern and get the instancing wrong, so this is a good candidate for documentation.

chrisglein avatar Mar 15 '21 18:03 chrisglein

Related to: #333 and #198

asklar avatar Mar 16 '21 17:03 asklar