Code Monkey home page Code Monkey logo

Comments (4)

caiosba avatar caiosba commented on June 2, 2024

Humm try this please:

componentWillUpdate() { ShareMenu.getSharedText((text) => { console.log(text); }); }

from react-native-share-menu.

georgjaehnig avatar georgjaehnig commented on June 2, 2024

Unfortunately, using componentWillUpdate() doesn't help:

  • On the one hand, it now gets triggered way too often, namely on any screen update, even if I just change a Picker value.
  • On the other hand, still nothing happens when I call the share action from another app while my app is running.

Interestingly, even the following is the case:

  • Let's say my app is not running and I share the text foo to my app. Then my app starts, and with the code in componentWillUpdate(), I see foo – as it should be.
  • But now, if I share from the other app bar, at first nothing happens. Then, If I cause a component update (for instance by changing a Picker value), the text from ShareMenu.getSharedText is still foo.

I guess we must somehow tie this code to a event, no? Maybe according to Linking, add an event listener, so that it's possible to write

addEventListener('text', this._handleTextShare);

no?

BTW: I'm testing on Android 6.0.1.

from react-native-share-menu.

georgjaehnig avatar georgjaehnig commented on June 2, 2024

So I could solve the problem for me with setting

    android:launchMode="singleTop"

within AndroidManifest.xml. Context:

  <activity
    android:name=".MainActivity"
    android:launchMode="singleTop"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
    ...

from react-native-share-menu.

caiosba avatar caiosba commented on June 2, 2024

I just fixed this on version 2.0.0. I basically had to implement onNewIntent on the module code. In my code I also had to implement some logic to get the latest intent when the app comes to foreground: https://github.com/meedan/check-mark/blob/150f88fb83f08d41a0530827d5a02a544859f3ed/index.js#L70-L110.

from react-native-share-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.