joshuapinter / react-native-unified-contacts

Your best friend when working with the latest and greatest Contacts Framework in iOS 9+ in React Native.
MIT License
158 stars 56 forks source link

Platform error handling #59

Open paintedbicycle opened 6 years ago

paintedbicycle commented 6 years ago

Currently there are some methods that are only available on iOS. This might change, but there are certain things only one or the other platform can do. So, we should provide elegant error handling to both platforms that fail gracefully if a function called in the developers application JS does not exist in the other platform.

This means adding the method to both platforms so when it gets called, it does not fail. Then, inside that method, if the platform doesn't support it, do something that helps out the developer. Return a warning, or some sort of predictable return like false, null or undefined.