🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-native-share-menu

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-share-menu - npm Package Compare versions

Comparing version

to
3.1.0

index.js

2

package.json
{
"name": "react-native-share-menu",
"description": "Adds the app to share menu, so it can be launched from share menu and receive data from other apps",
"version": "3.0.0",
"version": "3.1.0",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -7,3 +7,3 @@ # react-native-share-menu

* Install the module
- Install the module

@@ -34,3 +34,3 @@ ```bash

* In `android/settings.gradle`
- In `android/settings.gradle`

@@ -43,3 +43,3 @@ ```gradle

* In `android/app/build.gradle`
- In `android/app/build.gradle`

@@ -54,3 +54,3 @@ ```gradle

* In `android/app/src/main/AndroidManifest.xml` in the `<activity>` tag:
- In `android/app/src/main/AndroidManifest.xml` in the `<activity>` tag:

@@ -71,3 +71,3 @@ ```xml

* Register module (in MainApplication.java)
- Register module (in MainApplication.java)

@@ -178,3 +178,3 @@ ```java

...
- (BOOL)application:(UIApplication *)app

@@ -192,43 +192,42 @@ openURL:(NSURL *)url

```javascript
import React, {
AppRegistry,
Component,
Text,
View
} from 'react-native';
import ShareMenu from 'react-native-share-menu';
import React, { useState, useEffect, useCallback } from "react";
import { AppRegistry, Text, View, Image } from "react-native";
import ShareMenu from "react-native-share-menu";
class Test extends Component {
constructor(props) {
super(props);
this.state = {
sharedText: null,
sharedImage: null
};
}
const Test = () => {
const [sharedText, setSharedText] = useState(null);
const [sharedImage, setSharedImage] = useState(null);
componentWillMount() {
var that = this;
ShareMenu.getSharedText((text :string) => {
if (text && text.length) {
if (text.startsWith('content://media/') || text.startsWith('file://')) {
that.setState({ sharedImage: text });
} else {
that.setState({ sharedText: text });
}
const handleShare = useCallback((text: string) => {
if (text.length) {
if (text.startsWith("content://") || text.startsWith("file://")) {
setSharedImage(text);
} else {
setSharedText(text);
}
})
}
}
}, []);
render() {
var text = this.state.sharedText;
return (
<View>
<Text>Shared text: {text}</Text>
</View>
);
}
}
useEffect(() => {
ShareMenu.getInitialShare(handleShare);
}, []);
AppRegistry.registerComponent('Test', () => Test);
useEffect(() => {
const listener = ShareMenu.addNewShareListener(handleShare);
return () => {
listener.remove();
};
}, []);
return (
<View>
<Text>Shared text: {sharedText}</Text>
<Text>Shared image:</Text>
<Image source={{ uri: sharedImage }} />
</View>
);
};
AppRegistry.registerComponent("Test", () => Test);
```

@@ -249,1 +248,3 @@

Sponsored and developed by [Meedan](http://meedan.com).
iOS version maintained by [Gustavo Parreira](https://github.com/Gustash).

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