achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
119 stars 10 forks source link

want expo share intent to load if platform is mobile BUT not for platform == web #80

Open geetee24 opened 1 week ago

geetee24 commented 1 week ago

how make it not load when running in web?

achorein commented 1 week ago

you can use the disabled option like this

useShareIntent({ disabled:  Platform.OS === 'web' })
geetee24 commented 1 week ago

the import of your lib is failing to load when is web :(

achorein commented 1 week ago

look at this issue to handle dynamic import https://github.com/achorein/expo-share-intent/issues/23

geetee24 commented 1 week ago

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

your link does not provide a solution to the import issue on web device

achorein commented 1 week ago

The first comment give a solution for expo go client when in development, is the same for web client.

you can do something like this

let useShareIntent = () => { return {} }
if (Platform.OS !== 'web') {
   // do not use import at top of file
   const ESI = require('expo-share-intent')
   useShareIntent = ESI.useShareIntent;
}