首页 > 解决方案 > How to check if 3rd party library is installed in React Native

问题描述

I have an app that do not published on App/Play Store and we have CodePush to release update to the app, as in the new release we have include a new react-native-image-picker library, as this 3rd party library is not able to publish via CodePush, how i can check/try..catch if the react-native-image-picker library is not installed for users that update app via CodePush?

possible to do something like this?

try {
  import ImagePicker from "react-native-image-picker";
} catch (error) {
  const ImagePicker = null;
}

标签: react-native

解决方案


If you are able to generate/retrieve the CodePush's apk, you could try recompiling/reverse engineering the apk back into its source code by using a tool such as https://ibotpeaches.github.io/Apktool/. This would allow you to then inspect your 'CodePush' to determine whether or not it contains this react-native-image-picker-library.


推荐阅读