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

React Native's Share API does not work with onSelect #198

Open
Lumpell opened this issue Oct 8, 2018 · 1 comment
Open

React Native's Share API does not work with onSelect #198

Lumpell opened this issue Oct 8, 2018 · 1 comment

Comments

@Lumpell
Copy link

Lumpell commented Oct 8, 2018

I want to pull up the share api when one of the items in a dropdown is selected. I have a simple method that I'm calling to handle that. The method works just fine, however for some reason the Share dialog does not appear. Any ideas?

Image:
screen shot 2018-10-08 at 5 03 07 pm

Code (as applicable):

    handleIconSelect(index) {
        if (index == 0) {
            this.toggleFavoritesOnPress();
        }
        else if (index == 1) {
            Share.share({
                message: 'A framework for building native apps using React',
                url: 'http://facebook.github.io/react-native/',
                title: 'React Native'
              }, {
                dialogTitle: 'Share React Native website',
                excludedActivityTypes: [
                  'com.apple.UIKit.activity.PostToTwitter'
                ],
                tintColor: 'green'
              })
              .then(this._showResult)
              .catch((error) => this.setState({result: 'error: ' + error.message}));
        }
    }

     shareItem = <Text>{ shareContent } Share</Text>`

     <ModalDropdown 
         options={[shareItem, shareItem, 'recommend']}
         onSelect={(index) => {this.handleIconSelect(index)}}
     >
         {moreList}
     </ModalDropdown>
@bastiRe
Copy link

bastiRe commented Oct 10, 2018

This seems to be related to #98 . There seems to be a conflict with the animations. It works reliably for me when I set animated={false} on the modal and wrap the shareDialog in a setTimeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants