nygardk / react-share

Social media share buttons and share counts for React
MIT License
2.6k stars 429 forks source link

How to share multiple images on social media in react-share #535

Open Ganeshguru5 opened 2 months ago

Ganeshguru5 commented 2 months ago

I am using react-share package for sharing images from my app to social media. I have array of images in the data.media how do i share the multiple images. alos i can't add title. only i can add hashtags

import React, { useEffect } from 'react'
import {
  FacebookIcon, FacebookShareButton, WhatsappIcon,
  WhatsappShareButton,
} from 'react-share'
import { withTheme } from '../../Theme/ThemeProvider'
import CustomModal from '../../UI/CustomModal'
import CustomText from '../../UI/CustomText'

function ShareModal(props) {
  const { toggleModal, visible, data } = props
  useEffect(() => {
    console.log(data, 'data on lap')
  }, [data])
  return (
    <CustomModal
      visible={visible}
      onDismiss={() => toggleModal('showShareModal')}
    >
      <CustomText size="medium" weight="bold">Share to</CustomText>
      <FacebookShareButton
        quote={data.message}
        url={data.mediaDire ? data.mediaDire[0].media : ''}
      >
        <FacebookIcon round />
      </FacebookShareButton>
      <WhatsappShareButton
        quote={data.message}
        url={data.mediaDire ? data.mediaDire[0].media : ''}
      >
        <WhatsappIcon round />
      </WhatsappShareButton>
    </CustomModal>
  )
}

const stylesheet = {
}

export default withTheme(stylesheet)(ShareModal)