JavaScript Share not working in react native android/ios?

Share.share(content, options) receives content and options parameter separately.

Share.share(content, options) returns a Promise on both Android and IOS. You basically need to resolve the Promise or read the response from it.

Like so

Share.share(
{
  message: 'Your message',
  url: YourURL
}
).then(({action, activityType}) => {
if(action === Share.sharedAction)
  console.log('Share was successful');
else
  console.log('Share was dismissed');
});

Promise returns an object containing action, activityType

If the user dismissed the dialog, the Promise will be resolved with action being Share.dismissedAction else with action being Share.sharedAction

Answer:1

You have to handle promise for this ..

 onSharePress = (url) => {
    Share.share({
      title: 'Alert Title',
      message: url + '\nMessage goes here.'
    }).then((res) => console.log(res))
      .catch((error) => console.log(error))
  };
Answer:2

Read the friendly share() docs:

Content

  • message - a message to share

  • title - title of the message

iOS

  • url - an URL to share

At least one of URL and message is required.

So on Android, the url option does nothing, and you probably need to put it into message.

Answer:3

like share text on WhatsApp

Linking.openURL(whatsapp://send?text=${'hello whatsApp'});

like share text on Google

Linking.openURL('https://support.google.com/mail/community');

open your Contact in React Native App

Linking.openURL('content://com.android.contacts/contacts');

Answer:4

<div id="parent"> <div id="child1"> <div id="child2"> <div id="child3"> <div id="child4"> </div> </...

<div id="parent"> <div id="child1"> <div id="child2"> <div id="child3"> <div id="child4"> </div> </...

  1. javascript parent elements
  2. javascript get parent elements
  3. javascript traverse parent elements
  4. javascript multiple parent elements
  5. javascript all parent elements
  6. javascript remove parent elements
  7. javascript iframe parent elements
  8. javascript get all parent elements
  9. javascript find all parent elements
  10. javascript find elements parent

As an example, let's say I've a component that can take in props like this: const testComponent = (props: {isBold: boolean}) => { if(props.isBold) return <strong><div>hello</...

As an example, let's say I've a component that can take in props like this: const testComponent = (props: {isBold: boolean}) => { if(props.isBold) return <strong><div>hello</...

What I'm trying to achieve here is intellisense/autocomplete for an object that's been generated from an array - something like an Action Creator for Redux, an array of strings (string[]) that can be ...

What I'm trying to achieve here is intellisense/autocomplete for an object that's been generated from an array - something like an Action Creator for Redux, an array of strings (string[]) that can be ...

I've been trying to get this to work from other posts, but keep running into a wall. I have an "All" button, that I'd like select all or unselect all in the closest div class of "apply_all" I'm ...

I've been trying to get this to work from other posts, but keep running into a wall. I have an "All" button, that I'd like select all or unselect all in the closest div class of "apply_all" I'm ...