Comments (4)
@estani
You can use that enum Social.InstagramStories as value:
import Share, { Social } from 'react-native-share';
and use it like that:
social: Social.InstagramStories,
"react-native-share": "^10.0.2",
from react-native-share.
@LukasMod indeed, but I tried to state in my post that by doing so, you are not honouring the implemented behaviour:
NativeRNShare.getConstants().INSTAGRAMSTORIES || Social.InstagramStories
Not sure what NativeRNShare.getConstants().INSTAGRAMSTORIES
is used for, but I guess the idea would be, that a platform version might define different values, so it's better to use them... I guess...
In any case, they did it for a reason, so the work around, as you proposed, might have undesirable effects in certain platforms or versions thereof (current or in the future).
My 2c, anyways.
Thanks for your comments!
from react-native-share.
this is in 10.0.2. The typescript types does not seem to be properly used.
As a work around, cast it to what is needed:
import { Social } from 'react-native-share';
Share.shareSingle({
social: Share.Social.INSTAGRAM_STORIES as Social.InstagramStories ,
stickerImage: url,
backgroundTopColor: '#000',
backgroundBottomColor: '#000',
appId: Constants.expoConfig?.extra?.fbAppId,
});
Problem Description
social
expects something of type Social
which is an enum.
Though what is exposed is:
INSTAGRAM_STORIES: NativeRNShare.getConstants().INSTAGRAMSTORIES || Social.InstagramStories,
which is indeed string || Social
possible solution
Perhaps casting it at the right place might do the trick (untested).
(NativeRNShare.getConstants().INSTAGRAMSTORIES || Social.InstagramStories) as Social.InstagramStories
``
from react-native-share.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and i will leave this open
from react-native-share.
Related Issues (20)
- Im getting Same Issue . Facebook is Installed in my device , But Still Getting Not Installed and opening in browser. HOT 4
- SMS on iOS fails to open HOT 2
- File sharing from internal storage to external storage - Android 14 HOT 1
- Does this library support the sharing method using App extension libiary? HOT 2
- "Save" button is white, not clear HOT 1
- Share.open saying it needs 3 arguments and only received 1 - ios HOT 1
- shareSingle fb messenger on IOS, empty link and no preview HOT 2
- TargetChosenReceiver.getSharingSenderIntent HOT 1
- Share button doesn't do anything on Android HOT 4
- Facebook opens in browser, X, both broken. HOT 3
- Unable to share multiple PDF and DOC files to Slack from React Native app. HOT 1
- shareResponse always returning false.
- Sharing PDF File On Whatsapp Error On IOS In Release Build HOT 2
- Share.open exclude message for instagram HOT 2
- share button doesnt do anythinn in android 14
- Cannot run build ios with use_framework static
- Specify zoom of picture when sharing to instagram stories
- Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNShare' could not be found. HOT 2
- Share.shareSingle `Instagram` only opens AppStore, does not post to Instagram HOT 8
- How to Share a Link with a Pre-filled Message Text to Messenger in React Native?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-share.