microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.35k stars 1.14k forks source link

Allow modules to run code during autolinking (to capture unmet implicit dependencies/requirements) #6553

Open asklar opened 4 years ago

asklar commented 4 years ago

Sometimes a community module will have requirements for the app to consume it successfully. For example:

In the case of react-native-print, this is documented in the module's readme, but it would be good if there was a way for the module to express requirements or even run some JS during autolink to either (in pri order):

1) print a message explaining module requirements on the app 2) check whether the condition is satisfied and if not print a message 3) check the condition and fix it for the user

acoates-ms commented 4 years ago

In 0.64 react-native doctor should be pluggable. At which point community modules would be able to provide their own checks. Maybe that would be a way to do this?

This doesn't seem like a react-native-windows specific issue.

chrisglein commented 3 years ago

The goal would be to have as much automatic validation as possible so that errors are caught proactively. Being able to diagnose after the fact is good too, but maybe we can fail faster?

jaimecbernardo commented 3 years ago

Another related issue is that modules may want to plug into some application events. One example is react-native-splash-screen, which extends the splash screen. The windows implementation would benefit from being able to hook into the Application.OnLaunched event to get Splash Screen information, as it's the supported way of doing this on Windows: https://docs.microsoft.com/en-us/windows/uwp/launch-resume/create-a-customized-splash-screen