I’m facing an issue with the share dialog functionality in my React Native Expo app specifically on iOS devices. When users trigger the share dialog by tapping a “Share with Friends” button, the dialog opens twice consecutively and then closes immediately. This behavior prevents users from interacting with the options in the dialog, such as copying the share link.
The issue occurs consistently in the live app, but I cannot reproduce it in the iOS simulator.
<TouchableOpacity onPress={handleSharePartyLink}>
<View style={styles.inviteContainer}>
<View style={{ ...styles.itemContainer, justifyContent: 'space-between' }}>
<Text style={styles.itemText}>Share with Friends</Text>
<View
style={{
backgroundColor: '#CEFEAC',
paddingHorizontal: 10,
paddingVertical: 5,
borderRadius: 5
}}
>
<Text style={styles.shareText}>Share</Text>
</View>
</View>
</View>
</TouchableOpacity>
const handleSharePartyLink = async () => {
mixpanel.track('Share Group Link Clicked', { currentPartyId })
await Share.share({
message: sharePartyMessage(shopName, partyAdmin?.name),
url: sharePartyUrl(partyCode, partyAdmin?.id)
}
)
}
Ahmed Hashir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.