From f63bf7ea610b3a4132d3cc4412ba0fbc02478381 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Thu, 23 Mar 2023 22:17:52 -0400 Subject: [PATCH] REF: Handoff component from js to tsx --- components/handoff.js | 21 --------------------- components/handoff.tsx | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 21 deletions(-) delete mode 100644 components/handoff.js create mode 100644 components/handoff.tsx diff --git a/components/handoff.js b/components/handoff.js deleted file mode 100644 index 20b4e120e..000000000 --- a/components/handoff.js +++ /dev/null @@ -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 ? : 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', -}; diff --git a/components/handoff.tsx b/components/handoff.tsx new file mode 100644 index 000000000..a7c67a539 --- /dev/null +++ b/components/handoff.tsx @@ -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 { + activityTypes: { + ReceiveOnchain: string; + Xpub: string; + ViewInBlockExplorer: string; + }; +} + +const HandoffComponent: HandoffComponentWithActivityTypes = props => { + const { isHandOffUseEnabled } = useContext(BlueStorageContext); + + if (isHandOffUseEnabled) { + return ; + } + 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;