marcshilling / react-native-idle-timer

A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app
MIT License
212 stars 41 forks source link

[RFC] Add react-native-package to protect against bad installations #11

Closed negativetwelve closed 1 year ago

negativetwelve commented 7 years ago

Hi @marcshilling, thanks again for this library. I have a quick proposal. Recently I've found that many packages, when not installed correctly, raise somewhat cryptic errors. To mitigate this issue, I've created react-native-package which is a quick, declarative way to check if a nativeModule is installed correctly.

If someone does not follow the native instructions or something went wrong, they will see this warning when starting the app:

image

Warning: react-native-idle-timer was not installed correctly. Please follow the instructions in the README: https://github.com/marcshilling/react-native-idle-timer#readme.

This is more favorable than a runtime error when they first use IdleTimerManager.setIdleTimerDisabled.

I realize that this is a somewhat small package so adding this dependency might be overkill, but I'm trying to see if this style of package writing can catch on in the community so consumers of the packages will have a better debugging experience, especially for people who might be new and not know what to do when they receive a native error.

Would love to hear your thoughts on whether or not you think this is useful for your react-native package. thanks!