Giter Club home page Giter Club logo

Comments (4)

estani avatar estani commented on June 24, 2024 1

@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.

estani avatar estani commented on June 24, 2024

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.

LukasMod avatar LukasMod commented on June 24, 2024

@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.

github-actions avatar github-actions commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.