expo-share-intent: TypeError: 0, _expoModulesCore.requireOptionalNativeModule is not a function (it is undefined)

Thank you for working on this.

Describe the bug I get this error after following the installation process see attached screenshot.

TypeError: 0, _expoModulesCore.requireOptionalNativeModule is not a function (it is undefined), js engine: hermes

Here’s my usage example:

import { useShareIntent } from 'expo-share-intent'

export const useShareIntentHandler = () => {
  const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent() // When I remove this line, and comment out the code below the error goes away

  useEffect(() => {
    try {
      const sharedFiles = shareIntent.files
      if (hasShareIntent && sharedFiles?.length) {
        const uris = sharedFiles.map(file => file?.path)

        uploadImages(uris).finally(() => {
          resetShareIntent()
        })
      }
    } catch (e) {
      //
    }
  }, [hasShareIntent, resetShareIntent, shareIntent])
}

To Reproduce Steps to reproduce the behavior

** Environment ** give the output of the following command npx react-native info

Additional context Add any other context about the problem here.

  • expo version: 49.0.22
  • routing : react-navigation
  • package version: 1.0.0
  • target : iOS
  • device : simulator
  • type: local build

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

here we go, version 0.2.0 just released for expo 49 support ! a corresponding branch is available here for examples.

@03balogun let me know if it works for you

@anton950712 thanks for your feedback, can you open a new issue for your sharing workflow problem. I will close this one (related to expo 49 compatibility)