New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-share

Package Overview
Dependencies
Maintainers
6
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-share - npm Package Compare versions

Comparing version 8.2.2 to 9.0.0

android/src/main/java/cl/json/RNShareImpl.java

46

lib/commonjs/components/Button.js

@@ -7,31 +7,27 @@ "use strict";

exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const Button = ({
buttonStyle,
onPress,
iconSrc,
textStyle,
children
}) => /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
activeOpacity: 0.5,
style: [styles.button, buttonStyle],
onPress: onPress
}, /*#__PURE__*/React.createElement(_reactNative.Image, {
style: styles.icon,
source: iconSrc
}), /*#__PURE__*/React.createElement(_reactNative.Text, {
style: [styles.buttonText, textStyle]
}, children));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const Button = _ref => {
let {
buttonStyle,
onPress,
iconSrc,
textStyle,
children
} = _ref;
return /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
activeOpacity: 0.5,
style: [styles.button, buttonStyle],
onPress: onPress
}, /*#__PURE__*/React.createElement(_reactNative.Image, {
style: styles.icon,
source: iconSrc
}), /*#__PURE__*/React.createElement(_reactNative.Text, {
style: [styles.buttonText, textStyle]
}, children));
};
var _default = Button;
exports.default = _default;
const styles = _reactNative.StyleSheet.create({

@@ -38,0 +34,0 @@ button: {

@@ -7,13 +7,7 @@ "use strict";

exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const DEFAULT_ANIMATE_TIME = 300;
const styles = _reactNative.StyleSheet.create({

@@ -35,7 +29,7 @@ emptyOverlay: {

});
const Overlay = ({
visible,
children
}) => {
const Overlay = _ref => {
let {
visible,
children
} = _ref;
const [fadeAnim] = React.useState(new _reactNative.Animated.Value(0));

@@ -52,3 +46,2 @@ const [overlayStyle, setOverlayStyle] = React.useState(styles.emptyOverlay);

}
return _reactNative.Animated.timing(fadeAnim, {

@@ -66,5 +59,4 @@ toValue: visible ? 1 : 0,

};
var _default = Overlay;
exports.default = _default;
//# sourceMappingURL=Overlay.js.map

@@ -7,24 +7,17 @@ "use strict";

exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _Overlay = _interopRequireDefault(require("./Overlay"));
var _Sheet = _interopRequireDefault(require("./Sheet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const ShareSheet = ({
style = {},
overlayStyle = {},
visible,
onCancel,
children
}) => {
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const ShareSheet = _ref => {
let {
style = {},
overlayStyle = {},
visible,
onCancel,
children
} = _ref;
const backButtonHandler = React.useCallback(() => {

@@ -35,3 +28,2 @@ if (visible) {

}
return false;

@@ -41,3 +33,2 @@ }, [visible, onCancel]);

_reactNative.BackHandler.addEventListener('hardwareBackPress', backButtonHandler);
return () => {

@@ -60,3 +51,2 @@ _reactNative.BackHandler.removeEventListener('hardwareBackPress', backButtonHandler);

};
const styles = _reactNative.StyleSheet.create({

@@ -80,5 +70,4 @@ actionSheetContainer: {

});
var _default = ShareSheet;
exports.default = _default;
//# sourceMappingURL=ShareSheet.js.map

@@ -7,18 +7,13 @@ "use strict";

exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const DEFAULT_BOTTOM = -300;
const DEFAULT_ANIMATE_TIME = 300;
const Sheet = ({
visible,
children
}) => {
const Sheet = _ref => {
let {
visible,
children
} = _ref;
const [bottom] = React.useState(new _reactNative.Animated.Value(DEFAULT_BOTTOM));

@@ -38,5 +33,4 @@ React.useEffect(() => {

};
var _default = Sheet;
exports.default = _default;
//# sourceMappingURL=Sheet.js.map

@@ -7,39 +7,31 @@ "use strict";

exports.default = void 0;
var _reactNative = require("react-native");
var _NativeRNShare = _interopRequireDefault(require("../../codegenSpec/NativeRNShare"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const ANDROID_KIT_KAT_SDK_VERSION = 19;
const androidPermissionRequestRequired = (typeof _reactNative.Platform.Version === 'string' ? parseInt(_reactNative.Platform.Version, 10) : _reactNative.Platform.Version) < ANDROID_KIT_KAT_SDK_VERSION;
const requireAndAskPermissions = async (options) => {
const requireAndAskPermissions = async options => {
if ((options.url || options.urls) && _reactNative.Platform.OS === 'android') {
const urls = options.urls || (options.url ? [options.url] : []);
try {
const resultArr = await Promise.all(urls.map(url => new Promise((resolve, reject) => {
_reactNative.NativeModules.RNShare.isBase64File(url, error => {
_NativeRNShare.default.isBase64File(url).then(isBase64 => {
resolve(isBase64);
}).catch(error => {
reject(error);
}, isBase64 => {
resolve(isBase64);
});
})));
const requirePermission = resultArr.includes(true);
if (!requirePermission) {
return Promise.resolve(true);
}
const hasPermission = await _reactNative.PermissionsAndroid.check(_reactNative.PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE);
if (hasPermission) {
return Promise.resolve(true);
}
if (androidPermissionRequestRequired) {
const result = await _reactNative.PermissionsAndroid.request(_reactNative.PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE);
if (result === _reactNative.PermissionsAndroid.RESULTS.GRANTED) {
return Promise.resolve(true);
}
throw new Error('Write Permission not available');

@@ -51,8 +43,6 @@ }

}
return Promise.resolve(true);
};
var _default = requireAndAskPermissions;
exports.default = _default;
//# sourceMappingURL=requireAndAskPermissions.js.map

@@ -6,18 +6,18 @@ "use strict";

});
Object.defineProperty(exports, "Overlay", {
Object.defineProperty(exports, "Button", {
enumerable: true,
get: function () {
return _Overlay.default;
return _Button.default;
}
});
Object.defineProperty(exports, "Sheet", {
Object.defineProperty(exports, "Overlay", {
enumerable: true,
get: function () {
return _Sheet.default;
return _Overlay.default;
}
});
Object.defineProperty(exports, "Button", {
Object.defineProperty(exports, "ShareAsset", {
enumerable: true,
get: function () {
return _Button.default;
return _types.ShareAsset;
}

@@ -31,32 +31,24 @@ });

});
Object.defineProperty(exports, "Social", {
Object.defineProperty(exports, "Sheet", {
enumerable: true,
get: function () {
return _types.Social;
return _Sheet.default;
}
});
Object.defineProperty(exports, "ShareAsset", {
Object.defineProperty(exports, "Social", {
enumerable: true,
get: function () {
return _types.ShareAsset;
return _types.Social;
}
});
exports.default = void 0;
var _reactNative = require("react-native");
var _NativeRNShare = _interopRequireDefault(require("../codegenSpec/NativeRNShare"));
var _Overlay = _interopRequireDefault(require("./components/Overlay"));
var _Sheet = _interopRequireDefault(require("./components/Sheet"));
var _Button = _interopRequireDefault(require("./components/Button"));
var _ShareSheet = _interopRequireDefault(require("./components/ShareSheet"));
var _requireAndAskPermissions = _interopRequireDefault(require("./helpers/requireAndAskPermissions"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const RNShare = {

@@ -68,21 +60,20 @@ Button: _Button.default,

Social: {
FACEBOOK: _reactNative.NativeModules.RNShare.FACEBOOK || _types.Social.Facebook,
FACEBOOK_STORIES: _reactNative.NativeModules.RNShare.FACEBOOKSTORIES || _types.Social.FacebookStories,
PAGESMANAGER: _reactNative.NativeModules.RNShare.PAGESMANAGER || _types.Social.Pagesmanager,
TWITTER: _reactNative.NativeModules.RNShare.TWITTER || _types.Social.Twitter,
WHATSAPP: _reactNative.NativeModules.RNShare.WHATSAPP || _types.Social.Whatsapp,
WHATSAPPBUSINESS: _reactNative.NativeModules.RNShare.WHATSAPPBUSINESS || _types.Social.Whatsappbusiness,
INSTAGRAM: _reactNative.NativeModules.RNShare.INSTAGRAM || _types.Social.Instagram,
INSTAGRAM_STORIES: _reactNative.NativeModules.RNShare.INSTAGRAMSTORIES || _types.Social.InstagramStories,
GOOGLEPLUS: _reactNative.NativeModules.RNShare.GOOGLEPLUS || _types.Social.Googleplus,
EMAIL: _reactNative.NativeModules.RNShare.EMAIL || _types.Social.Email,
PINTEREST: _reactNative.NativeModules.RNShare.PINTEREST || _types.Social.Pinterest,
LINKEDIN: _reactNative.NativeModules.RNShare.LINKEDIN || _types.Social.Linkedin,
SMS: _reactNative.NativeModules.RNShare.SMS || _types.Social.Sms,
TELEGRAM: _reactNative.NativeModules.RNShare.TELEGRAM || _types.Social.Telegram,
MESSENGER: _reactNative.NativeModules.RNShare.MESSENGER || _types.Social.Messenger,
SNAPCHAT: _reactNative.NativeModules.RNShare.SNAPCHAT || _types.Social.Snapchat,
VIBER: _reactNative.NativeModules.RNShare.VIBER || _types.Social.Viber
FACEBOOK: _NativeRNShare.default.getConstants().FACEBOOK || _types.Social.Facebook,
FACEBOOK_STORIES: _NativeRNShare.default.getConstants().FACEBOOKSTORIES || _types.Social.FacebookStories,
PAGESMANAGER: _NativeRNShare.default.getConstants().PAGESMANAGER || _types.Social.Pagesmanager,
TWITTER: _NativeRNShare.default.getConstants().TWITTER || _types.Social.Twitter,
WHATSAPP: _NativeRNShare.default.getConstants().WHATSAPP || _types.Social.Whatsapp,
WHATSAPPBUSINESS: _NativeRNShare.default.getConstants().WHATSAPPBUSINESS || _types.Social.Whatsappbusiness,
INSTAGRAM: _NativeRNShare.default.getConstants().INSTAGRAM || _types.Social.Instagram,
INSTAGRAM_STORIES: _NativeRNShare.default.getConstants().INSTAGRAMSTORIES || _types.Social.InstagramStories,
GOOGLEPLUS: _NativeRNShare.default.getConstants().GOOGLEPLUS || _types.Social.Googleplus,
EMAIL: _NativeRNShare.default.getConstants().EMAIL || _types.Social.Email,
PINTEREST: _NativeRNShare.default.getConstants().PINTEREST || _types.Social.Pinterest,
LINKEDIN: _NativeRNShare.default.getConstants().LINKEDIN || _types.Social.Linkedin,
SMS: _NativeRNShare.default.getConstants().SMS || _types.Social.Sms,
TELEGRAM: _NativeRNShare.default.getConstants().TELEGRAM || _types.Social.Telegram,
MESSENGER: _NativeRNShare.default.getConstants().MESSENGER || _types.Social.Messenger,
SNAPCHAT: _NativeRNShare.default.getConstants().SNAPCHAT || _types.Social.Snapchat,
VIBER: _NativeRNShare.default.getConstants().VIBER || _types.Social.Viber
},
open(options) {

@@ -96,3 +87,2 @@ return new Promise((resolve, reject) => {

options.urls = [url];
if (options.filename && !options.filenames) {

@@ -102,12 +92,7 @@ options.filenames = [options.filename];

}
_reactNative.NativeModules.RNShare.open(options, error => {
return reject({
error
});
}, (success, message) => {
if (success) {
_NativeRNShare.default.open(options).then(ret => {
if (ret.success) {
return resolve({
success,
message
success: ret.success,
message: ret.message
});

@@ -117,4 +102,4 @@ } else if (options.failOnCancel === false) {

dismissedAction: true,
success,
message
success: ret.success,
message: ret.message
});

@@ -128,3 +113,2 @@ } else {

},
shareSingle(options) {

@@ -137,3 +121,2 @@ if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'android') {

}
if (options.social === RNShare.Social.INSTAGRAM_STORIES && !options.appId) {

@@ -145,13 +128,8 @@ return reject({

}
_reactNative.NativeModules.RNShare.shareSingle(options, error => {
return reject({
error
});
}, (success, message) => {
_NativeRNShare.default.shareSingle(options).then(ret => {
return resolve({
success: Boolean(success),
message
success: Boolean(ret.success),
message: ret.message
});
});
}).catch(e => reject(e));
}).catch(e => reject(e));

@@ -163,11 +141,6 @@ });

},
isPackageInstalled(packageName) {
if (_reactNative.Platform.OS === 'android') {
return new Promise((resolve, reject) => {
_reactNative.NativeModules.RNShare.isPackageInstalled(packageName, error => {
return reject({
error
});
}, isInstalled => {
_NativeRNShare.default.isPackageInstalled(packageName).then(isInstalled => {
return resolve({

@@ -177,3 +150,3 @@ isInstalled,

});
});
}).catch(e => reject(e));
});

@@ -184,3 +157,2 @@ } else {

}
};

@@ -187,0 +159,0 @@ var _default = RNShare;

@@ -6,7 +6,4 @@ "use strict";

});
exports.ShareAsset = exports.Social = void 0;
let Social;
exports.Social = Social;
(function (Social) {
exports.Social = exports.ShareAsset = void 0;
let Social = /*#__PURE__*/function (Social) {
Social["Facebook"] = "facebook";

@@ -29,8 +26,6 @@ Social["FacebookStories"] = "facebookstories";

Social["Viber"] = "viber";
})(Social || (exports.Social = Social = {}));
let ShareAsset;
exports.ShareAsset = ShareAsset;
(function (ShareAsset) {
return Social;
}({});
exports.Social = Social;
let ShareAsset = /*#__PURE__*/function (ShareAsset) {
ShareAsset["BackgroundImage"] = "shareBackgroundImage";

@@ -40,3 +35,5 @@ ShareAsset["BackgroundVideo"] = "shareBackgroundVideo";

ShareAsset["BackgroundAndStickerImage"] = "shareBackgroundAndStickerImage";
})(ShareAsset || (exports.ShareAsset = ShareAsset = {}));
return ShareAsset;
}({}); // iOS 11 or late
exports.ShareAsset = ShareAsset;
//# sourceMappingURL=types.js.map
import * as React from 'react';
import { StyleSheet, Text, TouchableOpacity, Image } from 'react-native';
const Button = ({
buttonStyle,
onPress,
iconSrc,
textStyle,
children
}) => /*#__PURE__*/React.createElement(TouchableOpacity, {
activeOpacity: 0.5,
style: [styles.button, buttonStyle],
onPress: onPress
}, /*#__PURE__*/React.createElement(Image, {
style: styles.icon,
source: iconSrc
}), /*#__PURE__*/React.createElement(Text, {
style: [styles.buttonText, textStyle]
}, children));
const Button = _ref => {
let {
buttonStyle,
onPress,
iconSrc,
textStyle,
children
} = _ref;
return /*#__PURE__*/React.createElement(TouchableOpacity, {
activeOpacity: 0.5,
style: [styles.button, buttonStyle],
onPress: onPress
}, /*#__PURE__*/React.createElement(Image, {
style: styles.icon,
source: iconSrc
}), /*#__PURE__*/React.createElement(Text, {
style: [styles.buttonText, textStyle]
}, children));
};
export default Button;

@@ -22,0 +23,0 @@ const styles = StyleSheet.create({

@@ -20,7 +20,7 @@ import * as React from 'react';

});
const Overlay = ({
visible,
children
}) => {
const Overlay = _ref => {
let {
visible,
children
} = _ref;
const [fadeAnim] = React.useState(new Animated.Value(0));

@@ -37,3 +37,2 @@ const [overlayStyle, setOverlayStyle] = React.useState(styles.emptyOverlay);

}
return Animated.timing(fadeAnim, {

@@ -51,4 +50,3 @@ toValue: visible ? 1 : 0,

};
export default Overlay;
//# sourceMappingURL=Overlay.js.map

@@ -5,10 +5,10 @@ import * as React from 'react';

import Sheet from './Sheet';
const ShareSheet = ({
style = {},
overlayStyle = {},
visible,
onCancel,
children
}) => {
const ShareSheet = _ref => {
let {
style = {},
overlayStyle = {},
visible,
onCancel,
children
} = _ref;
const backButtonHandler = React.useCallback(() => {

@@ -19,3 +19,2 @@ if (visible) {

}
return false;

@@ -42,3 +41,2 @@ }, [visible, onCancel]);

};
const styles = StyleSheet.create({

@@ -45,0 +43,0 @@ actionSheetContainer: {

@@ -5,7 +5,7 @@ import * as React from 'react';

const DEFAULT_ANIMATE_TIME = 300;
const Sheet = ({
visible,
children
}) => {
const Sheet = _ref => {
let {
visible,
children
} = _ref;
const [bottom] = React.useState(new Animated.Value(DEFAULT_BOTTOM));

@@ -25,4 +25,3 @@ React.useEffect(() => {

};
export default Sheet;
//# sourceMappingURL=Sheet.js.map

@@ -1,36 +0,29 @@

import { NativeModules, Platform, PermissionsAndroid } from 'react-native';
import { Platform, PermissionsAndroid } from 'react-native';
import NativeRNShare from '../../codegenSpec/NativeRNShare';
const ANDROID_KIT_KAT_SDK_VERSION = 19;
const androidPermissionRequestRequired = (typeof Platform.Version === 'string' ? parseInt(Platform.Version, 10) : Platform.Version) < ANDROID_KIT_KAT_SDK_VERSION;
const requireAndAskPermissions = async (options) => {
const requireAndAskPermissions = async options => {
if ((options.url || options.urls) && Platform.OS === 'android') {
const urls = options.urls || (options.url ? [options.url] : []);
try {
const resultArr = await Promise.all(urls.map(url => new Promise((resolve, reject) => {
NativeModules.RNShare.isBase64File(url, error => {
NativeRNShare.isBase64File(url).then(isBase64 => {
resolve(isBase64);
}).catch(error => {
reject(error);
}, isBase64 => {
resolve(isBase64);
});
})));
const requirePermission = resultArr.includes(true);
if (!requirePermission) {
return Promise.resolve(true);
}
const hasPermission = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE);
if (hasPermission) {
return Promise.resolve(true);
}
if (androidPermissionRequestRequired) {
const result = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE);
if (result === PermissionsAndroid.RESULTS.GRANTED) {
return Promise.resolve(true);
}
throw new Error('Write Permission not available');

@@ -42,7 +35,5 @@ }

}
return Promise.resolve(true);
};
export default requireAndAskPermissions;
//# sourceMappingURL=requireAndAskPermissions.js.map

@@ -1,2 +0,3 @@

import { NativeModules, Platform } from 'react-native';
import { Platform } from 'react-native';
import NativeRNShare from '../codegenSpec/NativeRNShare';
import Overlay from './components/Overlay';

@@ -14,21 +15,20 @@ import Sheet from './components/Sheet';

Social: {
FACEBOOK: NativeModules.RNShare.FACEBOOK || Social.Facebook,
FACEBOOK_STORIES: NativeModules.RNShare.FACEBOOKSTORIES || Social.FacebookStories,
PAGESMANAGER: NativeModules.RNShare.PAGESMANAGER || Social.Pagesmanager,
TWITTER: NativeModules.RNShare.TWITTER || Social.Twitter,
WHATSAPP: NativeModules.RNShare.WHATSAPP || Social.Whatsapp,
WHATSAPPBUSINESS: NativeModules.RNShare.WHATSAPPBUSINESS || Social.Whatsappbusiness,
INSTAGRAM: NativeModules.RNShare.INSTAGRAM || Social.Instagram,
INSTAGRAM_STORIES: NativeModules.RNShare.INSTAGRAMSTORIES || Social.InstagramStories,
GOOGLEPLUS: NativeModules.RNShare.GOOGLEPLUS || Social.Googleplus,
EMAIL: NativeModules.RNShare.EMAIL || Social.Email,
PINTEREST: NativeModules.RNShare.PINTEREST || Social.Pinterest,
LINKEDIN: NativeModules.RNShare.LINKEDIN || Social.Linkedin,
SMS: NativeModules.RNShare.SMS || Social.Sms,
TELEGRAM: NativeModules.RNShare.TELEGRAM || Social.Telegram,
MESSENGER: NativeModules.RNShare.MESSENGER || Social.Messenger,
SNAPCHAT: NativeModules.RNShare.SNAPCHAT || Social.Snapchat,
VIBER: NativeModules.RNShare.VIBER || Social.Viber
FACEBOOK: NativeRNShare.getConstants().FACEBOOK || Social.Facebook,
FACEBOOK_STORIES: NativeRNShare.getConstants().FACEBOOKSTORIES || Social.FacebookStories,
PAGESMANAGER: NativeRNShare.getConstants().PAGESMANAGER || Social.Pagesmanager,
TWITTER: NativeRNShare.getConstants().TWITTER || Social.Twitter,
WHATSAPP: NativeRNShare.getConstants().WHATSAPP || Social.Whatsapp,
WHATSAPPBUSINESS: NativeRNShare.getConstants().WHATSAPPBUSINESS || Social.Whatsappbusiness,
INSTAGRAM: NativeRNShare.getConstants().INSTAGRAM || Social.Instagram,
INSTAGRAM_STORIES: NativeRNShare.getConstants().INSTAGRAMSTORIES || Social.InstagramStories,
GOOGLEPLUS: NativeRNShare.getConstants().GOOGLEPLUS || Social.Googleplus,
EMAIL: NativeRNShare.getConstants().EMAIL || Social.Email,
PINTEREST: NativeRNShare.getConstants().PINTEREST || Social.Pinterest,
LINKEDIN: NativeRNShare.getConstants().LINKEDIN || Social.Linkedin,
SMS: NativeRNShare.getConstants().SMS || Social.Sms,
TELEGRAM: NativeRNShare.getConstants().TELEGRAM || Social.Telegram,
MESSENGER: NativeRNShare.getConstants().MESSENGER || Social.Messenger,
SNAPCHAT: NativeRNShare.getConstants().SNAPCHAT || Social.Snapchat,
VIBER: NativeRNShare.getConstants().VIBER || Social.Viber
},
open(options) {

@@ -42,3 +42,2 @@ return new Promise((resolve, reject) => {

options.urls = [url];
if (options.filename && !options.filenames) {

@@ -48,12 +47,7 @@ options.filenames = [options.filename];

}
NativeModules.RNShare.open(options, error => {
return reject({
error
});
}, (success, message) => {
if (success) {
NativeRNShare.open(options).then(ret => {
if (ret.success) {
return resolve({
success,
message
success: ret.success,
message: ret.message
});

@@ -63,4 +57,4 @@ } else if (options.failOnCancel === false) {

dismissedAction: true,
success,
message
success: ret.success,
message: ret.message
});

@@ -74,3 +68,2 @@ } else {

},
shareSingle(options) {

@@ -83,3 +76,2 @@ if (Platform.OS === 'ios' || Platform.OS === 'android') {

}
if (options.social === RNShare.Social.INSTAGRAM_STORIES && !options.appId) {

@@ -91,13 +83,8 @@ return reject({

}
NativeModules.RNShare.shareSingle(options, error => {
return reject({
error
});
}, (success, message) => {
NativeRNShare.shareSingle(options).then(ret => {
return resolve({
success: Boolean(success),
message
success: Boolean(ret.success),
message: ret.message
});
});
}).catch(e => reject(e));
}).catch(e => reject(e));

@@ -109,11 +96,6 @@ });

},
isPackageInstalled(packageName) {
if (Platform.OS === 'android') {
return new Promise((resolve, reject) => {
NativeModules.RNShare.isPackageInstalled(packageName, error => {
return reject({
error
});
}, isInstalled => {
NativeRNShare.isPackageInstalled(packageName).then(isInstalled => {
return resolve({

@@ -123,3 +105,3 @@ isInstalled,

});
});
}).catch(e => reject(e));
});

@@ -130,3 +112,2 @@ } else {

}
};

@@ -133,0 +114,0 @@ export { Overlay, Sheet, Button, ShareSheet, ShareAsset, Social };

@@ -1,4 +0,2 @@

export let Social;
(function (Social) {
export let Social = /*#__PURE__*/function (Social) {
Social["Facebook"] = "facebook";

@@ -21,7 +19,5 @@ Social["FacebookStories"] = "facebookstories";

Social["Viber"] = "viber";
})(Social || (Social = {}));
export let ShareAsset;
(function (ShareAsset) {
return Social;
}({});
export let ShareAsset = /*#__PURE__*/function (ShareAsset) {
ShareAsset["BackgroundImage"] = "shareBackgroundImage";

@@ -31,3 +27,6 @@ ShareAsset["BackgroundVideo"] = "shareBackgroundVideo";

ShareAsset["BackgroundAndStickerImage"] = "shareBackgroundAndStickerImage";
})(ShareAsset || (ShareAsset = {}));
return ShareAsset;
}({});
// iOS 11 or late
//# sourceMappingURL=types.js.map
{
"name": "react-native-share",
"description": "Social share, sending simple data to other apps.",
"version": "8.2.2",
"version": "9.0.0",
"repository": {

@@ -39,3 +39,3 @@ "type": "git",

"@types/react": "16.14.5",
"@types/react-native": "0.63.2",
"@types/react-native": "0.68.15",
"eslint": "^7.24.0",

@@ -82,3 +82,3 @@ "eslint-config-satya164": "3.1.10",

"start:ios": "react-native run-ios --project-path example/ios",
"lint": "eslint \"src/**/*.{js,ts,tsx}\" --max-warnings=0",
"lint": "eslint \"src/**/*.{js,ts,tsx}\" \"codegenSpec/**/*.{js,ts,tsx}\" --max-warnings=0",
"typescript": "tsc --noEmit",

@@ -130,3 +130,11 @@ "validate": "yarn lint && yarn typescript",

]
},
"codegenConfig": {
"name": "RNShareSpec",
"type": "modules",
"jsSrcsDir": "./codegenSpec",
"android": {
"javaPackageName": "cl.json"
}
}
}

@@ -1,3 +0,5 @@

import { NativeModules, Platform, PermissionsAndroid } from 'react-native';
import { Platform, PermissionsAndroid } from 'react-native';
import NativeRNShare from '../../codegenSpec/NativeRNShare';
import { ShareOptions } from '../types';

@@ -20,11 +22,9 @@

new Promise((resolve, reject) => {
NativeModules.RNShare.isBase64File(
url,
(error) => {
NativeRNShare.isBase64File(url)
.then((isBase64: boolean) => {
resolve(isBase64);
})
.catch((error: Error) => {
reject(error);
},
(isBase64) => {
resolve(isBase64);
},
);
});
}),

@@ -31,0 +31,0 @@ ),

@@ -53,2 +53,3 @@ export enum Social {

interface BaseShareSingleOptions {
appId?: string;
urls?: string[];

@@ -55,0 +56,0 @@ url?: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc