Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Timeline for DeepLinks in v2? #3991

Closed
rsokz opened this issue Sep 19, 2018 · 5 comments
Closed

[v2] Timeline for DeepLinks in v2? #3991

rsokz opened this issue Sep 19, 2018 · 5 comments

Comments

@rsokz
Copy link

rsokz commented Sep 19, 2018

Issue Description

Is there an estimated timeline to get deep links working in v2?

@birkir
Copy link
Contributor

birkir commented Sep 19, 2018

The deep link system in v1 actually is just a simple event library that you can build yourself if you desperately need it.

// events.js
import EventEmitter from 'EventEmitter';
export const events = new EventEmitter();
import { events } from './events';

class Screen1 extends React.Component {

  componentDidMount() {
    events.addEventListener('DeepLink', this.handleDeepLink);
  }

  handleDeepLink(event) {
    const parts = event.link.split('/'); // Link parts
    const payload = event.payload; // (optional) The payload
    if (parts[0] == 'chats') {
      // handle the link somehow, usually run a this.props.navigator command
    }
  }
}

class Screen2 extends React.Component {

  onContactSelected(contactID) {
    events.emit('DeepLink', {
      link: 'chats/' + contactID,
      payload: '' // (optional) Extra payload with deep link
    });
  }
}

@rsokz rsokz changed the title Timeline for DeepLinks in v2? [V2] Timeline for DeepLinks in v2? Oct 10, 2018
@rsokz rsokz changed the title [V2] Timeline for DeepLinks in v2? [v2] Timeline for DeepLinks in v2? Oct 10, 2018
@webdevsyd
Copy link

The deep link system in v1 actually is just a simple event library that you can build yourself if you desperately need it.

// events.js
import EventEmitter from 'EventEmitter';
export const events = new EventEmitter();
import { events } from './events';

class Screen1 extends React.Component {

  componentDidMount() {
    events.addEventListener('DeepLink', this.handleDeepLink);
  }

  handleDeepLink(event) {
    const parts = event.link.split('/'); // Link parts
    const payload = event.payload; // (optional) The payload
    if (parts[0] == 'chats') {
      // handle the link somehow, usually run a this.props.navigator command
    }
  }
}

class Screen2 extends React.Component {

  onContactSelected(contactID) {
    events.emit('DeepLink', {
      link: 'chats/' + contactID,
      payload: '' // (optional) Extra payload with deep link
    });
  }
}

Will this work when I open the link for example in my email (GMAIL)?.

@ionush
Copy link

ionush commented Nov 5, 2018

i believe this isn't feasible because react native doesn't import node standard library anymore

@guyca
Copy link
Collaborator

guyca commented Nov 5, 2018

Hey guys, as @birkir noted - v1's deeplink system was a very basic pub-sub implementation. As handling events isn't a navigation library's concern we opted to remove it from v2.
I'm closing the issue as it won't be added to RNN in the future.

@RichardLindhout
Copy link

It's really easy with the Linking library from React Native ;)
https://facebook.github.io/react-native/docs/linking.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants