react-native-handoff/RNHandoff.ios.js
Marcos Rodriguez Vélez 31d005f93d Add url parameter
2021-09-24 22:28:32 -04:00

29 lines
554 B
JavaScript

import { PureComponent } from 'react';
import { NativeModules } from 'react-native'
const { RNHandoff } = NativeModules;
let id = 0;
export default class Handoff extends PureComponent {
id = -1;
componentDidMount() {
const { type, title, userInfo, url } = this.props;
this.id = ++id;
RNHandoff.becomeCurrent(this.id, type, title, userInfo, url);
}
componentWillUnmount() {
if (this.id !== -1) {
RNHandoff.invalidate(this.id);
}
}
render() {
return null;
}
}