React-native-share: singleShare Messenger, SMS , SnapChat not working,

Created on 15 Jan 2020  路  3Comments  路  Source: react-native-share/react-native-share

singleShare f Messenger, SMS , SnapChat on Android not working thowing the following error message.

Error => {"error": "key 'social' missing in options"}

bug

Most helpful comment

I think I have figured that out , why MESSENGER, SMS , and SNAPCHAT was not working because of index.js social object

https://github.com/react-native-community/react-native-share/blob/master/index.js#L162

I have changed to

static Social = {
FACEBOOK: NativeModules.RNShare.FACEBOOK || 'facebook',
PAGESMANAGER: NativeModules.RNShare.PAGESMANAGER || 'pagesmanager',
TWITTER: NativeModules.RNShare.TWITTER || 'twitter',
WHATSAPP: NativeModules.RNShare.WHATSAPP || 'whatsapp',
INSTAGRAM: NativeModules.RNShare.INSTAGRAM || 'instagram',
INSTAGRAM_STORIES: NativeModules.RNShare.INSTAGRAM_STORIES || 'instagram-stories',
GOOGLEPLUS: NativeModules.RNShare.GOOGLEPLUS || 'googleplus',
EMAIL: NativeModules.RNShare.EMAIL || 'email',
PINTEREST: NativeModules.RNShare.PINTEREST || 'pinterest',
LINKEDIN: NativeModules.RNShare.LINKEDIN || 'linkedin',
...(Platform.OS === 'android' && {
SMS: NativeModules.RNShare.SMS || 'sms',
MESSENGER: NativeModules.RNShare.MESSENGER || 'messenger',
SNAPCHAT: NativeModules.RNShare.SNAPCHAT || 'snapchat',
})
};

This would solve the problem

All 3 comments

Same issue here

If you write 'messenger' instad of using Share.Social.MESSENGER will work. I don't know why MESSENGER is not defined in constants of this library

I think I have figured that out , why MESSENGER, SMS , and SNAPCHAT was not working because of index.js social object

https://github.com/react-native-community/react-native-share/blob/master/index.js#L162

I have changed to

static Social = {
FACEBOOK: NativeModules.RNShare.FACEBOOK || 'facebook',
PAGESMANAGER: NativeModules.RNShare.PAGESMANAGER || 'pagesmanager',
TWITTER: NativeModules.RNShare.TWITTER || 'twitter',
WHATSAPP: NativeModules.RNShare.WHATSAPP || 'whatsapp',
INSTAGRAM: NativeModules.RNShare.INSTAGRAM || 'instagram',
INSTAGRAM_STORIES: NativeModules.RNShare.INSTAGRAM_STORIES || 'instagram-stories',
GOOGLEPLUS: NativeModules.RNShare.GOOGLEPLUS || 'googleplus',
EMAIL: NativeModules.RNShare.EMAIL || 'email',
PINTEREST: NativeModules.RNShare.PINTEREST || 'pinterest',
LINKEDIN: NativeModules.RNShare.LINKEDIN || 'linkedin',
...(Platform.OS === 'android' && {
SMS: NativeModules.RNShare.SMS || 'sms',
MESSENGER: NativeModules.RNShare.MESSENGER || 'messenger',
SNAPCHAT: NativeModules.RNShare.SNAPCHAT || 'snapchat',
})
};

This would solve the problem

Was this page helpful?
0 / 5 - 0 ratings