mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
REF: Handoff component from js to tsx
This commit is contained in:
parent
56a8c2028d
commit
f63bf7ea61
@ -1,21 +0,0 @@
|
|||||||
import React, { useContext } from 'react';
|
|
||||||
import Handoff from 'react-native-handoff';
|
|
||||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
const HandoffComponent = props => {
|
|
||||||
const { isHandOffUseEnabled } = useContext(BlueStorageContext);
|
|
||||||
|
|
||||||
return isHandOffUseEnabled ? <Handoff {...props} /> : null;
|
|
||||||
};
|
|
||||||
export default HandoffComponent;
|
|
||||||
|
|
||||||
HandoffComponent.propTypes = {
|
|
||||||
url: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
HandoffComponent.activityTypes = {
|
|
||||||
ReceiveOnchain: 'io.bluewallet.bluewallet.receiveonchain',
|
|
||||||
Xpub: 'io.bluewallet.bluewallet.xpub',
|
|
||||||
ViewInBlockExplorer: 'io.bluewallet.bluewallet.blockexplorer',
|
|
||||||
};
|
|
34
components/handoff.tsx
Normal file
34
components/handoff.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React, { useContext } from 'react';
|
||||||
|
import Handoff from 'react-native-handoff';
|
||||||
|
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||||
|
|
||||||
|
interface HandoffComponentProps {
|
||||||
|
url?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HandoffComponentWithActivityTypes extends React.FC<HandoffComponentProps> {
|
||||||
|
activityTypes: {
|
||||||
|
ReceiveOnchain: string;
|
||||||
|
Xpub: string;
|
||||||
|
ViewInBlockExplorer: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const HandoffComponent: HandoffComponentWithActivityTypes = props => {
|
||||||
|
const { isHandOffUseEnabled } = useContext(BlueStorageContext);
|
||||||
|
|
||||||
|
if (isHandOffUseEnabled) {
|
||||||
|
return <Handoff {...props} />;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const activityTypes = {
|
||||||
|
ReceiveOnchain: 'io.bluewallet.bluewallet.receiveonchain',
|
||||||
|
Xpub: 'io.bluewallet.bluewallet.xpub',
|
||||||
|
ViewInBlockExplorer: 'io.bluewallet.bluewallet.blockexplorer',
|
||||||
|
};
|
||||||
|
|
||||||
|
HandoffComponent.activityTypes = activityTypes;
|
||||||
|
|
||||||
|
export default HandoffComponent;
|
Loading…
Reference in New Issue
Block a user