React-native-share: App crash (cannot read property Version of undefined)

Created on 29 Sep 2020  路  3Comments  路  Source: react-native-share/react-native-share

Steps to reproduce

  1. Update to react-native-share v4
  2. Clean project (node_modules, pod install, npm start -- --reset-cache, ecc)
  3. Build and launch (simulator or real device)

Expected behaviour

It works

Actual behaviour

App crashed

Environment

  • React Native version: 0.60.6
  • React Native platform + platform version: iOS 14.0 on simulator, Android 11 on Google Pixel 4, iOS 13.5.1 on iPhone X

react-native-share

Version: "master" (version 4)

With debugger, I discovered the problem is in these lines:

const ANDROID_KIT_KAT_SDK_VERSION = 19;
const androidPermissionRequestRequired = Platform.constants.Version < ANDROID_KIT_KAT_SDK_VERSION;

Cannot read property Version of undefined

I hope there is everything to reproduce the error.

bug

Most helpful comment

I can confirm that app works correctly now, with [email protected]

All 3 comments

Ah jeez... Platform.constants was added in RN 61...

Ah jeez... Platform.constants was added in RN 61...

Maybe we can update the migration guide, or force a ||. What do you think?

I can confirm that app works correctly now, with [email protected]

Was this page helpful?
0 / 5 - 0 ratings