Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share Callback not working #141

Open
lampt2010 opened this issue Aug 15, 2019 · 4 comments
Open

Share Callback not working #141

lampt2010 opened this issue Aug 15, 2019 · 4 comments
Labels

Comments

@lampt2010
Copy link

this is my code
<FacebookProvider appId="key"> <Share href="http://www.facebook.com" onResponse={this.handleResponse} onError={this.handleError}> {({ handleClick, loading,error,data }) => ( <button type="button" disabled={loading} onClick={handleClick} >Share</button> )} </Share> </FacebookProvider>
After y share post, handleResponse fuction not called . If I cancel share , I get error
Untitled

Who can demo help me resolve this problem

@MildTomato
Copy link

yes, i would be interested in seeing how this works.
Or with the Feed option.

@MildTomato
Copy link

MildTomato commented Aug 24, 2019

export default class SocialShare extends Component {

  handleResponse = (data) => {
    console.log(data);
  }

  handleError = (error) => {
    console.log(error);
  }

    render() {
        return (
              <FacebookProvider appId="436255920314257">
                <Feed link="https://www.facebook.com" onCompleted={this.handleResponse} onError={this.handleError}>
          {({ handleClick }) => (
            <button type="button" onClick={handleClick}>Share on Feed</button>
          )}
        </Feed>
      </FacebookProvider>  
   }
}

I would of thought the above would of worked for Share Button and Feed Button

Screenshot 2019-08-24 at 20 06 32

I get the following error when closing the dialog box

@ghost
Copy link

ghost commented Aug 30, 2019

Hi, I am also facing the same issue with share button. I've even tried giving user_posts permission to my test user for my app.

@lampt2010
Copy link
Author

lampt2010 commented Oct 7, 2019

handleClick = (caption) => { var hours = 24; // Reset when storage is more than 24hours var now = new Date().getTime(); var setupTime = localStorage.getItem('setupTime'); if ((now - setupTime > hours * 60 * 60 * 1000) || !setupTime) { localStorage.removeItem('CURRENT_USER'); localStorage.removeItem('setupTime'); this.props.actShowLoginFb(); } else { //SDK loaded, initialize it window.FB.init({ appId: AppConstants.FACEBOOK_APPID, xfbml: true, version: 'v2.6' }); const props = this.props.item; const th = this; //JS SDK initialized, now you can use it window.FB.ui({ method: 'share', title: 'Title Goes here', description: '. ', href: caption, }, function (response) { if (response && !response.error_code) { th.props.actSharedSuccess(props.id).then(() => { }); } else { } }); //load the JavaScript SDK (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) { return; } js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); } }
this is my code. Hoping to resolve y . But this sharing doesn't display image and title share because my project is client side !

@seeden seeden added the bug label May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants