diff --git a/shared/chat/payments/confirm/index.tsx b/shared/chat/payments/confirm/index.tsx
index 049b43f8b8f8..640e051b3807 100644
--- a/shared/chat/payments/confirm/index.tsx
+++ b/shared/chat/payments/confirm/index.tsx
@@ -125,13 +125,15 @@ const PaymentsConfirm = (props: Props) => {
onClose={props.onCancel}
onSendClick={props.onAccept}
onBack={props.onCancel}
- participantsComp={() =>
- props.payments.map(p => (
-
-
-
- ))
- }
+ participantsComp={() => (
+ <>
+ {props.payments.map(p => (
+
+
+
+ ))}
+ >
+ )}
sendFailed={false}
waitingKey=""
sendingIntentionXLM={true}
diff --git a/shared/wallets/airdrop/banner/container.js b/shared/wallets/airdrop/banner/container.tsx
similarity index 92%
rename from shared/wallets/airdrop/banner/container.js
rename to shared/wallets/airdrop/banner/container.tsx
index fda32ad5b540..ba6851a86bdf 100644
--- a/shared/wallets/airdrop/banner/container.js
+++ b/shared/wallets/airdrop/banner/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import Qualify from '.'
import * as WalletsGen from '../../../actions/wallets-gen'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
@@ -6,7 +5,7 @@ import * as Constants from '../../../constants/wallets'
import {connect} from '../../../util/container'
import flags from '../../../util/feature-flags'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => ({
headerBody: state.wallets.airdropDetails.header.body,
@@ -26,7 +25,7 @@ const mergeProps = (s, d, o) => ({
...d,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/airdrop/banner/index.stories.js b/shared/wallets/airdrop/banner/index.stories.tsx
similarity index 98%
rename from shared/wallets/airdrop/banner/index.stories.js
rename to shared/wallets/airdrop/banner/index.stories.tsx
index 2af9c462143a..5d0d9b1db34f 100644
--- a/shared/wallets/airdrop/banner/index.stories.js
+++ b/shared/wallets/airdrop/banner/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import Banner from '.'
diff --git a/shared/wallets/airdrop/banner/index.js b/shared/wallets/airdrop/banner/index.tsx
similarity index 95%
rename from shared/wallets/airdrop/banner/index.js
rename to shared/wallets/airdrop/banner/index.tsx
index 31fcd766cb0b..d3e9bdfe1e72 100644
--- a/shared/wallets/airdrop/banner/index.js
+++ b/shared/wallets/airdrop/banner/index.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
-type Props = {|
- headerBody: string,
- onCheckQualify: () => void,
- onCancel: () => void,
- show: boolean,
-|}
+type Props = {
+ headerBody: string
+ onCheckQualify: () => void
+ onCancel: () => void
+ show: boolean
+}
const Banner = (p: Props) => {
if (!p.show) return null
diff --git a/shared/wallets/airdrop/container.js b/shared/wallets/airdrop/container.tsx
similarity index 95%
rename from shared/wallets/airdrop/container.js
rename to shared/wallets/airdrop/container.tsx
index 07e72a065da1..797a41f533c3 100644
--- a/shared/wallets/airdrop/container.js
+++ b/shared/wallets/airdrop/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import Airdrop from '.'
import * as WalletsGen from '../../actions/wallets-gen'
import * as RouteTreeGen from '../../actions/route-tree-gen'
@@ -42,7 +41,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
title: 'Airdrop',
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/airdrop/index.stories.js b/shared/wallets/airdrop/index.stories.tsx
similarity index 99%
rename from shared/wallets/airdrop/index.stories.js
rename to shared/wallets/airdrop/index.stories.tsx
index 12770fdef265..1ccf2346e955 100644
--- a/shared/wallets/airdrop/index.stories.js
+++ b/shared/wallets/airdrop/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import Airdrop from '.'
diff --git a/shared/wallets/airdrop/index.js b/shared/wallets/airdrop/index.tsx
similarity index 94%
rename from shared/wallets/airdrop/index.js
rename to shared/wallets/airdrop/index.tsx
index df6e62e9dafb..6f252d6c58b9 100644
--- a/shared/wallets/airdrop/index.js
+++ b/shared/wallets/airdrop/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Constants from '../../constants/wallets'
@@ -6,26 +5,34 @@ import * as Styles from '../../styles'
import {iconMeta} from '../../common-adapters/icon.constants'
import openURL from '../../util/open-url'
-type Props = {|
- loading: boolean,
- onBack: () => void,
- onLoad: () => void,
- onCheckQualify: () => void,
- onReject: () => void,
- signedUp: boolean,
- headerBody: string,
- headerTitle: string,
- sections: $ReadOnlyArray<{|
- lines: $ReadOnlyArray<{|bullet: boolean, text: string|}>,
- section: string,
- icon: ?string,
- |}>,
- title: string,
-|}
+type Props = {
+ loading: boolean
+ onBack: () => void
+ onLoad: () => void
+ onCheckQualify: () => void
+ onReject: () => void
+ signedUp: boolean
+ headerBody: string
+ headerTitle: string
+ sections: ReadonlyArray<{
+ lines: ReadonlyArray<{
+ bullet: boolean
+ text: string
+ }>
+ section: string
+ icon: string | null
+ }>
+ title: string
+}
-class Loading extends React.Component<{}, {waited: boolean}> {
+class Loading extends React.Component<
+ {},
+ {
+ waited: boolean
+ }
+> {
state = {waited: false}
- _id: TimeoutID
+ _id: NodeJS.Timeout
componentDidMount() {
this._id = setTimeout(() => this.setState({waited: true}), 1000)
@@ -138,7 +145,7 @@ class Airdrop extends React.Component {
))}
- {validIcon(b.icon) && }
+ {validIcon(b.icon) && }
))}
diff --git a/shared/wallets/airdrop/qualify/container.js b/shared/wallets/airdrop/qualify/container.tsx
similarity index 88%
rename from shared/wallets/airdrop/qualify/container.js
rename to shared/wallets/airdrop/qualify/container.tsx
index eea6e61b4f22..d908987226c6 100644
--- a/shared/wallets/airdrop/qualify/container.js
+++ b/shared/wallets/airdrop/qualify/container.tsx
@@ -1,8 +1,7 @@
-// @flow
import Qualify from '.'
import * as WalletsGen from '../../../actions/wallets-gen'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
-import {connect, type RouteProps} from '../../../util/container'
+import {connect, RouteProps} from '../../../util/container'
type OwnProps = RouteProps<{}, {}>
@@ -24,7 +23,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
state: stateProps.state,
...dispatchProps,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/airdrop/qualify/index.stories.js b/shared/wallets/airdrop/qualify/index.stories.tsx
similarity index 96%
rename from shared/wallets/airdrop/qualify/index.stories.js
rename to shared/wallets/airdrop/qualify/index.stories.tsx
index ab07b6759297..b16e68f009da 100644
--- a/shared/wallets/airdrop/qualify/index.stories.js
+++ b/shared/wallets/airdrop/qualify/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import * as Kb from '../../../common-adapters'
@@ -67,7 +66,7 @@ class Transitions extends React.Component {
render() {
return (
<>
-
+
void,
- onLoad: () => void,
- onSubmit: () => void,
- rows: $ReadOnlyArray<{|
- title: string,
- subTitle: string,
- valid: boolean,
- |}>,
-|}
+type Props = {
+ state: Types.AirdropState
+ onCancel: () => void
+ onLoad: () => void
+ onSubmit: () => void
+ rows: ReadonlyArray<{
+ title: string
+ subTitle: string
+ valid: boolean
+ }>
+}
const Accepted = p =>
Styles.isMobile && p.state !== 'accepted' ? null : (
@@ -99,14 +98,15 @@ const Row = p => (
)
-type State = {|
- rowIdxLoaded: number,
-|}
+type State = {
+ rowIdxLoaded: number
+}
+
class Qualified extends React.PureComponent {
state = {
rowIdxLoaded: -1,
}
- _loadingTimerID: ?TimeoutID
+ _loadingTimerID: NodeJS.Timeout | null
_kickNextLoad = () => {
if (__STORYSHOT__) {
diff --git a/shared/wallets/asset/container.js b/shared/wallets/asset/container.tsx
similarity index 91%
rename from shared/wallets/asset/container.js
rename to shared/wallets/asset/container.tsx
index 1f84cee353b2..2377a7667e4a 100644
--- a/shared/wallets/asset/container.js
+++ b/shared/wallets/asset/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Types from '../../constants/types/wallets'
import * as Constants from '../../constants/wallets'
import {connect} from '../../util/container'
@@ -6,8 +5,8 @@ import Asset from '.'
import openURL from '../../util/open-url'
type OwnProps = {
- accountID: Types.AccountID,
- index: number,
+ accountID: Types.AccountID
+ index: number
}
const mapStateToProps = (state, ownProps: OwnProps) => ({
@@ -30,7 +29,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
}
}
-export default connect(
+export default connect(
mapStateToProps,
() => ({}),
mergeProps
diff --git a/shared/wallets/asset/index.stories.js b/shared/wallets/asset/index.stories.tsx
similarity index 99%
rename from shared/wallets/asset/index.stories.js
rename to shared/wallets/asset/index.stories.tsx
index 80c8e18f4051..7b762a2649aa 100644
--- a/shared/wallets/asset/index.stories.js
+++ b/shared/wallets/asset/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Constants from '../../constants/wallets'
import {Box, Divider} from '../../common-adapters'
diff --git a/shared/wallets/asset/index.js b/shared/wallets/asset/index.tsx
similarity index 88%
rename from shared/wallets/asset/index.js
rename to shared/wallets/asset/index.tsx
index 5c86a5eaa34e..00506cad7c5e 100644
--- a/shared/wallets/asset/index.js
+++ b/shared/wallets/asset/index.tsx
@@ -1,25 +1,24 @@
-// @flow
import * as React from 'react'
import * as Types from '../../constants/types/wallets'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
export type Props = {
- availableToSend: string, // non-empty only if native currency
- balance: string,
- code: string, // The same as `name` except for XLM
- equivAvailableToSend: string, // non-empty only if native currency e.g. '$123.45 USD'
- equivBalance: string, // non-empty only if native currency
- expanded?: boolean, // for testing
- issuerName: string, // verified issuer domain name, 'Stellar network' or 'Unknown'
- issuerAccountID: string, // issuing public key
- name: string, // Asset code or 'Lumens'
- reserves: Array, // non-empty only if native currency
- openStellarURL: () => void,
+ availableToSend: string // non-empty only if native currency
+ balance: string
+ code: string // The same as `name` except for XLM
+ equivAvailableToSend: string // non-empty only if native currency e.g. '$123.45 USD'
+ equivBalance: string // non-empty only if native currency
+ expanded?: boolean // for testing
+ issuerName: string // verified issuer domain name, 'Stellar network' or 'Unknown'
+ issuerAccountID: string // issuing public key
+ name: string // Asset code or 'Lumens'
+ reserves: Array // non-empty only if native currency
+ openStellarURL: () => void
}
type State = {
- expanded: boolean,
+ expanded: boolean
}
export default class Asset extends React.Component {
@@ -81,11 +80,11 @@ export default class Asset extends React.Component {
}
type BalanceSummaryProps = {
- availableToSend: string,
- equivAvailableToSend: string,
- reserves: Array,
- total: string,
- openStellarURL: () => void,
+ availableToSend: string
+ equivAvailableToSend: string
+ reserves: Array
+ total: string
+ openStellarURL: () => void
}
const BalanceSummary = (props: BalanceSummaryProps) => (
@@ -142,7 +141,7 @@ const BalanceSummary = (props: BalanceSummaryProps) => (
)
type IssuerAccountIDProps = {
- issuerAccountID: string,
+ issuerAccountID: string
}
const IssuerAccountID = (props: IssuerAccountIDProps) => (
diff --git a/shared/wallets/banner/index.stories.js b/shared/wallets/banner/index.stories.tsx
similarity index 98%
rename from shared/wallets/banner/index.stories.js
rename to shared/wallets/banner/index.stories.tsx
index 0c161cb596de..48416d2869c4 100644
--- a/shared/wallets/banner/index.stories.js
+++ b/shared/wallets/banner/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {storiesOf} from '../../stories/storybook'
import {Box} from '../../common-adapters'
diff --git a/shared/wallets/banner/index.js b/shared/wallets/banner/index.tsx
similarity index 87%
rename from shared/wallets/banner/index.js
rename to shared/wallets/banner/index.tsx
index 3909555ef25b..ddc3ce5110dd 100644
--- a/shared/wallets/banner/index.js
+++ b/shared/wallets/banner/index.tsx
@@ -1,15 +1,15 @@
-// @flow
import * as React from 'react'
import {Box2, Text} from '../../common-adapters'
-import type {Background} from '../../common-adapters/text'
+// @ts-ignore not typed yet
+import {Background} from '../../common-adapters/text'
import * as Styles from '../../styles'
type Props = {
- background: Background,
- onAction?: ?() => void,
- reviewProofs?: boolean,
- sendFailed?: boolean,
- text: string,
+ background: Background
+ onAction?: (() => void) | null
+ reviewProofs?: boolean
+ sendFailed?: boolean
+ text: string
}
const Banner = (props: Props) => (
diff --git a/shared/wallets/common/account-entry/index.stories.js b/shared/wallets/common/account-entry/index.stories.tsx
similarity index 98%
rename from shared/wallets/common/account-entry/index.stories.js
rename to shared/wallets/common/account-entry/index.stories.tsx
index fb309f1ea66c..c7d66489c852 100644
--- a/shared/wallets/common/account-entry/index.stories.js
+++ b/shared/wallets/common/account-entry/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import AccountEntry from '.'
diff --git a/shared/wallets/common/account-entry/index.js b/shared/wallets/common/account-entry/index.tsx
similarity index 91%
rename from shared/wallets/common/account-entry/index.js
rename to shared/wallets/common/account-entry/index.tsx
index 60b256ccbb41..8d632ca77bbe 100644
--- a/shared/wallets/common/account-entry/index.js
+++ b/shared/wallets/common/account-entry/index.tsx
@@ -1,18 +1,17 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
-type AccountEntryProps = {|
- center?: boolean,
- fullWidth?: boolean,
- contents: string,
- isDefault?: boolean,
- keybaseUser: string,
- name: string,
- showWalletIcon: boolean,
- style?: Styles.StylesCrossPlatform,
-|}
+type AccountEntryProps = {
+ center?: boolean
+ fullWidth?: boolean
+ contents: string
+ isDefault?: boolean
+ keybaseUser: string
+ name: string
+ showWalletIcon: boolean
+ style?: Styles.StylesCrossPlatform
+}
// A row display of an account, used by the participants components.
// TODO AccountEntry is mostly copied from WalletRow, with some row specific
diff --git a/shared/wallets/common/account-page-header.js b/shared/wallets/common/account-page-header.tsx
similarity index 94%
rename from shared/wallets/common/account-page-header.js
rename to shared/wallets/common/account-page-header.tsx
index 27c1bc805c40..5c6cd8fd955d 100644
--- a/shared/wallets/common/account-page-header.js
+++ b/shared/wallets/common/account-page-header.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
@@ -10,8 +9,8 @@ import * as Styles from '../../styles'
// To be used as customComponent in HeaderHoc
type Props = {
- accountName?: string,
- title: string,
+ accountName?: string
+ title: string
}
const AccountPageHeader = (props: Props) => (
diff --git a/shared/wallets/common/account-reloader.js b/shared/wallets/common/account-reloader.tsx
similarity index 71%
rename from shared/wallets/common/account-reloader.js
rename to shared/wallets/common/account-reloader.tsx
index 206494d2b721..4d74a4e36214 100644
--- a/shared/wallets/common/account-reloader.js
+++ b/shared/wallets/common/account-reloader.tsx
@@ -1,20 +1,19 @@
-// @flow
import * as React from 'react'
import * as WalletsGen from '../../actions/wallets-gen'
import {Reloadable} from '../../common-adapters'
import {checkOnlineWaitingKey} from '../../constants/wallets'
import {namedConnect} from '../../util/container'
-type OwnProps = {|
- children: React.Node,
- onBack?: () => void,
-|}
+type OwnProps = {
+ children: React.ReactNode
+ onBack?: () => void
+}
-type Props = {|
- children: React.Node,
- onBack?: () => void,
- onReload: () => void,
-|}
+type Props = {
+ children: React.ReactNode
+ onBack?: () => void
+ onReload: () => void
+}
const AccountReloader = (props: Props) => (
({
onReload: dispatchProps.onReload,
})
-export default namedConnect(
- mapStateToProps,
- mapDispatchToProps,
- mergeProps,
- 'AccountReloader'
-)(AccountReloader)
+export default namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'AccountReloader')(
+ AccountReloader
+)
diff --git a/shared/wallets/common/back-button.js b/shared/wallets/common/back-button.tsx
similarity index 94%
rename from shared/wallets/common/back-button.js
rename to shared/wallets/common/back-button.tsx
index ae003be9d518..489f0bb693a9 100644
--- a/shared/wallets/common/back-button.js
+++ b/shared/wallets/common/back-button.tsx
@@ -1,11 +1,10 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
type Props = {
- onBack: () => void,
- isOnWhiteBackground?: boolean,
+ onBack: () => void
+ isOnWhiteBackground?: boolean
}
const WalletBackButton = (props: Props) =>
diff --git a/shared/wallets/common/buttons/container.js b/shared/wallets/common/buttons/container.tsx
similarity index 87%
rename from shared/wallets/common/buttons/container.js
rename to shared/wallets/common/buttons/container.tsx
index f7ff1ee1c72a..b3a111563d85 100644
--- a/shared/wallets/common/buttons/container.js
+++ b/shared/wallets/common/buttons/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../../util/container'
import * as Constants from '../../../constants/wallets'
import * as Types from '../../../constants/types/wallets'
@@ -6,9 +5,9 @@ import * as WalletsGen from '../../../actions/wallets-gen'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
import {SendButton as _SendButton, DropdownButton as _DropdownButton} from '.'
-type SendButtonOwnProps = {|
- small?: boolean,
-|}
+type SendButtonOwnProps = {
+ small?: boolean
+}
const mapStateToPropsSendButton = state => {
const _account = Constants.getSelectedAccountData(state)
@@ -40,16 +39,16 @@ const mergePropsSendButton = (stateProps, dispatchProps, ownProps) => ({
thisDeviceIsLockedOut: stateProps.thisDeviceIsLockedOut,
})
-export const SendButton = Container.namedConnect(
+export const SendButton = Container.namedConnect(
mapStateToPropsSendButton,
mapDispatchToPropsSendButton,
mergePropsSendButton,
'WalletSendButton'
)(_SendButton)
-type DropdownButtonOwnProps = {|
- small?: boolean,
-|}
+type DropdownButtonOwnProps = {
+ small?: boolean
+}
const mapStateToPropsDropdownButton = mapStateToPropsSendButton
@@ -65,7 +64,7 @@ const mapDispatchToPropsDropdownButton = dispatch => ({
],
})
),
- _onShowSecretKey: (accountID: Types.AccountID, walletName: ?string) =>
+ _onShowSecretKey: (accountID: Types.AccountID, walletName: string | null) =>
dispatch(
RouteTreeGen.createNavigateAppend({
path: [
@@ -87,7 +86,7 @@ const mergePropsDropdownButton = (stateProps, dispatchProps, ownProps) => ({
small: ownProps.small,
})
-export const DropdownButton = Container.namedConnect(
+export const DropdownButton = Container.namedConnect(
mapStateToPropsDropdownButton,
mapDispatchToPropsDropdownButton,
mergePropsDropdownButton,
diff --git a/shared/wallets/common/buttons/index.js b/shared/wallets/common/buttons/index.tsx
similarity index 90%
rename from shared/wallets/common/buttons/index.js
rename to shared/wallets/common/buttons/index.tsx
index 14098b1d5449..084a03034178 100644
--- a/shared/wallets/common/buttons/index.js
+++ b/shared/wallets/common/buttons/index.tsx
@@ -1,16 +1,15 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
-type SendProps = {|
- disabled: boolean,
- onSendToKeybaseUser: () => void,
- onSendToStellarAddress: () => void,
- onSendToAnotherAccount: () => void,
- small?: boolean,
- thisDeviceIsLockedOut: boolean,
-|}
+type SendProps = {
+ disabled: boolean
+ onSendToKeybaseUser: () => void
+ onSendToStellarAddress: () => void
+ onSendToAnotherAccount: () => void
+ small?: boolean
+ thisDeviceIsLockedOut: boolean
+}
const _SendButton = (props: Kb.PropsWithOverlay) => {
const menuItems = [
@@ -57,12 +56,12 @@ const _SendButton = (props: Kb.PropsWithOverlay) => {
}
export const SendButton = Kb.OverlayParentHOC(_SendButton)
-type DropdownProps = {|
- disabled: boolean,
- onShowSecretKey: ?() => void,
- onSettings: () => void,
- small?: boolean,
-|}
+type DropdownProps = {
+ disabled: boolean
+ onShowSecretKey: (() => void) | null
+ onSettings: () => void
+ small?: boolean
+}
class _DropdownButton extends React.PureComponent {
render() {
diff --git a/shared/wallets/common/enter-name/index.stories.js b/shared/wallets/common/enter-name/index.stories.tsx
similarity index 98%
rename from shared/wallets/common/enter-name/index.stories.js
rename to shared/wallets/common/enter-name/index.stories.tsx
index 641d62a8985b..bbf7e10d6331 100644
--- a/shared/wallets/common/enter-name/index.stories.js
+++ b/shared/wallets/common/enter-name/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import EnterName from '.'
diff --git a/shared/wallets/common/enter-name/index.js b/shared/wallets/common/enter-name/index.tsx
similarity index 95%
rename from shared/wallets/common/enter-name/index.js
rename to shared/wallets/common/enter-name/index.tsx
index d03b8e6925d9..d345065efd5c 100644
--- a/shared/wallets/common/enter-name/index.js
+++ b/shared/wallets/common/enter-name/index.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
-type EnterNameProps = {|
- error?: string,
- name: string,
- onEnterKeyDown?: () => void,
- onNameChange: string => void,
-|}
+type EnterNameProps = {
+ error?: string
+ name: string
+ onEnterKeyDown?: () => void
+ onNameChange: (name: string) => void
+}
const EnterName = (props: EnterNameProps) => {
// TODO use wallet staticConfig to keep in sync with the service
diff --git a/shared/wallets/common/index.stories.js b/shared/wallets/common/index.stories.tsx
similarity index 96%
rename from shared/wallets/common/index.stories.js
rename to shared/wallets/common/index.stories.tsx
index 3e0b83f0ceff..df5de77cea96 100644
--- a/shared/wallets/common/index.stories.js
+++ b/shared/wallets/common/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import participantsRow from './participants-row/index.stories'
import accountEntry from './account-entry/index.stories'
import enterName from './enter-name/index.stories'
diff --git a/shared/wallets/common/index.js b/shared/wallets/common/index.tsx
similarity index 98%
rename from shared/wallets/common/index.js
rename to shared/wallets/common/index.tsx
index 8607a2e469bc..7fd7b72f80ec 100644
--- a/shared/wallets/common/index.js
+++ b/shared/wallets/common/index.tsx
@@ -1,4 +1,3 @@
-// @flow
export {default as AccountEntry} from './account-entry'
export {default as AccountPageHeader} from './account-page-header'
export {default as WalletBackButton} from './back-button'
diff --git a/shared/wallets/common/markdown-memo.js b/shared/wallets/common/markdown-memo.tsx
similarity index 96%
rename from shared/wallets/common/markdown-memo.js
rename to shared/wallets/common/markdown-memo.tsx
index f098cf3fb3b7..8f388f2fa853 100644
--- a/shared/wallets/common/markdown-memo.js
+++ b/shared/wallets/common/markdown-memo.tsx
@@ -1,12 +1,11 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {isMobile} from '../../constants/platform'
type Props = {
- memo: string,
- style?: Styles.StylesCrossPlatform,
+ memo: string
+ style?: Styles.StylesCrossPlatform
}
const MarkdownMemo = (props: Props) =>
diff --git a/shared/wallets/common/participants-row/index.stories.js b/shared/wallets/common/participants-row/index.stories.tsx
similarity index 97%
rename from shared/wallets/common/participants-row/index.stories.js
rename to shared/wallets/common/participants-row/index.stories.tsx
index be3aca285e90..47c4d50a5482 100644
--- a/shared/wallets/common/participants-row/index.stories.js
+++ b/shared/wallets/common/participants-row/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import ParticipantsRow from '.'
diff --git a/shared/wallets/common/participants-row/index.js b/shared/wallets/common/participants-row/index.tsx
similarity index 89%
rename from shared/wallets/common/participants-row/index.js
rename to shared/wallets/common/participants-row/index.tsx
index c7a045ba3e90..e4dfd8927d1e 100644
--- a/shared/wallets/common/participants-row/index.js
+++ b/shared/wallets/common/participants-row/index.tsx
@@ -1,17 +1,16 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
-type Props = {|
- heading: 'To' | 'From',
- headingAlignment: 'Left' | 'Right',
- bottomDivider?: boolean,
- dividerColor?: string,
- style?: Styles.StylesCrossPlatform,
- headingStyle?: Styles.StylesCrossPlatform,
- children?: React.Node,
-|}
+type Props = {
+ heading: 'To' | 'From'
+ headingAlignment: 'Left' | 'Right'
+ bottomDivider?: boolean
+ dividerColor?: string
+ style?: Styles.StylesCrossPlatform
+ headingStyle?: Styles.StylesCrossPlatform
+ children?: React.ReactNode
+}
// A row for use in Participants components; provides a blue heading to the left of the content.
class ParticipantsRow extends React.PureComponent {
diff --git a/shared/wallets/common/small-account-id.js b/shared/wallets/common/small-account-id.tsx
similarity index 84%
rename from shared/wallets/common/small-account-id.js
rename to shared/wallets/common/small-account-id.tsx
index f4a5b0abd2c4..4dad731413c9 100644
--- a/shared/wallets/common/small-account-id.js
+++ b/shared/wallets/common/small-account-id.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
@@ -6,13 +5,18 @@ import * as Constants from '../../constants/wallets'
import * as Types from '../../constants/types/wallets'
type SmallAccountIDProps = {
- accountID: Types.AccountID,
- style?: Styles.StylesCrossPlatform,
+ accountID: Types.AccountID
+ style?: Styles.StylesCrossPlatform
}
-class SmallAccountID extends React.Component {
+class SmallAccountID extends React.Component<
+ SmallAccountIDProps,
+ {
+ expanded: boolean
+ }
+> {
state = {expanded: false}
- _expand = (evt: SyntheticEvent<>) => {
+ _expand = (evt: React.SyntheticEvent) => {
evt.stopPropagation()
this.setState(s => (s.expanded ? null : {expanded: true}))
}
diff --git a/shared/wallets/common/wallet-popup.js b/shared/wallets/common/wallet-popup.tsx
similarity index 79%
rename from shared/wallets/common/wallet-popup.js
rename to shared/wallets/common/wallet-popup.tsx
index 5a8de519912d..5cdf0248a8bc 100644
--- a/shared/wallets/common/wallet-popup.js
+++ b/shared/wallets/common/wallet-popup.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
@@ -9,23 +8,23 @@ import {compose, withProps} from 'recompose'
//
// Handles platform split between desktop modal / native screen + header
-type WalletPopupProps = {|
- onExit?: () => void, // called onExit so to avoid name conflict with other header props
+type WalletPopupProps = {
+ onExit?: () => void // called onExit so to avoid name conflict with other header props
// Buttons to be placed in the bottom Button Bar.
// If none are included, the bar is not rendered.
- bottomButtons?: Array,
- buttonBarDirection?: 'column' | 'row',
- buttonBarStyle?: Styles.StylesCrossPlatform,
- children: React.Node,
- containerStyle?: Styles.StylesCrossPlatform,
+ bottomButtons?: Array
+ buttonBarDirection?: 'column' | 'row'
+ buttonBarStyle?: Styles.StylesCrossPlatform
+ children: React.ReactNode
+ containerStyle?: Styles.StylesCrossPlatform
// Header props, only applies on mobile. backButtonType === 'back' renders back button on desktop
- accountName?: string,
- backButtonType: 'back' | 'cancel' | 'close', // 'back' -> '<' ; 'cancel' -> 'Cancel' ; 'close' -> 'Close'
- headerStyle?: Styles.StylesCrossPlatform,
- headerTitle?: string,
- safeAreaViewBottomStyle?: Styles.StylesCrossPlatform,
- safeAreaViewTopStyle?: Styles.StylesCrossPlatform,
-|}
+ accountName?: string
+ backButtonType: 'back' | 'cancel' | 'close' // 'back' -> '<' ; 'cancel' -> 'Cancel' ; 'close' -> 'Close'
+ headerStyle?: Styles.StylesCrossPlatform
+ headerTitle?: string
+ safeAreaViewBottomStyle?: Styles.StylesCrossPlatform
+ safeAreaViewTopStyle?: Styles.StylesCrossPlatform
+}
const backButtonTypeToFcnHandle = {
back: 'onBack', // Displays back button on desktop
@@ -121,15 +120,15 @@ const styles = Styles.styleSheetCreate({
})
export default compose(
- withProps((props: WalletPopupProps) => ({
- [backButtonTypeToFcnHandle[props.backButtonType]]: (props.onExit: any), // cast to any for flow "incompatible with undefined"
+ withProps((props: WalletPopupProps) => ({
+ [backButtonTypeToFcnHandle[props.backButtonType]]: props.onExit,
customCancelText: props.backButtonType === 'close' ? 'Close' : '',
customComponent: props.headerTitle && (
),
customSafeAreaBottomStyle: props.safeAreaViewBottomStyle,
customSafeAreaTopStyle: props.safeAreaViewTopStyle,
- style: (styles.popup: any), // cast to any for flow complaining about every possible style
+ style: styles.popup,
})),
Kb.HeaderOrPopupWithHeader
)(WalletPopup)
diff --git a/shared/wallets/confirm-form/container.js b/shared/wallets/confirm-form/container.tsx
similarity index 96%
rename from shared/wallets/confirm-form/container.js
rename to shared/wallets/confirm-form/container.tsx
index 36f046a29b60..ba65cd29fcd4 100644
--- a/shared/wallets/confirm-form/container.js
+++ b/shared/wallets/confirm-form/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import ConfirmSend from '.'
import * as Constants from '../../constants/wallets'
import * as ProfileGen from '../../actions/profile-gen'
@@ -7,7 +6,7 @@ import * as WalletsGen from '../../actions/wallets-gen'
import * as RouteTreeGen from '../../actions/route-tree-gen'
import Participants from './participants/container'
import {anyWaiting} from '../../constants/waiting'
-import {connect, isMobile, type RouteProps} from '../../util/container'
+import {connect, isMobile, RouteProps} from '../../util/container'
type OwnProps = RouteProps<{}, {}>
@@ -46,7 +45,7 @@ const mapDispatchToProps = dispatch => ({
onSendClick: () => dispatch(WalletsGen.createSendPayment()),
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
(stateProps, dispatchProps) => {
diff --git a/shared/wallets/confirm-form/header.js b/shared/wallets/confirm-form/header.tsx
similarity index 92%
rename from shared/wallets/confirm-form/header.js
rename to shared/wallets/confirm-form/header.tsx
index e8a5e89b355a..8cc5bedae651 100644
--- a/shared/wallets/confirm-form/header.js
+++ b/shared/wallets/confirm-form/header.tsx
@@ -1,15 +1,14 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {WalletBackButton} from '../common'
-type HeaderProps = {|
- onBack: () => void,
- sendingIntentionXLM: boolean,
- displayAmountXLM: string,
- displayAmountFiat: string,
-|}
+type HeaderProps = {
+ onBack: () => void
+ sendingIntentionXLM: boolean
+ displayAmountXLM: string
+ displayAmountFiat: string
+}
const Header = (props: HeaderProps) => (
diff --git a/shared/wallets/confirm-form/index.stories.js b/shared/wallets/confirm-form/index.stories.tsx
similarity index 99%
rename from shared/wallets/confirm-form/index.stories.js
rename to shared/wallets/confirm-form/index.stories.tsx
index b6608b44c819..3e4aa3edd74f 100644
--- a/shared/wallets/confirm-form/index.stories.js
+++ b/shared/wallets/confirm-form/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import participants from './participants/index.stories'
diff --git a/shared/wallets/confirm-form/index.js b/shared/wallets/confirm-form/index.tsx
similarity index 88%
rename from shared/wallets/confirm-form/index.js
rename to shared/wallets/confirm-form/index.tsx
index 274de1eda19d..21c93a90b72a 100644
--- a/shared/wallets/confirm-form/index.js
+++ b/shared/wallets/confirm-form/index.tsx
@@ -1,27 +1,26 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import Banner from '../banner'
import Header from './header'
import NoteAndMemo from './note-and-memo'
-import {type Banner as BannerType} from '../../constants/types/wallets'
+import {Banner as BannerType} from '../../constants/types/wallets'
-type ConfirmSendProps = {|
- onClose: () => void,
- onSendClick: () => void,
- onBack: () => void,
- encryptedNote?: string,
- participantsComp: React.ComponentType<{||}>,
- publicMemo?: string,
- banners?: Array,
- sendFailed: boolean,
- waitingKey: string,
- sendingIntentionXLM: boolean,
- displayAmountXLM: string,
- displayAmountFiat: string,
- readyToSend: string,
-|}
+type ConfirmSendProps = {
+ onClose: () => void
+ onSendClick: () => void
+ onBack: () => void
+ encryptedNote?: string
+ participantsComp: React.ComponentType<{}>
+ publicMemo?: string
+ banners?: Array
+ sendFailed: boolean
+ waitingKey: string
+ sendingIntentionXLM: boolean
+ displayAmountXLM: string
+ displayAmountFiat: string
+ readyToSend: string
+}
const ConfirmSend = (props: ConfirmSendProps) => {
const Participants = props.participantsComp
diff --git a/shared/wallets/confirm-form/note-and-memo.js b/shared/wallets/confirm-form/note-and-memo.tsx
similarity index 95%
rename from shared/wallets/confirm-form/note-and-memo.js
rename to shared/wallets/confirm-form/note-and-memo.tsx
index f6859fe64b8c..a1ab22f63d19 100644
--- a/shared/wallets/confirm-form/note-and-memo.js
+++ b/shared/wallets/confirm-form/note-and-memo.tsx
@@ -1,12 +1,11 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
-type Props = {|
- encryptedNote?: string,
- publicMemo?: string,
-|}
+type Props = {
+ encryptedNote?: string
+ publicMemo?: string
+}
const NoteAndMemo = (props: Props) => (
diff --git a/shared/wallets/confirm-form/participants/container.js b/shared/wallets/confirm-form/participants/container.tsx
similarity index 95%
rename from shared/wallets/confirm-form/participants/container.js
rename to shared/wallets/confirm-form/participants/container.tsx
index 501c130228d1..f458dda8bbdd 100644
--- a/shared/wallets/confirm-form/participants/container.js
+++ b/shared/wallets/confirm-form/participants/container.tsx
@@ -1,10 +1,9 @@
-// @flow
import ConfirmSend from '.'
import {connect} from '../../../util/container'
import {getAccount} from '../../../constants/wallets'
import {stringToAccountID} from '../../../constants/types/wallets'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => {
const build = state.wallets.building
@@ -45,7 +44,7 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => ({})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
(s, d, o) => ({...o, ...s, ...d})
diff --git a/shared/wallets/confirm-form/participants/index.stories.js b/shared/wallets/confirm-form/participants/index.stories.tsx
similarity index 99%
rename from shared/wallets/confirm-form/participants/index.stories.js
rename to shared/wallets/confirm-form/participants/index.stories.tsx
index fd5c760a8fc9..60ec4da7ce0e 100644
--- a/shared/wallets/confirm-form/participants/index.stories.js
+++ b/shared/wallets/confirm-form/participants/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import Participants from '.'
diff --git a/shared/wallets/confirm-form/participants/index.js b/shared/wallets/confirm-form/participants/index.tsx
similarity index 85%
rename from shared/wallets/confirm-form/participants/index.js
rename to shared/wallets/confirm-form/participants/index.tsx
index 5d79580f23de..01dbde496053 100644
--- a/shared/wallets/confirm-form/participants/index.js
+++ b/shared/wallets/confirm-form/participants/index.tsx
@@ -1,25 +1,23 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
import {ParticipantsRow, AccountEntry} from '../../common'
-import {type CounterpartyType, type AccountID} from '../../../constants/types/wallets'
-
-export type ParticipantsProps = {|
- recipientType: CounterpartyType,
- yourUsername: string,
- fromAccountIsDefault: boolean,
- fromAccountName: string,
- fromAccountAssets: string,
- recipientUsername: string,
- recipientFullName: string,
+import {CounterpartyType, AccountID} from '../../../constants/types/wallets'
+export type ParticipantsProps = {
+ recipientType: CounterpartyType
+ yourUsername: string
+ fromAccountIsDefault: boolean
+ fromAccountName: string
+ fromAccountAssets: string
+ recipientUsername: string
+ recipientFullName: string
// The below is needed only when recipientType !== 'keybaseUser'.
- recipientStellarAddress?: AccountID,
- recipientAccountName?: string,
- recipientAccountIsDefault?: boolean,
- recipientAccountAssets?: string,
-|}
+ recipientStellarAddress?: AccountID
+ recipientAccountName?: string
+ recipientAccountIsDefault?: boolean
+ recipientAccountAssets?: string
+}
const Participants = (props: ParticipantsProps) => {
let toFieldContent
diff --git a/shared/wallets/create-account/container.js b/shared/wallets/create-account/container.tsx
similarity index 91%
rename from shared/wallets/create-account/container.js
rename to shared/wallets/create-account/container.tsx
index 186c0b435341..df824b0ed1ec 100644
--- a/shared/wallets/create-account/container.js
+++ b/shared/wallets/create-account/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import {capitalize} from 'lodash-es'
import * as Container from '../../util/container'
import * as Constants from '../../constants/wallets'
@@ -7,7 +6,13 @@ import * as RouteTreeGen from '../../actions/route-tree-gen'
import {anyWaiting} from '../../constants/waiting'
import CreateAccount from '.'
-type OwnProps = Container.RouteProps<{fromSendForm?: boolean, showOnCreation?: boolean}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ fromSendForm?: boolean
+ showOnCreation?: boolean
+ },
+ {}
+>
const mapStateToProps = state => ({
createNewAccountError: state.wallets.createNewAccountError,
@@ -43,7 +48,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
onDone: dispatchProps.onDone,
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/create-account/index.stories.js b/shared/wallets/create-account/index.stories.tsx
similarity index 98%
rename from shared/wallets/create-account/index.stories.js
rename to shared/wallets/create-account/index.stories.tsx
index 9ed152cf40a2..3d5eb1d4bcc2 100644
--- a/shared/wallets/create-account/index.stories.js
+++ b/shared/wallets/create-account/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import React from 'react'
import * as Sb from '../../stories/storybook'
import CreateAccount from '.'
diff --git a/shared/wallets/create-account/index.js b/shared/wallets/create-account/index.tsx
similarity index 82%
rename from shared/wallets/create-account/index.js
rename to shared/wallets/create-account/index.tsx
index 706ef5dc0107..f4e288c99d3e 100644
--- a/shared/wallets/create-account/index.js
+++ b/shared/wallets/create-account/index.tsx
@@ -1,24 +1,24 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
-import type {ValidationState} from '../../constants/types/wallets'
+import {ValidationState} from '../../constants/types/wallets'
import {EnterName, WalletPopup} from '../common'
import * as Styles from '../../styles'
-type Props = {|
- createNewAccountError: string,
- error: string,
- nameValidationState: ValidationState,
- onCancel: () => void,
- onClearErrors: () => void,
- onCreateAccount: (name: string) => void,
- onDone: (name: string) => void,
- waiting: boolean,
-|}
+type Props = {
+ createNewAccountError: string
+ error: string
+ nameValidationState: ValidationState
+ onCancel: () => void
+ onClearErrors: () => void
+ onCreateAccount: (name: string) => void
+ onDone: (name: string) => void
+ waiting: boolean
+}
+
+type State = {
+ name: string
+}
-type State = {|
- name: string,
-|}
class CreateAccount extends React.Component {
state = {name: ''}
_onNameChange = name => this.setState({name})
diff --git a/shared/wallets/export-secret-key/container.js b/shared/wallets/export-secret-key/container.tsx
similarity index 93%
rename from shared/wallets/export-secret-key/container.js
rename to shared/wallets/export-secret-key/container.tsx
index cd1590d03fb6..891d14bec4d0 100644
--- a/shared/wallets/export-secret-key/container.js
+++ b/shared/wallets/export-secret-key/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../util/container'
import * as Constants from '../../constants/wallets'
import * as Types from '../../constants/types/wallets'
@@ -8,7 +7,7 @@ import ExportSecretKey from '.'
export type OwnProps = Container.RouteProps<
{
- accountID: Types.AccountID,
+ accountID: Types.AccountID
},
{}
>
@@ -38,7 +37,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
onSecretKeySeen: () => dispatchProps._onSecretKeySeen(stateProps.accountID),
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/export-secret-key/index.stories.js b/shared/wallets/export-secret-key/index.stories.tsx
similarity index 98%
rename from shared/wallets/export-secret-key/index.stories.js
rename to shared/wallets/export-secret-key/index.stories.tsx
index 9e29e63fd018..112a66b46d65 100644
--- a/shared/wallets/export-secret-key/index.stories.js
+++ b/shared/wallets/export-secret-key/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import React from 'react'
import * as Sb from '../../stories/storybook'
import ExportSecretKey from '.'
diff --git a/shared/wallets/export-secret-key/index.js b/shared/wallets/export-secret-key/index.tsx
similarity index 95%
rename from shared/wallets/export-secret-key/index.js
rename to shared/wallets/export-secret-key/index.tsx
index 011c2286780e..ff351fc019e9 100644
--- a/shared/wallets/export-secret-key/index.js
+++ b/shared/wallets/export-secret-key/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {
Box2,
@@ -14,13 +13,13 @@ import {SmallAccountID, WalletPopup} from '../common'
import * as Types from '../../constants/types/wallets'
type Props = {
- accountID: Types.AccountID,
- accountName: string,
- secretKey: string,
- onClose: () => void,
- onLoadSecretKey: () => void,
- onSecretKeySeen: () => void,
- username: string,
+ accountID: Types.AccountID
+ accountName: string
+ secretKey: string
+ onClose: () => void
+ onLoadSecretKey: () => void
+ onSecretKeySeen: () => void
+ username: string
}
export default class ExportSecretKeyPopup extends React.Component {
diff --git a/shared/wallets/index.stories.js b/shared/wallets/index.stories.tsx
similarity index 99%
rename from shared/wallets/index.stories.js
rename to shared/wallets/index.stories.tsx
index 1ec46ac24a08..399aa6acdbca 100644
--- a/shared/wallets/index.stories.js
+++ b/shared/wallets/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import asset from './asset/index.stories'
import banner from './banner/index.stories'
import common from './common/index.stories'
diff --git a/shared/wallets/link-existing/container.js b/shared/wallets/link-existing/container.tsx
similarity index 93%
rename from shared/wallets/link-existing/container.js
rename to shared/wallets/link-existing/container.tsx
index 9b6f89656baa..eb5ac2549914 100644
--- a/shared/wallets/link-existing/container.js
+++ b/shared/wallets/link-existing/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../util/container'
import * as WalletsGen from '../../actions/wallets-gen'
import * as RouteTreeGen from '../../actions/route-tree-gen'
@@ -7,7 +6,13 @@ import {anyWaiting} from '../../constants/waiting'
import HiddenString from '../../util/hidden-string'
import {Wrapper as LinkExisting} from '.'
-type OwnProps = Container.RouteProps<{fromSendForm?: boolean, showOnCreation?: boolean}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ fromSendForm?: boolean
+ showOnCreation?: boolean
+ },
+ {}
+>
const mapStateToProps = state => ({
keyError: state.wallets.secretKeyError,
@@ -65,7 +70,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
waiting: stateProps.waiting,
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/link-existing/enter-key.js b/shared/wallets/link-existing/enter-key.tsx
similarity index 96%
rename from shared/wallets/link-existing/enter-key.js
rename to shared/wallets/link-existing/enter-key.tsx
index 39a60e920792..feb1c4f5eb6f 100644
--- a/shared/wallets/link-existing/enter-key.js
+++ b/shared/wallets/link-existing/enter-key.tsx
@@ -1,13 +1,12 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
-type EnterKeyProps = {|
- error: string,
- onKeyChange: string => void,
- secretKey: string,
-|}
+type EnterKeyProps = {
+ error: string
+ onKeyChange: (key: string) => void
+ secretKey: string
+}
const EnterKey = (props: EnterKeyProps) => (
{
diff --git a/shared/wallets/link-existing/index.js b/shared/wallets/link-existing/index.tsx
similarity index 79%
rename from shared/wallets/link-existing/index.js
rename to shared/wallets/link-existing/index.tsx
index 112ece298fb8..85d0db0d0243 100644
--- a/shared/wallets/link-existing/index.js
+++ b/shared/wallets/link-existing/index.tsx
@@ -1,37 +1,36 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import * as Flow from '../../util/flow'
import EnterKey from './enter-key'
import {EnterName, WalletPopup} from '../common'
-import type {ValidationState} from '../../constants/types/wallets'
+import {ValidationState} from '../../constants/types/wallets'
import {isLargeScreen} from '../../constants/platform'
type View = 'key' | 'name'
-type LinkWalletProps = {|
- secretKey: string,
- linkExistingAccountError: string,
- onCancel: () => void,
- onCheckKey: (key: string) => void,
- onCheckName: (name: string) => void,
- onClearErrors: () => void,
- onDone: () => void,
- onNameChange: string => void,
- onKeyChange: string => void,
- keyError: string,
- name: string,
- nameError: string,
- nameValidationState: ValidationState,
- secretKeyValidationState: ValidationState,
- view?: View,
- waiting: boolean,
-|}
+type LinkWalletProps = {
+ secretKey: string
+ linkExistingAccountError: string
+ onCancel: () => void
+ onCheckKey: (key: string) => void
+ onCheckName: (name: string) => void
+ onClearErrors: () => void
+ onDone: () => void
+ onNameChange: (name: string) => void
+ onKeyChange: (key: string) => void
+ keyError: string
+ name: string
+ nameError: string
+ nameValidationState: ValidationState
+ secretKeyValidationState: ValidationState
+ view?: View
+ waiting: boolean
+}
-type LinkWalletState = {|
- view: View,
-|}
+type LinkWalletState = {
+ view: View
+}
class LinkWallet extends React.Component {
state = {view: this.props.view || 'key'}
@@ -124,7 +123,6 @@ class LinkWallet extends React.Component {
)
break
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(this.state.view)
throw new Error('LinkExistingWallet: Unexpected value for `view` encountered: ' + this.state.view)
}
return (
@@ -141,24 +139,24 @@ class LinkWallet extends React.Component {
}
}
-type WrapperProps = {|
- linkExistingAccountError: string,
- onCancel: () => void,
- onCheckKey: (key: string) => void,
- onCheckName: (name: string) => void,
- onClearErrors: () => void,
- onDone: (secretKey: string, name: string) => void,
- keyError: string,
- nameError: string,
- nameValidationState: ValidationState,
- secretKeyValidationState: ValidationState,
- waiting: boolean,
-|}
+type WrapperProps = {
+ linkExistingAccountError: string
+ onCancel: () => void
+ onCheckKey: (key: string) => void
+ onCheckName: (name: string) => void
+ onClearErrors: () => void
+ onDone: (secretKey: string, name: string) => void
+ keyError: string
+ nameError: string
+ nameValidationState: ValidationState
+ secretKeyValidationState: ValidationState
+ waiting: boolean
+}
-type WrapperState = {|
- secretKey: string,
- name: string,
-|}
+type WrapperState = {
+ secretKey: string
+ name: string
+}
class Wrapper extends React.Component {
state = {name: '', secretKey: ''}
diff --git a/shared/wallets/mobile.stories.native.js b/shared/wallets/mobile.stories.native.tsx
similarity index 92%
rename from shared/wallets/mobile.stories.native.js
rename to shared/wallets/mobile.stories.native.tsx
index 710283a10a8f..36e6e0ded899 100644
--- a/shared/wallets/mobile.stories.native.js
+++ b/shared/wallets/mobile.stories.native.tsx
@@ -1,4 +1,3 @@
-// @flow
import qrScan from './qr-scan/index.stories.native'
const load = () => {
diff --git a/shared/wallets/nav-header/add-account.js b/shared/wallets/nav-header/add-account.tsx
similarity index 92%
rename from shared/wallets/nav-header/add-account.js
rename to shared/wallets/nav-header/add-account.tsx
index 5beb8631f266..c2ca24250247 100644
--- a/shared/wallets/nav-header/add-account.js
+++ b/shared/wallets/nav-header/add-account.tsx
@@ -1,13 +1,12 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Container from '../../util/container'
import * as RouteTreeGen from '../../actions/route-tree-gen'
-type AddAccountProps = {|
+type AddAccountProps = {
onAddNew: () => void,
- onLinkExisting: () => void,
-|}
+ onLinkExisting: () => void
+};
const _AddAccount = (props: Kb.PropsWithOverlay) => (
<>
@@ -56,7 +55,7 @@ const mapDispatchToProps = dispatch => ({
},
})
-export default Container.namedConnect<{||}, _, _, _, _>(
+export default Container.namedConnect(
() => ({}),
mapDispatchToProps,
(_, d) => d,
diff --git a/shared/wallets/nav-header/container.js b/shared/wallets/nav-header/container.tsx
similarity index 91%
rename from shared/wallets/nav-header/container.js
rename to shared/wallets/nav-header/container.tsx
index edcece94bedb..1ab3b678c50b 100644
--- a/shared/wallets/nav-header/container.js
+++ b/shared/wallets/nav-header/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../util/container'
import * as Constants from '../../constants/wallets'
import * as Types from '../../constants/types/wallets'
@@ -20,7 +19,7 @@ const mergePropsHeaderTitle = s => ({
username: s.username,
})
-export const HeaderTitle = Container.namedConnect<{||}, _, _, _, _>(
+export const HeaderTitle = Container.namedConnect(
mapStateToPropsHeaderTitle,
() => ({}),
mergePropsHeaderTitle,
@@ -49,7 +48,7 @@ const mergePropsHeaderRightActions = (s, d, o) => ({
onReceive: () => d._onReceive(s._accountID),
})
-export const HeaderRightActions = Container.namedConnect<{||}, _, _, _, _>(
+export const HeaderRightActions = Container.namedConnect(
mapStateToPropsHeaderRightActions,
mapDispatchToPropsHeaderRightActions,
mergePropsHeaderRightActions,
diff --git a/shared/wallets/nav-header/index.js b/shared/wallets/nav-header/index.tsx
similarity index 91%
rename from shared/wallets/nav-header/index.js
rename to shared/wallets/nav-header/index.tsx
index d77d8152b7e3..795703b793ef 100644
--- a/shared/wallets/nav-header/index.js
+++ b/shared/wallets/nav-header/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
@@ -6,14 +5,14 @@ import * as Types from '../../constants/types/wallets'
import {SmallAccountID, SendButton, DropdownButton} from '../common'
import AddAccount from './add-account'
-type HeaderTitleProps = {|
- accountID: Types.AccountID,
- accountName: string,
- isDefault: boolean,
- loading: boolean,
- noDisclaimer: boolean,
- username: string,
-|}
+type HeaderTitleProps = {
+ accountID: Types.AccountID
+ accountName: string
+ isDefault: boolean
+ loading: boolean
+ noDisclaimer: boolean
+ username: string
+}
export const HeaderTitle = (props: HeaderTitleProps) =>
props.noDisclaimer ? null : (
@@ -44,10 +43,10 @@ export const HeaderTitle = (props: HeaderTitleProps) =>
)
-type HeaderRightActionsProps = {|
- noDisclaimer: boolean,
- onReceive: () => void,
-|}
+type HeaderRightActionsProps = {
+ noDisclaimer: boolean
+ onReceive: () => void
+}
export const HeaderRightActions = (props: HeaderRightActionsProps) =>
props.noDisclaimer ? null : (
diff --git a/shared/wallets/onboarding/container.js b/shared/wallets/onboarding/container.tsx
similarity index 90%
rename from shared/wallets/onboarding/container.js
rename to shared/wallets/onboarding/container.tsx
index d5ecce4b68ab..f0278594588e 100644
--- a/shared/wallets/onboarding/container.js
+++ b/shared/wallets/onboarding/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import {connect} from '../../util/container'
import * as WalletsGen from '../../actions/wallets-gen'
import * as Constants from '../../constants/wallets'
@@ -6,12 +5,12 @@ import * as Types from '../../constants/types/wallets'
import {anyErrors} from '../../constants/waiting'
import Onboarding from '.'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => {
const error = anyErrors(state, Constants.acceptDisclaimerWaitingKey)
return {
- acceptDisclaimerError: error?.message ?? '',
+ acceptDisclaimerError: error && error.message ? error.message : '',
acceptingDisclaimerDelay: state.wallets.acceptingDisclaimerDelay,
}
}
@@ -31,7 +30,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
onClose: dispatchProps.onClose,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/onboarding/disclaimer.js b/shared/wallets/onboarding/disclaimer.tsx
similarity index 95%
rename from shared/wallets/onboarding/disclaimer.js
rename to shared/wallets/onboarding/disclaimer.tsx
index 62b39673b09f..48ba4f05628e 100644
--- a/shared/wallets/onboarding/disclaimer.js
+++ b/shared/wallets/onboarding/disclaimer.tsx
@@ -1,29 +1,28 @@
-// @flow
import * as React from 'react'
import * as Constants from '../../constants/wallets'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {WalletPopup} from '../common'
-import {addTicker, removeTicker, type TickerID} from '../../util/second-timer'
+import {addTicker, removeTicker, TickerID} from '../../util/second-timer'
-type DisclaimerProps = {|
- acceptDisclaimerError: string,
- acceptingDisclaimerDelay: boolean,
- onAcceptDisclaimer: () => void,
- onCheckDisclaimer: () => void,
- onNotNow: () => void,
-|}
+type DisclaimerProps = {
+ acceptDisclaimerError: string
+ acceptingDisclaimerDelay: boolean
+ onAcceptDisclaimer: () => void
+ onCheckDisclaimer: () => void
+ onNotNow: () => void
+}
-type DisclaimerState = {|
- secondsLeftAfterAccept: number,
- secondsLeftBeforeAccept: number,
- tryAgain: boolean,
-|}
+type DisclaimerState = {
+ secondsLeftAfterAccept: number
+ secondsLeftBeforeAccept: number
+ tryAgain: boolean
+}
class Disclaimer extends React.Component {
state = {secondsLeftAfterAccept: 6, secondsLeftBeforeAccept: 6, tryAgain: false}
- afterTimer: ?TickerID = null
- beforeTimer: ?TickerID = null
+ afterTimer: TickerID | null = null
+ beforeTimer: TickerID | null = null
afterTick = () => {
this.setState({secondsLeftAfterAccept: Math.max(0, this.state.secondsLeftAfterAccept - 1)}, () => {
diff --git a/shared/wallets/onboarding/index.stories.js b/shared/wallets/onboarding/index.stories.tsx
similarity index 99%
rename from shared/wallets/onboarding/index.stories.js
rename to shared/wallets/onboarding/index.stories.tsx
index fa763ac5158d..cda9aa91341a 100644
--- a/shared/wallets/onboarding/index.stories.js
+++ b/shared/wallets/onboarding/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {action, storiesOf} from '../../stories/storybook'
import {Box} from '../../common-adapters'
diff --git a/shared/wallets/onboarding/index.js b/shared/wallets/onboarding/index.tsx
similarity index 77%
rename from shared/wallets/onboarding/index.js
rename to shared/wallets/onboarding/index.tsx
index a94cdeb9278f..d450f9b377db 100644
--- a/shared/wallets/onboarding/index.js
+++ b/shared/wallets/onboarding/index.tsx
@@ -1,23 +1,22 @@
-// @flow
import * as React from 'react'
import * as Types from '../../constants/types/wallets'
import Disclaimer from './disclaimer'
import Intro from './intro'
-type OnboardingProps = {|
- acceptDisclaimerError: string,
- acceptingDisclaimerDelay: boolean,
- onAcceptDisclaimer: () => void,
- onCheckDisclaimer: (nextScreen: Types.NextScreenAfterAcceptance) => void,
- onClose: () => void,
-|}
+type OnboardingProps = {
+ acceptDisclaimerError: string
+ acceptingDisclaimerDelay: boolean
+ onAcceptDisclaimer: () => void
+ onCheckDisclaimer: (nextScreen: Types.NextScreenAfterAcceptance) => void
+ onClose: () => void
+}
-type OnboardingState = {|
- nextScreen: '' | 'openWallet' | 'linkExisting',
-|}
+type OnboardingState = {
+ nextScreen: '' | 'openWallet' | 'linkExisting'
+}
class Onboarding extends React.Component {
- state = {nextScreen: ''}
+ state = {nextScreen: '' as ''}
_setNextScreen = (nextScreen: Types.NextScreenAfterAcceptance) => {
this.setState({nextScreen})
}
diff --git a/shared/wallets/onboarding/intro.js b/shared/wallets/onboarding/intro.tsx
similarity index 97%
rename from shared/wallets/onboarding/intro.js
rename to shared/wallets/onboarding/intro.tsx
index b360d53c9550..d432c6c4f196 100644
--- a/shared/wallets/onboarding/intro.js
+++ b/shared/wallets/onboarding/intro.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Types from '../../constants/types/wallets'
import * as Styles from '../../styles'
import {WalletPopup} from '../common'
-type IntroProps = {|
- onClose: () => void,
- setNextScreen: (nextScreen: Types.NextScreenAfterAcceptance) => void,
-|}
+type IntroProps = {
+ onClose: () => void
+ setNextScreen: (nextScreen: Types.NextScreenAfterAcceptance) => void
+}
const Intro = (props: IntroProps) => {
const buttons = [
diff --git a/shared/wallets/qr-scan/container.js b/shared/wallets/qr-scan/container.tsx
similarity index 89%
rename from shared/wallets/qr-scan/container.js
rename to shared/wallets/qr-scan/container.tsx
index e6c936748ddc..d005e3a6f544 100644
--- a/shared/wallets/qr-scan/container.js
+++ b/shared/wallets/qr-scan/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import QRScan from '.'
import * as Container from '../../util/container'
import * as WalletsGen from '../../actions/wallets-gen'
@@ -8,7 +7,7 @@ type OwnProps = Container.RouteProps<{}, {}>
const mapStateToProps = () => ({})
const mapDispatchToProps = dispatch => ({
- onSubmitCode: (to: ?string) => {
+ onSubmitCode: (to: string | null) => {
if (to) {
dispatch(WalletsGen.createSetBuildingRecipientType({recipientType: 'stellarPublicKey'}))
dispatch(WalletsGen.createSetBuildingTo({to}))
@@ -21,7 +20,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
})
export default Container.compose(
- Container.connect(
+ Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/qr-scan/index.d.ts b/shared/wallets/qr-scan/index.d.ts
new file mode 100644
index 000000000000..cfd0fbe01b38
--- /dev/null
+++ b/shared/wallets/qr-scan/index.d.ts
@@ -0,0 +1,6 @@
+import * as React from 'react'
+export type Props = {
+ onSubmitCode: (code: string | null) => void
+}
+declare class QRScan extends React.Component {}
+export default QRScan
diff --git a/shared/wallets/qr-scan/index.desktop.js b/shared/wallets/qr-scan/index.desktop.tsx
similarity index 83%
rename from shared/wallets/qr-scan/index.desktop.js
rename to shared/wallets/qr-scan/index.desktop.tsx
index 2e6e7c4756c6..377b883898bb 100644
--- a/shared/wallets/qr-scan/index.desktop.js
+++ b/shared/wallets/qr-scan/index.desktop.tsx
@@ -1,3 +1,2 @@
-// @flow
// No such screen
export default () => null
diff --git a/shared/wallets/qr-scan/index.js.flow b/shared/wallets/qr-scan/index.js.flow
deleted file mode 100644
index bb8aaa1b02bd..000000000000
--- a/shared/wallets/qr-scan/index.js.flow
+++ /dev/null
@@ -1,6 +0,0 @@
-// @flow
-import * as React from 'react'
-export type Props = {
- onSubmitCode: (?string) => void,
-}
-declare export default class QRScan extends React.Component {}
diff --git a/shared/wallets/qr-scan/index.native.js b/shared/wallets/qr-scan/index.native.tsx
similarity index 97%
rename from shared/wallets/qr-scan/index.native.js
rename to shared/wallets/qr-scan/index.native.tsx
index 5ea431d4f85f..78184fc01272 100644
--- a/shared/wallets/qr-scan/index.native.js
+++ b/shared/wallets/qr-scan/index.native.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {RNCamera} from 'react-native-camera'
-import type {Props} from '.'
+import {Props} from '.'
const QRScan = (props: Props) => (
- props.onSubmitCode()}>
+ props.onSubmitCode(null)}>
Cancel
diff --git a/shared/wallets/qr-scan/index.stories.native.js b/shared/wallets/qr-scan/index.stories.native.tsx
similarity index 97%
rename from shared/wallets/qr-scan/index.stories.native.js
rename to shared/wallets/qr-scan/index.stories.native.tsx
index c95018839a2a..8a9f3292e0b7 100644
--- a/shared/wallets/qr-scan/index.stories.native.js
+++ b/shared/wallets/qr-scan/index.stories.native.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {action, storiesOf} from '../../stories/storybook'
import QRScan from './index.native'
diff --git a/shared/wallets/receive-modal/container.js b/shared/wallets/receive-modal/container.tsx
similarity index 93%
rename from shared/wallets/receive-modal/container.js
rename to shared/wallets/receive-modal/container.tsx
index 0fb318d75dca..87c8b881d866 100644
--- a/shared/wallets/receive-modal/container.js
+++ b/shared/wallets/receive-modal/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../util/container'
import * as Constants from '../../constants/wallets'
import * as Types from '../../constants/types/wallets'
@@ -8,7 +7,7 @@ import Receive from '.'
export type OwnProps = Container.RouteProps<
{
- accountID: Types.AccountID,
+ accountID: Types.AccountID
},
{}
>
@@ -44,7 +43,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
onRequest: dispatchProps.onRequest,
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/receive-modal/index.stories.js b/shared/wallets/receive-modal/index.stories.tsx
similarity index 98%
rename from shared/wallets/receive-modal/index.stories.js
rename to shared/wallets/receive-modal/index.stories.tsx
index 824ba9755e5f..5259a9423dc6 100644
--- a/shared/wallets/receive-modal/index.stories.js
+++ b/shared/wallets/receive-modal/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import React from 'react'
import * as Sb from '../../stories/storybook'
import ReceiveModal from '.'
diff --git a/shared/wallets/receive-modal/index.js b/shared/wallets/receive-modal/index.tsx
similarity index 95%
rename from shared/wallets/receive-modal/index.js
rename to shared/wallets/receive-modal/index.tsx
index 0f2f3fc03d96..f124c5f656c2 100644
--- a/shared/wallets/receive-modal/index.js
+++ b/shared/wallets/receive-modal/index.tsx
@@ -1,22 +1,20 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {WalletPopup} from '../common'
import QRCodeGen from 'qrcode-generator'
-type AddressesProps = {|
- federatedAddress?: string,
- stellarAddress: string,
-|}
+type AddressesProps = {
+ federatedAddress?: string
+ stellarAddress: string
+}
-type Props = {|
- ...AddressesProps,
- accountName: string,
- isDefaultAccount: boolean,
- onClose: () => void,
- onRequest: () => void,
-|}
+type Props = {
+ accountName: string
+ isDefaultAccount: boolean
+ onClose: () => void
+ onRequest: () => void
+} & AddressesProps
const ReceiveModal = (props: Props) => {
const header = (
diff --git a/shared/wallets/routes-send-request-form.js b/shared/wallets/routes-send-request-form.tsx
similarity index 98%
rename from shared/wallets/routes-send-request-form.js
rename to shared/wallets/routes-send-request-form.tsx
index 3733e31df2e7..3e5b793ca34f 100644
--- a/shared/wallets/routes-send-request-form.js
+++ b/shared/wallets/routes-send-request-form.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Constants from '../constants/wallets'
export const newModalRoutes = {
diff --git a/shared/wallets/routes.js b/shared/wallets/routes.tsx
similarity index 99%
rename from shared/wallets/routes.js
rename to shared/wallets/routes.tsx
index 9cd82019b9fb..fce09eedb0cb 100644
--- a/shared/wallets/routes.js
+++ b/shared/wallets/routes.tsx
@@ -1,8 +1,8 @@
-// @flow
import {isMobile} from '../constants/platform'
import * as Kb from '../common-adapters'
import * as React from 'react'
import {createNavigator, StackRouter, SceneView} from '@react-navigation/core'
+// @ts-ignore not typed yet
import * as Shim from '../router-v2/shim'
const sharedRoutes = {
diff --git a/shared/wallets/send-form/asset-input/container.js b/shared/wallets/send-form/asset-input/container.tsx
similarity index 90%
rename from shared/wallets/send-form/asset-input/container.js
rename to shared/wallets/send-form/asset-input/container.tsx
index 68a1f7b8622f..df8bfcaaaa35 100644
--- a/shared/wallets/send-form/asset-input/container.js
+++ b/shared/wallets/send-form/asset-input/container.tsx
@@ -1,11 +1,10 @@
-// @flow
import AssetInput from '.'
import * as WalletsGen from '../../../actions/wallets-gen'
import {namedConnect} from '../../../util/container'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
import * as Constants from '../../../constants/wallets'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => {
const {amount, currency} = state.wallets.building
@@ -49,9 +48,4 @@ const mergeProps = (stateProps, dispatchProps) => ({
value: stateProps.value,
})
-export default namedConnect(
- mapStateToProps,
- mapDispatchToProps,
- mergeProps,
- 'AssetInput'
-)(AssetInput)
+export default namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'AssetInput')(AssetInput)
diff --git a/shared/wallets/send-form/asset-input/index.stories.js b/shared/wallets/send-form/asset-input/index.stories.tsx
similarity index 95%
rename from shared/wallets/send-form/asset-input/index.stories.js
rename to shared/wallets/send-form/asset-input/index.stories.tsx
index 7b8a13f06ddf..267eac98f57e 100644
--- a/shared/wallets/send-form/asset-input/index.stories.js
+++ b/shared/wallets/send-form/asset-input/index.stories.tsx
@@ -1,13 +1,14 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import {Box} from '../../../common-adapters'
import {withStateHandlers} from '../../../util/container'
import AssetInput from '.'
-import type {Props as AvailableProps} from '../available'
+import {Props as AvailableProps} from '../available'
const provider = Sb.createPropProvider({
- Available: () => ({amountErrMsg: ''}: AvailableProps),
+ Available: () => ({
+ amountErrMsg: '',
+ }),
})
const common = {
diff --git a/shared/wallets/send-form/asset-input/index.js b/shared/wallets/send-form/asset-input/index.tsx
similarity index 93%
rename from shared/wallets/send-form/asset-input/index.js
rename to shared/wallets/send-form/asset-input/index.tsx
index e1ce652a119a..46b7a201a9df 100644
--- a/shared/wallets/send-form/asset-input/index.js
+++ b/shared/wallets/send-form/asset-input/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
@@ -27,19 +26,19 @@ const truncateAmount = (amt, numDecimalsAllowed) => {
return num.toFixed(numDecimalsAllowed)
}
-type Props = {|
- bottomLabel: string,
- displayUnit: string,
- inputPlaceholder: string,
- currencyLoading: boolean,
- numDecimalsAllowed: number,
- onChangeAmount: string => void,
- onChangeDisplayUnit: () => void,
- topLabel: string,
- value: string,
- warningAsset?: string,
- warningPayee?: string,
-|}
+type Props = {
+ bottomLabel: string
+ displayUnit: string
+ inputPlaceholder: string
+ currencyLoading: boolean
+ numDecimalsAllowed: number
+ onChangeAmount: (amount: string) => void
+ onChangeDisplayUnit: () => void
+ topLabel: string
+ value: string
+ warningAsset?: string
+ warningPayee?: string
+}
class AssetInput extends React.Component {
componentDidMount() {
@@ -111,7 +110,7 @@ class AssetInput extends React.Component {
error={!!this.props.warningAsset}
value={this.props.value}
/>
-
+
{!!this.props.warningPayee && (
{this.props.warningPayee} doesn't accept{' '}
diff --git a/shared/wallets/send-form/available/container.js b/shared/wallets/send-form/available/container.tsx
similarity index 83%
rename from shared/wallets/send-form/available/container.js
rename to shared/wallets/send-form/available/container.tsx
index 1124d5a438ac..ba239cb66bd5 100644
--- a/shared/wallets/send-form/available/container.js
+++ b/shared/wallets/send-form/available/container.tsx
@@ -1,8 +1,7 @@
-// @flow
import Available from '.'
import {namedConnect} from '../../../util/container'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => ({
amountErrMsg: state.wallets.building.isRequest
@@ -12,7 +11,7 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => ({})
-export default namedConnect(
+export default namedConnect(
mapStateToProps,
mapDispatchToProps,
(s, d, o) => ({...o, ...s, ...d}),
diff --git a/shared/wallets/send-form/available/index.js b/shared/wallets/send-form/available/index.tsx
similarity index 93%
rename from shared/wallets/send-form/available/index.js
rename to shared/wallets/send-form/available/index.tsx
index 6c858063c39a..b429e4632889 100644
--- a/shared/wallets/send-form/available/index.js
+++ b/shared/wallets/send-form/available/index.tsx
@@ -1,11 +1,10 @@
-// @flow
import * as React from 'react'
import * as Styles from '../../../styles'
import * as Kb from '../../../common-adapters'
-export type Props = {|
- amountErrMsg: string,
-|}
+export type Props = {
+ amountErrMsg: string
+}
const Available = (props: Props) => {
// This will only work to apply one custom style.
diff --git a/shared/wallets/send-form/body/container.js b/shared/wallets/send-form/body/container.tsx
similarity index 80%
rename from shared/wallets/send-form/body/container.js
rename to shared/wallets/send-form/body/container.tsx
index 043e8ee0ffa1..dcbbad816e7d 100644
--- a/shared/wallets/send-form/body/container.js
+++ b/shared/wallets/send-form/body/container.tsx
@@ -1,10 +1,9 @@
-// @flow
import {SendBody as SendBodyComponent, RequestBody as RequestBodyComponent} from '.'
import {namedConnect} from '../../../util/container'
import * as Constants from '../../../constants/wallets'
import * as WalletsGen from '../../../actions/wallets-gen'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => ({
_failed: !!state.wallets.sentPaymentError,
@@ -25,14 +24,11 @@ const mergeProps = (stateProps, dispatchProps) => ({
onReviewPayments: stateProps._failed ? dispatchProps._onReviewPayments : null,
})
-export const SendBody = namedConnect(
- mapStateToProps,
- mapDispatchToProps,
- mergeProps,
- 'ConnectedSendBody'
-)(SendBodyComponent)
+export const SendBody = namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'ConnectedSendBody')(
+ SendBodyComponent
+)
-export const RequestBody = namedConnect(
+export const RequestBody = namedConnect(
mapStateToProps,
mapDispatchToProps,
mergeProps,
diff --git a/shared/wallets/send-form/body/index.js b/shared/wallets/send-form/body/index.tsx
similarity index 91%
rename from shared/wallets/send-form/body/index.js
rename to shared/wallets/send-form/body/index.tsx
index 4be5776ec792..7c7395767341 100644
--- a/shared/wallets/send-form/body/index.js
+++ b/shared/wallets/send-form/body/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
@@ -7,17 +6,17 @@ import Banner from '../../banner'
import Footer from '../footer/container'
import {SecretNote, PublicMemo} from '../note-and-memo/container'
import Participants from '../participants/container'
-import type {Banner as BannerType} from '../../../constants/types/wallets'
+import {Banner as BannerType} from '../../../constants/types/wallets'
-type SendBodyProps = {|
- banners: Array,
- onReviewPayments: ?() => void,
- isProcessing?: boolean,
-|}
+type SendBodyProps = {
+ banners: Array
+ onReviewPayments: (() => void) | null
+ isProcessing?: boolean
+}
type RequestBodyProps = {
- banners: Array,
- isProcessing?: boolean,
+ banners: Array
+ isProcessing?: boolean
}
const Spinner = () => (
diff --git a/shared/wallets/send-form/choose-asset/container.js b/shared/wallets/send-form/choose-asset/container.tsx
similarity index 90%
rename from shared/wallets/send-form/choose-asset/container.js
rename to shared/wallets/send-form/choose-asset/container.tsx
index e7e1d7e334e6..a0c4bdfc66cf 100644
--- a/shared/wallets/send-form/choose-asset/container.js
+++ b/shared/wallets/send-form/choose-asset/container.tsx
@@ -1,5 +1,4 @@
-// @flow
-import ChooseAsset, {type DisplayItem, type OtherItem} from '.'
+import ChooseAsset, {DisplayItem, OtherItem} from '.'
import * as Container from '../../../util/container'
import * as WalletsGen from '../../../actions/wallets-gen'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
@@ -56,9 +55,6 @@ const mergeProps = (stateProps, dispatchProps) => ({
selected: stateProps.selected,
})
-export default Container.namedConnect(
- mapStateToProps,
- mapDispatchToProps,
- mergeProps,
- 'ChooseAsset'
-)(ChooseAsset)
+export default Container.namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'ChooseAsset')(
+ ChooseAsset
+)
diff --git a/shared/wallets/send-form/choose-asset/index.stories.js b/shared/wallets/send-form/choose-asset/index.stories.tsx
similarity index 68%
rename from shared/wallets/send-form/choose-asset/index.stories.js
rename to shared/wallets/send-form/choose-asset/index.stories.tsx
index 2dd627e30e78..2557472e8ca4 100644
--- a/shared/wallets/send-form/choose-asset/index.stories.js
+++ b/shared/wallets/send-form/choose-asset/index.stories.tsx
@@ -1,20 +1,19 @@
-// @flow
import * as React from 'react'
import {action, storiesOf} from '../../../stories/storybook'
import ChooseAsset from '.'
const props = {
displayChoices: [
- {currencyCode: 'Lumens', selected: false, symbol: 'XLM', type: 'display choice'},
- {currencyCode: 'USD', selected: false, symbol: '$', type: 'display choice'},
- {currencyCode: 'EUR', selected: true, symbol: '€', type: 'display choice'},
- {currencyCode: 'GBP', selected: false, symbol: '£', type: 'display choice'},
- {currencyCode: 'CAD', selected: false, symbol: '$', type: 'display choice'},
- {currencyCode: 'CRC', selected: false, symbol: 'â‚¡', type: 'display choice'},
- {currencyCode: 'JPY', selected: false, symbol: 'Â¥', type: 'display choice'},
- {currencyCode: 'FJD', selected: false, symbol: '$', type: 'display choice'},
- {currencyCode: 'HNL', selected: false, symbol: 'L', type: 'display choice'},
- {currencyCode: 'KRW', selected: false, symbol: 'â‚©', type: 'display choice'},
+ {currencyCode: 'Lumens', selected: false, symbol: 'XLM', type: 'display choice' as 'display choice'},
+ {currencyCode: 'USD', selected: false, symbol: '$', type: 'display choice' as 'display choice'},
+ {currencyCode: 'EUR', selected: true, symbol: '€', type: 'display choice' as 'display choice'},
+ {currencyCode: 'GBP', selected: false, symbol: '£', type: 'display choice' as 'display choice'},
+ {currencyCode: 'CAD', selected: false, symbol: '$', type: 'display choice' as 'display choice'},
+ {currencyCode: 'CRC', selected: false, symbol: 'â‚¡', type: 'display choice' as 'display choice'},
+ {currencyCode: 'JPY', selected: false, symbol: 'Â¥', type: 'display choice' as 'display choice'},
+ {currencyCode: 'FJD', selected: false, symbol: '$', type: 'display choice' as 'display choice'},
+ {currencyCode: 'HNL', selected: false, symbol: 'L', type: 'display choice' as 'display choice'},
+ {currencyCode: 'KRW', selected: false, symbol: 'â‚©', type: 'display choice' as 'display choice'},
],
isRequest: false,
onBack: action('onBack'),
@@ -26,15 +25,21 @@ const props = {
disabledExplanation: '',
issuer: 'Stronghold.co',
selected: false,
- type: 'other choice',
+ type: 'other choice' as 'other choice',
+ },
+ {
+ currencyCode: 'KEYZ',
+ disabledExplanation: '',
+ issuer: 'Unknown',
+ selected: false,
+ type: 'other choice' as 'other choice',
},
- {currencyCode: 'KEYZ', disabledExplanation: '', issuer: 'Unknown', selected: false, type: 'other choice'},
{
currencyCode: 'HUGZ',
disabledExplanation: `max doesn't accept HUGZ.`,
issuer: 'Jed',
selected: false,
- type: 'other choice',
+ type: 'other choice' as 'other choice',
},
],
selected: 'XLM',
diff --git a/shared/wallets/send-form/choose-asset/index.js b/shared/wallets/send-form/choose-asset/index.tsx
similarity index 90%
rename from shared/wallets/send-form/choose-asset/index.js
rename to shared/wallets/send-form/choose-asset/index.tsx
index 0084935cbed8..c74ae31bfc15 100644
--- a/shared/wallets/send-form/choose-asset/index.js
+++ b/shared/wallets/send-form/choose-asset/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
@@ -6,32 +5,38 @@ import Header from '../header'
const unexpandedNumDisplayOptions = 4
-export type DisplayItem = {currencyCode: string, selected: boolean, symbol: string, type: 'display choice'}
+export type DisplayItem = {
+ currencyCode: string
+ selected: boolean
+ symbol: string
+ type: 'display choice'
+}
export type OtherItem = {
- currencyCode: string,
- disabledExplanation: string,
- issuer: string,
- selected: boolean,
- type: 'other choice',
+ currencyCode: string
+ disabledExplanation: string
+ issuer: string
+ selected: boolean
+ type: 'other choice'
}
+
type ExpanderItem = {
- onClick: () => void,
- text: string,
- type: 'expander',
+ onClick: () => void
+ text: string
+ type: 'expander'
}
-export type Props = {|
- displayChoices: Array,
- onBack: () => void,
- onChoose: (item: DisplayItem | OtherItem) => void,
- onRefresh: () => void,
- otherChoices: Array,
- isRequest: boolean,
- selected: string,
-|}
+export type Props = {
+ displayChoices: Array
+ onBack: () => void
+ onChoose: (item: DisplayItem | OtherItem) => void
+ onRefresh: () => void
+ otherChoices: Array
+ isRequest: boolean
+ selected: string
+}
type State = {
- expanded: boolean,
+ expanded: boolean
}
class ChooseAsset extends React.Component {
@@ -44,7 +49,16 @@ class ChooseAsset extends React.Component {
_renderItem = ({
item,
}: {
- item: (DisplayItem & {key: string}) | (OtherItem & {key: string}) | (ExpanderItem & {key: string}),
+ item:
+ | DisplayItem & {
+ key: string
+ }
+ | OtherItem & {
+ key: string
+ }
+ | ExpanderItem & {
+ key: string
+ }
}) => {
switch (item.type) {
case 'display choice':
@@ -80,8 +94,6 @@ class ChooseAsset extends React.Component {
)
- default:
- throw new Error(`ChooseAsset: impossible item type encountered: ${item.type}`)
}
}
@@ -122,6 +134,7 @@ class ChooseAsset extends React.Component {
key: 'expander',
onClick: () => this.setState({expanded: true}),
text: `+${this.props.displayChoices.length - unexpandedNumDisplayOptions} display currencies`,
+ // @ts-ignore When coming from props, displayChoicesData is pure DisplayItem
type: 'expander',
})
}
@@ -172,11 +185,12 @@ class ChooseAsset extends React.Component {
}
type DisplayChoiceProps = {
- currencyCode: string,
- onClick: () => void,
- selected: boolean,
- symbol: string,
+ currencyCode: string
+ onClick: () => void
+ selected: boolean
+ symbol: string
}
+
const DisplayChoice = (props: DisplayChoiceProps) => (
(
)
type OtherChoiceProps = {
- currencyCode: string,
- disabledExplanation: string,
- issuer: string,
- onClick: () => void,
- selected: boolean,
+ currencyCode: string
+ disabledExplanation: string
+ issuer: string
+ onClick: () => void
+ selected: boolean
}
+
const OtherChoice = (props: OtherChoiceProps) => (
({
isRequest: state.wallets.building.isRequest,
@@ -18,7 +17,7 @@ const mergeProps = ({isRequest}, {onClose}) => ({
onClose,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/send-form/footer/container.js b/shared/wallets/send-form/footer/container.tsx
similarity index 90%
rename from shared/wallets/send-form/footer/container.js
rename to shared/wallets/send-form/footer/container.tsx
index 8ffc72d86205..bedd95daba88 100644
--- a/shared/wallets/send-form/footer/container.js
+++ b/shared/wallets/send-form/footer/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import Footer from '.'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
import * as WalletsGen from '../../../actions/wallets-gen'
@@ -7,7 +6,7 @@ import {namedConnect} from '../../../util/container'
import {anyWaiting} from '../../../constants/waiting'
type OwnProps = {
- onConfirm?: () => void, // if showing confirm form directly (not through routing)
+ onConfirm?: () => void // if showing confirm form directly (not through routing)
}
const mapStateToProps = state => {
@@ -61,6 +60,4 @@ const mergeProps = (s, d, o) => ({
worthDescription: s.worthDescription,
})
-export default namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'Footer')(
- Footer
-)
+export default namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'Footer')(Footer)
diff --git a/shared/wallets/send-form/footer/index.stories.js b/shared/wallets/send-form/footer/index.stories.tsx
similarity index 99%
rename from shared/wallets/send-form/footer/index.stories.js
rename to shared/wallets/send-form/footer/index.stories.tsx
index 22ac0cf18f03..fa7593502fc2 100644
--- a/shared/wallets/send-form/footer/index.stories.js
+++ b/shared/wallets/send-form/footer/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import {Box} from '../../../common-adapters'
diff --git a/shared/wallets/send-form/footer/index.js b/shared/wallets/send-form/footer/index.tsx
similarity index 94%
rename from shared/wallets/send-form/footer/index.js
rename to shared/wallets/send-form/footer/index.tsx
index 3b0868f96d38..f4834dc3cd26 100644
--- a/shared/wallets/send-form/footer/index.js
+++ b/shared/wallets/send-form/footer/index.tsx
@@ -1,17 +1,16 @@
-// @flow
import * as React from 'react'
import * as Constants from '../../../constants/wallets'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
type Props = {
- calculating: boolean,
- disabled?: boolean,
- onClickRequest?: Function,
- onClickSend?: Function,
- thisDeviceIsLockedOut: boolean,
- waitingKey: string,
- worthDescription?: string,
+ calculating: boolean
+ disabled?: boolean
+ onClickRequest?: Function
+ onClickSend?: Function
+ thisDeviceIsLockedOut: boolean
+ waitingKey: string
+ worthDescription?: string
}
const Footer = (props: Props) => {
diff --git a/shared/wallets/send-form/header.js b/shared/wallets/send-form/header.tsx
similarity index 94%
rename from shared/wallets/send-form/header.js
rename to shared/wallets/send-form/header.tsx
index b8a20fbfa296..a2a1bb94a383 100644
--- a/shared/wallets/send-form/header.js
+++ b/shared/wallets/send-form/header.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import {WalletBackButton} from '../common'
-type Props = {|
- isRequest: boolean,
- onBack?: ?() => void,
- whiteBackground?: boolean,
-|}
+type Props = {
+ isRequest: boolean
+ onBack?: (() => void) | null
+ whiteBackground?: boolean
+}
const Header = (props: Props) => (
diff --git a/shared/wallets/send-form/index.stories.js b/shared/wallets/send-form/index.stories.tsx
similarity index 94%
rename from shared/wallets/send-form/index.stories.js
rename to shared/wallets/send-form/index.stories.tsx
index 2766a22eee1c..09c545abc680 100644
--- a/shared/wallets/send-form/index.stories.js
+++ b/shared/wallets/send-form/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import assetInput, {props4 as assetInputProps} from './asset-input/index.stories'
@@ -6,7 +5,7 @@ import chooseAsset from './choose-asset/index.stories'
import footers from './footer/index.stories'
import noteAndMemo from './note-and-memo/index.stories'
import participants from './participants/index.stories'
-import type {Props as AvailableProps} from './available'
+import {Props as AvailableProps} from './available'
import SendRequestForm from '.'
@@ -17,7 +16,10 @@ import SendRequestForm from '.'
const provider = Sb.createPropProviderWithCommon({
// TODO mock out meaningful values once type `OwnProps` is defined
AssetInput: props => assetInputProps,
- Available: props => ({amountErrMsg: ''}: AvailableProps),
+
+ Available: props => ({
+ amountErrMsg: '',
+ }),
Banner: props => ({}),
ConnectedPublicMemo: props => ({onChangePublicMemo: Sb.action('onChangePublicMemo')}),
ConnectedRequestBody: props => ({
diff --git a/shared/wallets/send-form/index.js b/shared/wallets/send-form/index.tsx
similarity index 81%
rename from shared/wallets/send-form/index.js
rename to shared/wallets/send-form/index.tsx
index 80c90fa94562..e8a2b4c8c507 100644
--- a/shared/wallets/send-form/index.js
+++ b/shared/wallets/send-form/index.tsx
@@ -1,12 +1,11 @@
-// @flow
import * as React from 'react'
import Root from './root'
import {SendBody, RequestBody} from './body/container'
-type Props = {|
- isRequest: boolean,
- onClose: () => void,
-|}
+type Props = {
+ isRequest: boolean
+ onClose: () => void
+}
const SendRequestForm = (props: Props) => (
diff --git a/shared/wallets/send-form/note-and-memo/container.js b/shared/wallets/send-form/note-and-memo/container.tsx
similarity index 92%
rename from shared/wallets/send-form/note-and-memo/container.js
rename to shared/wallets/send-form/note-and-memo/container.tsx
index 9ae533c5c8c5..5e6b2d74825f 100644
--- a/shared/wallets/send-form/note-and-memo/container.js
+++ b/shared/wallets/send-form/note-and-memo/container.tsx
@@ -1,10 +1,9 @@
-// @flow
import {SecretNote as SecretNoteComponent, PublicMemo as PublicMemoComponent} from '.'
import * as WalletsGen from '../../../actions/wallets-gen'
import {namedConnect} from '../../../util/container'
import HiddenString from '../../../util/hidden-string'
-type OwnProps = {||}
+type OwnProps = {}
const secretNoteConnector = {
mapDispatchToProps: (dispatch, ownProps) => ({
@@ -42,14 +41,14 @@ const publicMemoConnector = {
},
}
-export const SecretNote = namedConnect(
+export const SecretNote = namedConnect(
secretNoteConnector.mapStateToProps,
secretNoteConnector.mapDispatchToProps,
(s, d, o) => ({...o, ...s, ...d}),
'ConnectedSecretNote'
)(SecretNoteComponent)
-export const PublicMemo = namedConnect(
+export const PublicMemo = namedConnect(
publicMemoConnector.mapStateToProps,
publicMemoConnector.mapDispatchToProps,
(s, d, o) => ({...o, ...s, ...d}),
diff --git a/shared/wallets/send-form/note-and-memo/index.stories.js b/shared/wallets/send-form/note-and-memo/index.stories.tsx
similarity index 99%
rename from shared/wallets/send-form/note-and-memo/index.stories.js
rename to shared/wallets/send-form/note-and-memo/index.stories.tsx
index bae0f1a3629d..05361c1dd66b 100644
--- a/shared/wallets/send-form/note-and-memo/index.stories.js
+++ b/shared/wallets/send-form/note-and-memo/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import {SecretNote, PublicMemo} from '.'
diff --git a/shared/wallets/send-form/note-and-memo/index.js b/shared/wallets/send-form/note-and-memo/index.tsx
similarity index 93%
rename from shared/wallets/send-form/note-and-memo/index.js
rename to shared/wallets/send-form/note-and-memo/index.tsx
index 18d95ddb917f..f709ad36c0a3 100644
--- a/shared/wallets/send-form/note-and-memo/index.js
+++ b/shared/wallets/send-form/note-and-memo/index.tsx
@@ -1,21 +1,21 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
+// @ts-ignore not typed yet
import {backgroundImageFn} from '../../../common-adapters/emoji'
import {Picker} from 'emoji-mart'
type SecretNoteProps = {
- secretNote: string, // Initial value only
- secretNoteError?: string,
- onChangeSecretNote: string => void,
- toSelf: boolean,
+ secretNote: string // Initial value only
+ secretNoteError?: string
+ onChangeSecretNote: (note: string) => void
+ toSelf: boolean
}
type PublicMemoProps = {
- publicMemo: string, // Initial value only
- publicMemoError?: string,
- onChangePublicMemo: string => void,
+ publicMemo: string // Initial value only
+ publicMemoError?: string
+ onChangePublicMemo: (memo: string) => void
}
// TODO use wallet staticConfig to keep in sync with the service
@@ -23,12 +23,12 @@ const secretNoteMaxLength = 500
const publicMemoMaxLength = 28
type SecretNoteState = {
- emojiPickerOpen: boolean,
- secretNote: string,
+ emojiPickerOpen: boolean
+ secretNote: string
}
type PublicMemoState = {
- publicMemo: string,
+ publicMemo: string
}
class SecretNote extends React.Component {
@@ -39,8 +39,8 @@ class SecretNote extends React.Component {
emojiPickerOpen: false,
secretNote: this.props.secretNote,
}
- _emojiIcon = React.createRef()
- _note = React.createRef()
+ _emojiIcon = React.createRef()
+ _note = React.createRef()
_onChangeSecretNote = (secretNote: string) => {
this.props.onChangeSecretNote(secretNote)
diff --git a/shared/wallets/send-form/participants/container.js b/shared/wallets/send-form/participants/container.tsx
similarity index 93%
rename from shared/wallets/send-form/participants/container.js
rename to shared/wallets/send-form/participants/container.tsx
index 5a08bb6f2c6a..19133d451212 100644
--- a/shared/wallets/send-form/participants/container.js
+++ b/shared/wallets/send-form/participants/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {ParticipantsKeybaseUser, ParticipantsStellarPublicKey, ParticipantsOtherAccount} from '.'
import * as ProfileGen from '../../../actions/profile-gen'
@@ -12,7 +11,7 @@ import * as Types from '../../../constants/types/wallets'
import {anyWaiting} from '../../../constants/waiting'
import {namedConnect, isMobile} from '../../../util/container'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToPropsKeybaseUser = state => {
const build = state.wallets.building
@@ -49,7 +48,7 @@ const mergePropsKeybaseUser = (stateProps, dispatchProps) => {
}
}
-const ConnectedParticipantsKeybaseUser = namedConnect(
+const ConnectedParticipantsKeybaseUser = namedConnect(
mapStateToPropsKeybaseUser,
mapDispatchToPropsKeybaseUser,
mergePropsKeybaseUser,
@@ -91,7 +90,7 @@ const mapDispatchToPropsStellarPublicKey = dispatch => ({
},
})
-const ConnectedParticipantsStellarPublicKey = namedConnect(
+const ConnectedParticipantsStellarPublicKey = namedConnect(
mapStateToPropsStellarPublicKey,
mapDispatchToPropsStellarPublicKey,
(s, d, o) => ({...o, ...s, ...d}),
@@ -151,7 +150,7 @@ const mapDispatchToPropsOtherAccount = dispatch => ({
),
})
-const ConnectedParticipantsOtherAccount = namedConnect(
+const ConnectedParticipantsOtherAccount = namedConnect(
mapStateToPropsOtherAccount,
mapDispatchToPropsOtherAccount,
(s, d, o) => ({...o, ...s, ...d}),
@@ -166,20 +165,21 @@ const mapStateToPropsChooser = state => {
const ParticipantsChooser = props => {
switch (props.recipientType) {
case 'keybaseUser':
+ // @ts-ignore not sure what's up here
return
case 'stellarPublicKey':
+ // @ts-ignore not sure what's up here
return
-
case 'otherAccount':
+ // @ts-ignore not sure what's up here
return
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.recipientType)
throw new Error(`Unexpected recipientType ${props.recipientType}`)
}
}
-const ConnectedParticipantsChooser = namedConnect(
+const ConnectedParticipantsChooser = namedConnect(
mapStateToPropsChooser,
() => ({}),
(s, d, o) => ({...o, ...s, ...d}),
diff --git a/shared/wallets/send-form/participants/dropdown.js b/shared/wallets/send-form/participants/dropdown.tsx
similarity index 92%
rename from shared/wallets/send-form/participants/dropdown.js
rename to shared/wallets/send-form/participants/dropdown.tsx
index bb495ce2c92f..a7f53e7001cb 100644
--- a/shared/wallets/send-form/participants/dropdown.js
+++ b/shared/wallets/send-form/participants/dropdown.tsx
@@ -1,13 +1,12 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
import {AccountEntry} from '../../common'
-import type {Account} from '.'
+import {Account} from '.'
type DropdownTextProps = {
- spinner?: boolean,
- text: string,
+ spinner?: boolean
+ text: string
}
// A text selection, e.g., "Create a new account".
@@ -21,9 +20,9 @@ export const DropdownText = ({text, spinner, ...props}: DropdownTextProps) => (
)
type SelectedEntryProps = {
- account: Account,
- spinner?: boolean,
- user: string,
+ account: Account
+ spinner?: boolean
+ user: string
}
// The display of the selected account in the dropdown.
@@ -40,8 +39,8 @@ export const SelectedEntry = ({account, spinner, user, ...props}: SelectedEntryP
)
type DropdownEntryProps = {
- account: Account,
- user: string,
+ account: Account
+ user: string
}
// The display of an entry in the dropdown popup.
diff --git a/shared/wallets/send-form/participants/from-field.js b/shared/wallets/send-form/participants/from-field.tsx
similarity index 75%
rename from shared/wallets/send-form/participants/from-field.js
rename to shared/wallets/send-form/participants/from-field.tsx
index 0bcb26afd835..1fd795d4ddb5 100644
--- a/shared/wallets/send-form/participants/from-field.js
+++ b/shared/wallets/send-form/participants/from-field.tsx
@@ -1,32 +1,30 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
import {ParticipantsRow} from '../../common'
-import type {AccountID} from '../../../constants/types/wallets'
+import {AccountID} from '../../../constants/types/wallets'
import {SelectedEntry, DropdownEntry} from './dropdown'
-import type {Account} from '.'
+import {Account} from '.'
-type FromFieldProps = {|
- accounts: Account[],
- initialAccount: Account,
- onChangeSelectedAccount: (id: AccountID) => void,
- user: string,
-|}
+type FromFieldProps = {
+ accounts: Account[]
+ initialAccount: Account
+ onChangeSelectedAccount: (id: AccountID) => void
+ user: string
+}
-type FromFieldState = {|
- selectedAccount: Account,
-|}
+type FromFieldState = {
+ selectedAccount: Account
+}
class FromField extends React.Component {
state = {
selectedAccount: this.props.initialAccount,
}
- onDropdownChange = (node: React.Node) => {
+ onDropdownChange = (node: React.ReactNode) => {
if (React.isValidElement(node)) {
- // $FlowIssue React.isValidElement refinement doesn't happen, see https://github.com/facebook/flow/issues/6392
- const element = (node: React.Element)
+ const element: React.ReactElement = node
this.setState({selectedAccount: element.props.account})
this.props.onChangeSelectedAccount(element.props.account.id)
}
diff --git a/shared/wallets/send-form/participants/index.stories.js b/shared/wallets/send-form/participants/index.stories.tsx
similarity index 96%
rename from shared/wallets/send-form/participants/index.stories.js
rename to shared/wallets/send-form/participants/index.stories.tsx
index b51944500245..56df013263b7 100644
--- a/shared/wallets/send-form/participants/index.stories.js
+++ b/shared/wallets/send-form/participants/index.stories.tsx
@@ -1,16 +1,10 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import {Box2, Text} from '../../../common-adapters'
import {stringToAccountID} from '../../../constants/types/wallets'
-import {
- type Account,
- ParticipantsKeybaseUser,
- ParticipantsStellarPublicKey,
- ParticipantsOtherAccount,
-} from '.'
+import {Account, ParticipantsKeybaseUser, ParticipantsStellarPublicKey, ParticipantsOtherAccount} from '.'
import {makeSelectorMap as makeResultsListSelectorMap} from '../../../search/results-list/index.stories'
-import {type ConnectPropsMap as RowConnectPropsMap} from '../../../search/result-row/index.stories'
+import {ConnectPropsMap as RowConnectPropsMap} from '../../../search/result-row/index.stories'
import {makeSelectorMap as makeUserInputSelectorMap} from '../../../search/user-input/index.stories'
const connectPropsMap: RowConnectPropsMap = {
diff --git a/shared/wallets/send-form/participants/index.js b/shared/wallets/send-form/participants/index.tsx
similarity index 69%
rename from shared/wallets/send-form/participants/index.js
rename to shared/wallets/send-form/participants/index.tsx
index 1390770f5d0c..88d5e550ee45 100644
--- a/shared/wallets/send-form/participants/index.js
+++ b/shared/wallets/send-form/participants/index.tsx
@@ -1,15 +1,14 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import FromField from './from-field'
import {
- type ToKeybaseUserProps,
+ ToKeybaseUserProps,
ToKeybaseUser,
- type ToStellarPublicKeyProps,
+ ToStellarPublicKeyProps,
ToStellarPublicKey,
ToOtherAccount,
} from './to-field'
-import type {AccountID} from '../../../constants/types/wallets'
+import {AccountID} from '../../../constants/types/wallets'
const ParticipantsKeybaseUser = (props: ToKeybaseUserProps) => (
@@ -23,25 +22,25 @@ const ParticipantsStellarPublicKey = (props: ToStellarPublicKeyProps) => (
)
-export type Account = {|
- contents: string,
- name: string,
- id: AccountID,
- isDefault: boolean,
- unknown?: boolean,
-|}
+export type Account = {
+ contents: string
+ name: string
+ id: AccountID
+ isDefault: boolean
+ unknown?: boolean
+}
-type ParticipantsOtherAccountProps = {|
- user: string,
- fromAccount: Account,
- toAccount?: Account,
- allAccounts: Account[],
- onChangeFromAccount: AccountID => void,
- onChangeRecipient: string => void,
- onLinkAccount: () => void,
- onCreateNewAccount: () => void,
- showSpinner: boolean,
-|}
+type ParticipantsOtherAccountProps = {
+ user: string
+ fromAccount: Account
+ toAccount?: Account
+ allAccounts: Account[]
+ onChangeFromAccount: (accountID: AccountID) => void
+ onChangeRecipient: (recipient: string) => void
+ onLinkAccount: () => void
+ onCreateNewAccount: () => void
+ showSpinner: boolean
+}
const ParticipantsOtherAccount = (props: ParticipantsOtherAccountProps) => (
diff --git a/shared/wallets/send-form/participants/search.js b/shared/wallets/send-form/participants/search.tsx
similarity index 93%
rename from shared/wallets/send-form/participants/search.js
rename to shared/wallets/send-form/participants/search.tsx
index 436d17ac6694..a38e7399aaed 100644
--- a/shared/wallets/send-form/participants/search.js
+++ b/shared/wallets/send-form/participants/search.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Styles from '../../../styles'
import * as Kb from '../../../common-adapters'
@@ -7,26 +6,26 @@ import UserInput from '../../../search/user-input/container'
import {ParticipantsRow} from '../../common'
import {searchKey} from '../../../constants/wallets'
-export type SearchProps = {|
- heading: 'To' | 'From',
- onClickResult: (username: string) => void,
- onShowSuggestions: () => void,
- onShowTracker: (username: string) => void,
- onScanQRCode: ?() => void,
-|}
+export type SearchProps = {
+ heading: 'To' | 'From'
+ onClickResult: (username: string) => void
+ onShowSuggestions: () => void
+ onShowTracker: (username: string) => void
+ onScanQRCode: (() => void) | null
+}
-type SearchState = {|
- displayResultsList: boolean,
- hideClearSearch: boolean,
- searchText: string,
-|}
+type SearchState = {
+ displayResultsList: boolean
+ hideClearSearch: boolean
+ searchText: string
+}
const placeholder = 'Search Keybase'
// TODO: Once UserInput is cleaned up, we may be able to stretch it
// properly horizontally without wrapping a vertical Box2 around it.
class Search extends React.Component {
- _row: ?ParticipantsRow
+ _row: ParticipantsRow | null
state = {
displayResultsList: false,
hideClearSearch: true,
diff --git a/shared/wallets/send-form/participants/to-field.js b/shared/wallets/send-form/participants/to-field.tsx
similarity index 89%
rename from shared/wallets/send-form/participants/to-field.js
rename to shared/wallets/send-form/participants/to-field.tsx
index 8a3995e77d1e..fac9025f2d9e 100644
--- a/shared/wallets/send-form/participants/to-field.js
+++ b/shared/wallets/send-form/participants/to-field.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
@@ -6,19 +5,19 @@ import {ParticipantsRow} from '../../common'
import {isLargeScreen} from '../../../constants/platform'
import {SelectedEntry, DropdownEntry, DropdownText} from './dropdown'
import Search from './search'
-import type {Account} from '.'
+import {Account} from '.'
import {debounce} from 'lodash-es'
-type ToKeybaseUserProps = {|
- isRequest: boolean,
- recipientUsername: string,
- errorMessage?: string,
- onShowProfile: string => void,
- onShowSuggestions: () => void,
- onRemoveProfile: () => void,
- onChangeRecipient: string => void,
- onScanQRCode: ?() => void,
-|}
+export type ToKeybaseUserProps = {
+ isRequest: boolean
+ recipientUsername: string
+ errorMessage?: string
+ onShowProfile: (username: string) => void
+ onShowSuggestions: () => void
+ onRemoveProfile: () => void
+ onChangeRecipient: (recipient: string) => void
+ onScanQRCode: (() => void) | null
+}
const placeholderExample = isLargeScreen ? 'Ex: G12345... or you*example.com' : 'G12.. or you*example.com'
@@ -73,18 +72,18 @@ const ToKeybaseUser = (props: ToKeybaseUserProps) => {
)
}
-type ToStellarPublicKeyProps = {|
- recipientPublicKey: string,
- errorMessage?: string,
- onChangeRecipient: string => void,
- onScanQRCode: ?() => void,
- setReadyToReview: boolean => void,
- keyCounter: number,
-|}
+export type ToStellarPublicKeyProps = {
+ recipientPublicKey: string
+ errorMessage?: string
+ onChangeRecipient: (recipient: string) => void
+ onScanQRCode: (() => void) | null
+ setReadyToReview: (ready: boolean) => void
+ keyCounter: number
+}
-type ToStellarPublicKeyState = {|
- recipientPublicKey: string,
-|}
+type ToStellarPublicKeyState = {
+ recipientPublicKey: string
+}
class ToStellarPublicKey extends React.Component {
state = {recipientPublicKey: this.props.recipientPublicKey}
@@ -161,21 +160,20 @@ class ToStellarPublicKey extends React.Component void,
- onLinkAccount: () => void,
- onCreateNewAccount: () => void,
- showSpinner: boolean,
-|}
+export type ToOtherAccountProps = {
+ user: string
+ toAccount?: Account
+ allAccounts: Account[]
+ onChangeRecipient: (recipient: string) => void
+ onLinkAccount: () => void
+ onCreateNewAccount: () => void
+ showSpinner: boolean
+}
class ToOtherAccount extends React.Component {
- onAccountDropdownChange = (node: React.Node) => {
+ onAccountDropdownChange = (node: React.ReactNode) => {
if (React.isValidElement(node)) {
- // $FlowIssue React.isValidElement refinement doesn't happen, see https://github.com/facebook/flow/issues/6392
- const element = (node: React.Element)
+ const element: React.ReactElement = node
if (element.key === 'create-new') {
this.props.onCreateNewAccount()
} else if (element.key === 'link-existing') {
@@ -337,6 +335,4 @@ const styles = Styles.styleSheetCreate({
},
})
-export type {ToKeybaseUserProps, ToStellarPublicKeyProps}
-
export {ToKeybaseUser, ToStellarPublicKey, ToOtherAccount}
diff --git a/shared/wallets/send-form/root.js b/shared/wallets/send-form/root.tsx
similarity index 94%
rename from shared/wallets/send-form/root.js
rename to shared/wallets/send-form/root.tsx
index 0bad1b453dd7..a1d5da563d45 100644
--- a/shared/wallets/send-form/root.js
+++ b/shared/wallets/send-form/root.tsx
@@ -1,14 +1,13 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import Header from './header'
-type Props = {|
- onClose: () => void,
- children: React.Node,
- isRequest: boolean,
-|}
+type Props = {
+ onClose: () => void
+ children: React.ReactNode
+ isRequest: boolean
+}
const PoweredByStellar = () => (
diff --git a/shared/wallets/transaction-details/container.js b/shared/wallets/transaction-details/container.tsx
similarity index 96%
rename from shared/wallets/transaction-details/container.js
rename to shared/wallets/transaction-details/container.tsx
index e4bc4d248aeb..6d9cfa693518 100644
--- a/shared/wallets/transaction-details/container.js
+++ b/shared/wallets/transaction-details/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../util/container'
import * as Kb from '../../common-adapters'
import * as Constants from '../../constants/wallets'
@@ -12,7 +11,13 @@ import openURL from '../../util/open-url'
import TransactionDetails from '.'
import {anyWaiting} from '../../constants/waiting'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID, paymentID: Types.PaymentID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ paymentID: Types.PaymentID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const you = state.config.username || ''
@@ -104,7 +109,7 @@ const mergeProps = (stateProps, dispatchProps) => {
}
export default Container.compose(
- Container.connect(
+ Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/transaction-details/index.stories.js b/shared/wallets/transaction-details/index.stories.tsx
similarity index 99%
rename from shared/wallets/transaction-details/index.stories.js
rename to shared/wallets/transaction-details/index.stories.tsx
index 3685d3189954..898b54dcaaa3 100644
--- a/shared/wallets/transaction-details/index.stories.js
+++ b/shared/wallets/transaction-details/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import {stringToAccountID} from '../../constants/types/wallets'
@@ -25,7 +24,7 @@ const props = {
counterpartyType: 'keybaseUser',
issuerAccountID: null,
issuerDescription: '',
- loading: false,
+ loading: false as false,
memo,
onBack: Sb.action('onBack'),
onCancelPayment: null,
diff --git a/shared/wallets/transaction-details/index.js b/shared/wallets/transaction-details/index.tsx
similarity index 87%
rename from shared/wallets/transaction-details/index.js
rename to shared/wallets/transaction-details/index.tsx
index d26841c90e03..74c2b089fb0e 100644
--- a/shared/wallets/transaction-details/index.js
+++ b/shared/wallets/transaction-details/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Types from '../../constants/types/wallets'
import * as Flow from '../../util/flow'
@@ -9,54 +8,59 @@ import Transaction, {TimestampError, TimestampPending} from '../transaction'
import {SmallAccountID} from '../common'
import {formatTimeForStellarDetail, formatTimeForStellarTooltip} from '../../util/timestamp'
-export type NotLoadingProps = {|
- amountUser: string,
- amountXLM: string,
- approxWorth: string,
- counterparty: string,
+export type NotLoadingProps = {
+ amountUser: string
+ amountXLM: string
+ approxWorth: string
+ counterparty: string
// counterpartyMeta is used only when counterpartyType === 'keybaseUser'.
- counterpartyMeta: ?string,
- counterpartyType: Types.CounterpartyType,
- loading: false,
+ counterpartyMeta: string | null
+ counterpartyType: Types.CounterpartyType
+ loading: false
// Ignored if yourRole is receiver and counterpartyType is
// stellarPublicKey.
- memo: string,
- onBack: () => void,
- onCancelPayment: ?() => void,
- onCancelPaymentWaitingKey: string,
- title: string,
+ memo: string
+ onBack: () => void
+ onCancelPayment: (() => void) | null
+ onCancelPaymentWaitingKey: string
+ title: string
// onChat is used only when counterpartyType === 'keybaseUser'.
- onChat: string => void,
- onLoadPaymentDetail: () => void,
- onShowProfile: string => void,
- onViewTransaction?: () => void,
- publicMemo?: string,
- recipientAccountID: ?Types.AccountID,
- selectableText: boolean,
- senderAccountID: Types.AccountID,
- sourceAmount: string,
- sourceAsset: string,
- status: Types.StatusSimplified,
- statusDetail: string,
+ onChat: (username: string) => void
+ onLoadPaymentDetail: () => void
+ onShowProfile: (username: string) => void
+ onViewTransaction?: () => void
+ publicMemo?: string
+ recipientAccountID: Types.AccountID | null
+ selectableText: boolean
+ senderAccountID: Types.AccountID
+ sourceAmount: string
+ sourceAsset: string
+ status: Types.StatusSimplified
+ statusDetail: string
// A null timestamp means the transaction is still pending.
- timestamp: Date | null,
- transactionID?: string,
- you: string,
- yourRole: Types.Role,
+ timestamp: Date | null
+ transactionID?: string
+ you: string
+ yourRole: Types.Role
// sending wallet to wallet we show the actual wallet and not your username
- yourAccountName: string,
+ yourAccountName: string
// issuer, for non-xlm assets
- issuerDescription: string,
- issuerAccountID: ?Types.AccountID,
-|}
+ issuerDescription: string
+ issuerAccountID: Types.AccountID | null
+}
export type Props =
| NotLoadingProps
- | {|loading: true, onBack: () => void, onLoadPaymentDetail: () => void, title: string|}
+ | {
+ loading: true
+ onBack: () => void
+ onLoadPaymentDetail: () => void
+ title: string
+ }
-type PartyAccountProps = {|
- accountID: ?Types.AccountID,
- accountName: string,
-|}
+type PartyAccountProps = {
+ accountID: Types.AccountID | null
+ accountName: string
+}
const PartyAccount = (props: PartyAccountProps) => {
return (
@@ -70,17 +74,17 @@ const PartyAccount = (props: PartyAccountProps) => {
)
}
-type CounterpartyProps = {|
- accountID: ?Types.AccountID,
- counterparty: string,
+type CounterpartyProps = {
+ accountID: Types.AccountID | null
+ counterparty: string
// counterpartyMeta is used only when counterpartyType === 'keybaseUser'.
- counterpartyMeta: ?string,
- counterpartyType: Types.CounterpartyType,
+ counterpartyMeta: string | null
+ counterpartyType: Types.CounterpartyType
// onChat and onShowProfile are used only when counterpartyType ===
// 'keybaseUser'.
- onChat: string => void,
- onShowProfile: string => void,
-|}
+ onChat: (username: string) => void
+ onShowProfile: (username: string) => void
+}
const Counterparty = (props: CounterpartyProps) => {
switch (props.counterpartyType) {
@@ -123,10 +127,8 @@ const Counterparty = (props: CounterpartyProps) => {
case 'otherAccount':
return
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.counterpartyType)
- break
+ throw new Error(`unknown counterpartyType: ${props}`)
}
- return null
}
const AccountMeta = ({counterpartyMeta, accountID}) => (
@@ -142,12 +144,12 @@ const AccountMeta = ({counterpartyMeta, accountID}) => (
)
-type YourAccountProps = {|
- accountID: ?Types.AccountID,
- accountName: ?string,
- you: string,
- onShowProfile: string => void,
-|}
+type YourAccountProps = {
+ accountID: Types.AccountID | null
+ accountName: string | null
+ you: string
+ onShowProfile: (username: string) => void
+}
const YourAccount = (props: YourAccountProps) => {
if (props.accountName) {
@@ -195,7 +197,6 @@ const descriptionForStatus = (status: Types.StatusSimplified, yourRole: Types.Ro
case 'senderAndReceiver':
return 'Sent'
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(yourRole)
throw new Error(`Unexpected role ${yourRole}`)
}
case 'error':
@@ -245,16 +246,15 @@ const propsToParties = (props: NotLoadingProps) => {
// account details as the recipient.
return {receiver: counterparty, sender: you}
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.yourRole)
throw new Error(`Unexpected role ${props.yourRole}`)
}
}
-type TimestampLineProps = {|
- error: string,
- timestamp: ?Date,
- selectableText: boolean,
-|}
+type TimestampLineProps = {
+ error: string
+ timestamp: Date | null
+ selectableText: boolean
+}
export const TimestampLine = (props: TimestampLineProps) => {
if (props.error) {
@@ -421,6 +421,10 @@ const TransactionDetails = (props: NotLoadingProps) => {
)
}
+function isNotLoadingProps(props: Props): props is NotLoadingProps {
+ return !props.loading
+}
+
class LoadTransactionDetails extends React.Component {
componentDidMount() {
this.props.onLoadPaymentDetail()
@@ -428,10 +432,15 @@ class LoadTransactionDetails extends React.Component {
componentDidUpdate(prevProps: Props) {
// An erased transaction ID likely means the payment was updated,
// which means details need to be retrieved again
+ if (!isNotLoadingProps(this.props) || !isNotLoadingProps(prevProps)) {
+ return
+ }
+ const props = this.props
+ const prev = prevProps
if (
- (!this.props.transactionID || !this.props.senderAccountID) &&
- prevProps.transactionID &&
- prevProps.senderAccountID &&
+ (!props.transactionID || !props.senderAccountID) &&
+ prev.transactionID &&
+ prev.senderAccountID &&
!this.props.loading
) {
this.props.onLoadPaymentDetail()
@@ -445,7 +454,7 @@ class LoadTransactionDetails extends React.Component {
)
}
- const props: NotLoadingProps = this.props
+ const props = this.props as NotLoadingProps
return
}
}
diff --git a/shared/wallets/transaction/container.js b/shared/wallets/transaction/container.tsx
similarity index 95%
rename from shared/wallets/transaction/container.js
rename to shared/wallets/transaction/container.tsx
index 4839355bcd74..6735db57dfd1 100644
--- a/shared/wallets/transaction/container.js
+++ b/shared/wallets/transaction/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import {connect} from '../../util/container'
import * as Constants from '../../constants/wallets'
import * as Types from '../../constants/types/wallets'
@@ -8,8 +7,8 @@ import Transaction from '.'
import * as RouteTreeGen from '../../actions/route-tree-gen'
export type OwnProps = {
- accountID: Types.AccountID,
- paymentID: Types.PaymentID,
+ accountID: Types.AccountID
+ paymentID: Types.PaymentID
}
const mapStateToProps = (state, ownProps: OwnProps) => ({
@@ -75,7 +74,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
}
}
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/transaction/index.stories.js b/shared/wallets/transaction/index.stories.tsx
similarity index 99%
rename from shared/wallets/transaction/index.stories.js
rename to shared/wallets/transaction/index.stories.tsx
index b0d01cd823a3..74597140b549 100644
--- a/shared/wallets/transaction/index.stories.js
+++ b/shared/wallets/transaction/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import moment from 'moment'
diff --git a/shared/wallets/transaction/index.js b/shared/wallets/transaction/index.tsx
similarity index 84%
rename from shared/wallets/transaction/index.js
rename to shared/wallets/transaction/index.tsx
index a7a26cf90279..af743d63ad33 100644
--- a/shared/wallets/transaction/index.js
+++ b/shared/wallets/transaction/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Flow from '../../util/flow'
import * as Types from '../../constants/types/wallets'
@@ -16,13 +15,13 @@ import {collapseStyles, globalColors, globalMargins, styleSheetCreate} from '../
import {formatTimeForMessages, formatTimeForStellarTooltip} from '../../util/timestamp'
import {MarkdownMemo} from '../common'
-type CounterpartyIconProps = {|
- detailView?: boolean,
- large: boolean,
- onShowProfile: string => void,
- counterparty: string,
- counterpartyType: Types.CounterpartyType,
-|}
+type CounterpartyIconProps = {
+ detailView?: boolean
+ large: boolean
+ onShowProfile: (username: string) => void
+ counterparty: string
+ counterpartyType: Types.CounterpartyType
+}
const CounterpartyIcon = (props: CounterpartyIconProps) => {
const size = props.large ? 48 : 32
@@ -53,19 +52,18 @@ const CounterpartyIcon = (props: CounterpartyIconProps) => {
)
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.counterpartyType)
- return null
+ throw new Error(`Unexpected counterpartyType ${props.counterpartyType}`)
}
}
-type CounterpartyTextProps = {|
- counterparty: string,
- counterpartyType: Types.CounterpartyType,
- onShowProfile: string => void,
- textType: 'Body' | 'BodySmall',
- textTypeSemibold: 'BodySemibold' | 'BodySmallSemibold',
- textTypeItalic: 'BodyItalic' | 'BodySmallItalic',
-|}
+type CounterpartyTextProps = {
+ counterparty: string
+ counterpartyType: Types.CounterpartyType
+ onShowProfile: (username: string) => void
+ textType: 'Body' | 'BodySmall'
+ textTypeSemibold: 'BodySemibold' | 'BodySmallSemibold'
+ textTypeItalic: 'BodyItalic' | 'BodySmallItalic'
+}
export const CounterpartyText = (props: CounterpartyTextProps) => {
switch (props.counterpartyType) {
@@ -91,30 +89,28 @@ export const CounterpartyText = (props: CounterpartyTextProps) => {
case 'otherAccount':
return {props.counterparty}
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.counterpartyType)
- break
+ throw new Error(`Unexpected counterpartyType ${props.counterpartyType}`)
}
- return null
}
-type DetailProps = {|
- approxWorth: string,
- detailView: boolean,
- large: boolean,
- pending: boolean,
- yourRole: Types.Role,
- canceled: boolean,
- counterparty: string,
- counterpartyType: Types.CounterpartyType,
- amountUser: string,
- isXLM: boolean,
- onShowProfile: string => void,
- selectableText: boolean,
- sourceAmount: string,
- sourceAsset: string,
- status: string,
- issuerDescription: string,
-|}
+type DetailProps = {
+ approxWorth: string
+ detailView: boolean
+ large: boolean
+ pending: boolean
+ yourRole: Types.Role
+ canceled: boolean
+ counterparty: string
+ counterpartyType: Types.CounterpartyType
+ amountUser: string
+ isXLM: boolean
+ onShowProfile: (username: string) => void
+ selectableText: boolean
+ sourceAmount: string
+ sourceAsset: string
+ status: string
+ issuerDescription: string
+}
const Detail = (props: DetailProps) => {
const textType = props.large ? 'Body' : 'BodySmall'
@@ -243,18 +239,17 @@ const Detail = (props: DetailProps) => {
)
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.yourRole)
throw new Error(`Unexpected role ${props.yourRole}`)
}
}
-type AmountXLMProps = {|
- yourRole: Types.Role,
- amountXLM: string,
- canceled: boolean,
- pending: boolean,
- selectableText: boolean,
-|}
+type AmountXLMProps = {
+ yourRole: Types.Role
+ amountXLM: string
+ canceled: boolean
+ pending: boolean
+ selectableText: boolean
+}
const roleToColor = (role: Types.Role): string => {
switch (role) {
@@ -265,7 +260,6 @@ const roleToColor = (role: Types.Role): string => {
case 'senderAndReceiver':
return globalColors.black
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(role)
throw new Error(`Unexpected role ${role}`)
}
}
@@ -279,7 +273,6 @@ const getAmount = (role: Types.Role, amountXLM: string): string => {
case 'senderAndReceiver':
return '0 XLM'
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(role)
throw new Error(`Unexpected role ${role}`)
}
}
@@ -302,10 +295,10 @@ const AmountXLM = (props: AmountXLMProps) => {
)
}
-type TimestampErrorProps = {|
- error: string,
- status?: Types.StatusSimplified,
-|}
+type TimestampErrorProps = {
+ error: string
+ status?: Types.StatusSimplified
+}
export const TimestampError = (props: TimestampErrorProps) => (
@@ -318,13 +311,13 @@ export const TimestampPending = () => (
The Stellar network hasn't confirmed your transaction.
)
-type TimestampLineProps = {|
- detailView: ?boolean,
- error: string,
- status: Types.StatusSimplified,
- timestamp: ?Date,
- selectableText: boolean,
-|}
+type TimestampLineProps = {
+ detailView: boolean | null
+ error: string
+ status: Types.StatusSimplified
+ timestamp: Date | null
+ selectableText: boolean
+}
const TimestampLine = (props: TimestampLineProps) => {
const timestamp = props.timestamp
@@ -371,33 +364,33 @@ const TimestampLine = (props: TimestampLineProps) => {
type ReadState = 'read' | 'unread' | 'oldestUnread'
-export type Props = {|
- amountUser: string, // empty if sent with no display currency
- amountXLM: string,
- approxWorth: string,
- counterparty: string,
- counterpartyType: Types.CounterpartyType,
- detailView?: boolean,
+export type Props = {
+ amountUser: string // empty if sent with no display currency
+ amountXLM: string
+ approxWorth: string
+ counterparty: string
+ counterpartyType: Types.CounterpartyType
+ detailView?: boolean
// Ignored if counterpartyType is stellarPublicKey and yourRole is
// receiverOnly.
- memo: string,
- onCancelPayment: ?() => void,
- onCancelPaymentWaitingKey: string,
+ memo: string
+ onCancelPayment: (() => void) | null
+ onCancelPaymentWaitingKey: string
// onShowProfile is used only when counterpartyType === 'keybaseUser'.
- onSelectTransaction?: ?() => void,
- onShowProfile: string => void,
- readState: ReadState,
- selectableText: boolean,
- sourceAmount: string,
- sourceAsset: string,
- status: Types.StatusSimplified,
- statusDetail: string,
+ onSelectTransaction?: (() => void) | null
+ onShowProfile: (username: string) => void
+ readState: ReadState
+ selectableText: boolean
+ sourceAmount: string
+ sourceAsset: string
+ status: Types.StatusSimplified
+ statusDetail: string
// A null timestamp means the transaction is still pending.
- timestamp: Date | null,
- unread: boolean,
- yourRole: Types.Role,
- issuerDescription: string,
-|}
+ timestamp: Date | null
+ unread: boolean
+ yourRole: Types.Role
+ issuerDescription: string
+}
export const Transaction = (props: Props) => {
let large: boolean
@@ -416,7 +409,6 @@ export const Transaction = (props: Props) => {
showMemo = !!props.memo
break
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(props.counterpartyType)
throw new Error(`Unexpected counterpartyType ${props.counterpartyType}`)
}
const pending = !props.timestamp || ['pending', 'claimable'].includes(props.status)
diff --git a/shared/wallets/wallet-list/container.js b/shared/wallets/wallet-list/container.tsx
similarity index 91%
rename from shared/wallets/wallet-list/container.js
rename to shared/wallets/wallet-list/container.tsx
index 6e6278680711..5f2a16c0a0c3 100644
--- a/shared/wallets/wallet-list/container.js
+++ b/shared/wallets/wallet-list/container.tsx
@@ -1,5 +1,4 @@
-// @flow
-import {WalletList, type Props} from '.'
+import {WalletList, Props} from '.'
import * as Constants from '../../constants/wallets'
import * as RouteTreeGen from '../../actions/route-tree-gen'
import * as Styles from '../../styles'
@@ -7,7 +6,9 @@ import openURL from '../../util/open-url'
import {connect} from '../../util/container'
import {anyWaiting} from '../../constants/waiting'
-type OwnProps = {style: Styles.StylesCrossPlatform}
+type OwnProps = {
+ style: Styles.StylesCrossPlatform
+}
const mapStateToProps = state => {
return {
@@ -50,7 +51,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps): Props => ({
title: 'Wallets',
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet-list/index.stories.js b/shared/wallets/wallet-list/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet-list/index.stories.js
rename to shared/wallets/wallet-list/index.stories.tsx
index 57d21da06b98..f2ed3847e89c 100644
--- a/shared/wallets/wallet-list/index.stories.js
+++ b/shared/wallets/wallet-list/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import {WalletList} from '.'
diff --git a/shared/wallets/wallet-list/index.js b/shared/wallets/wallet-list/index.tsx
similarity index 85%
rename from shared/wallets/wallet-list/index.js
rename to shared/wallets/wallet-list/index.tsx
index b542edea7023..a35927143677 100644
--- a/shared/wallets/wallet-list/index.js
+++ b/shared/wallets/wallet-list/index.tsx
@@ -1,15 +1,14 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import * as Flow from '../../util/flow'
-import {type AccountID} from '../../constants/types/wallets'
+import {AccountID} from '../../constants/types/wallets'
import WalletRow from './wallet-row/container'
import flags from '../../util/feature-flags'
type AddProps = {
- onAddNew: () => void,
- onLinkExisting: () => void,
+ onAddNew: () => void
+ onLinkExisting: () => void
}
const rowHeight = 48
@@ -81,23 +80,33 @@ const WhatIsStellar = (props: {onWhatIsStellar: () => void}) => (
)
-type Props = {|
- accountIDs: Array,
- airdropSelected: boolean,
- style?: Styles.StylesCrossPlatform,
- loading: boolean,
- inAirdrop: boolean,
- onAddNew: () => void,
- onJoinAirdrop: () => void,
- onLinkExisting: () => void,
- onWhatIsStellar: () => void,
- title: string,
-|}
-
-type Row = {type: 'wallet', accountID: AccountID} | {type: 'add wallet'} | {type: 'join airdrop'}
+export type Props = {
+ accountIDs: Array
+ airdropSelected: boolean
+ style?: Styles.StylesCrossPlatform
+ loading: boolean
+ inAirdrop: boolean
+ onAddNew: () => void
+ onJoinAirdrop: () => void
+ onLinkExisting: () => void
+ onWhatIsStellar: () => void
+ title: string
+}
+
+type Row =
+ | {
+ type: 'wallet'
+ accountID: AccountID
+ }
+ | {
+ type: 'add wallet'
+ }
+ | {
+ type: 'join airdrop'
+ }
class WalletList extends React.Component {
- _renderRow = (i: number, row: Row): React.Node => {
+ _renderRow = (i: number, row: Row): React.ReactNode => {
switch (row.type) {
case 'wallet':
return
@@ -119,8 +128,7 @@ class WalletList extends React.Component {
/>
)
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(row.type)
- throw new Error(`Impossible case encountered: ${row.type}`)
+ throw new Error(`Impossible case encountered: ${row}`)
}
}
@@ -137,7 +145,7 @@ class WalletList extends React.Component {
if (flags.airdrop) {
const joinAirdrop = 'join airdrop'
- rows.push({key: joinAirdrop, type: joinAirdrop})
+ rows.push({accountID: null, key: joinAirdrop, type: joinAirdrop})
}
return (
@@ -188,5 +196,4 @@ const styles = Styles.styleSheetCreate({
},
})
-export type {Props}
export {WalletList}
diff --git a/shared/wallets/wallet-list/wallet-row/container.js b/shared/wallets/wallet-list/wallet-row/container.tsx
similarity index 88%
rename from shared/wallets/wallet-list/wallet-row/container.js
rename to shared/wallets/wallet-list/wallet-row/container.tsx
index 027708afeed1..fdaf7837f2bf 100644
--- a/shared/wallets/wallet-list/wallet-row/container.js
+++ b/shared/wallets/wallet-list/wallet-row/container.tsx
@@ -1,16 +1,22 @@
-// @flow
-import {WalletRow, type Props} from '.'
+import {WalletRow, Props} from '.'
import {connect, isMobile} from '../../../util/container'
import {getAccount, getSelectedAccount} from '../../../constants/wallets'
import * as WalletsGen from '../../../actions/wallets-gen'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
-import {type AccountID} from '../../../constants/types/wallets'
+import {AccountID} from '../../../constants/types/wallets'
// TODO: This is now desktop-only, so remove references to isMobile.
-type OwnProps = {accountID: AccountID}
+type OwnProps = {
+ accountID: AccountID
+}
-const mapStateToProps = (state, ownProps: {accountID: AccountID}) => {
+const mapStateToProps = (
+ state,
+ ownProps: {
+ accountID: AccountID
+ }
+) => {
const account = getAccount(state, ownProps.accountID)
const name = account.name
const me = state.config.username || ''
@@ -52,7 +58,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps): Props => ({
unreadPayments: stateProps.unreadPayments,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet-list/wallet-row/index.stories.js b/shared/wallets/wallet-list/wallet-row/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet-list/wallet-row/index.stories.js
rename to shared/wallets/wallet-list/wallet-row/index.stories.tsx
index 555ab5d9b613..d57148bf0643 100644
--- a/shared/wallets/wallet-list/wallet-row/index.stories.js
+++ b/shared/wallets/wallet-list/wallet-row/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import {Box2} from '../../../common-adapters'
diff --git a/shared/wallets/wallet-list/wallet-row/index.js b/shared/wallets/wallet-list/wallet-row/index.tsx
similarity index 94%
rename from shared/wallets/wallet-list/wallet-row/index.js
rename to shared/wallets/wallet-list/wallet-row/index.tsx
index f5326e183bc2..f729bb13a52c 100644
--- a/shared/wallets/wallet-list/wallet-row/index.js
+++ b/shared/wallets/wallet-list/wallet-row/index.tsx
@@ -1,18 +1,17 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Styles from '../../../styles'
// TODO: This is now desktop-only, so remove references to isMobile.
-type Props = {|
- contents: string,
- isSelected: boolean,
- keybaseUser: string,
- name: string,
- onSelect: () => void,
- unreadPayments: number,
-|}
+export type Props = {
+ contents: string
+ isSelected: boolean
+ keybaseUser: string
+ name: string
+ onSelect: () => void
+ unreadPayments: number
+}
const rightColumnStyle = Styles.platformStyles({
isElectron: {
@@ -126,5 +125,5 @@ const UnreadIcon = (props: {unreadPayments: number}) => (
)}
)
-export type {Props}
+
export {WalletRow}
diff --git a/shared/wallets/wallet/container.js b/shared/wallets/wallet/container.tsx
similarity index 93%
rename from shared/wallets/wallet/container.js
rename to shared/wallets/wallet/container.tsx
index 24bee4fa8a0e..9afe8b09a853 100644
--- a/shared/wallets/wallet/container.js
+++ b/shared/wallets/wallet/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import {connect, isMobile} from '../../util/container'
import * as WalletsGen from '../../actions/wallets-gen'
@@ -8,9 +7,9 @@ import * as Types from '../../constants/types/wallets'
import Onboarding from '../onboarding/container'
import {partition} from 'lodash-es'
-import Wallet, {type Props} from '.'
+import Wallet, {Props} from '.'
-type OwnProps = {||}
+type OwnProps = {}
const mapStateToProps = state => {
const accountID = Constants.getSelectedAccount(state)
@@ -83,7 +82,12 @@ const mergeProps = (stateProps, dispatchProps) => {
}
}
-const sortAndStripTimestamps = (p: Array<{paymentID: Types.PaymentID, timestamp: ?number}>) =>
+const sortAndStripTimestamps = (
+ p: Array<{
+ paymentID: Types.PaymentID
+ timestamp: number | null
+ }>
+) =>
p
.sort((p1, p2) => (p1.timestamp && p2.timestamp && p2.timestamp - p1.timestamp) || 0)
.map(({paymentID}) => ({paymentID}))
@@ -93,7 +97,7 @@ const sortAndStripTimestamps = (p: Array<{paymentID: Types.PaymentID, timestamp:
const WalletOrOnboarding = (props: Props) =>
!isMobile || props.acceptedDisclaimer ? :
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet/header/container.js b/shared/wallets/wallet/header/container.tsx
similarity index 94%
rename from shared/wallets/wallet/header/container.js
rename to shared/wallets/wallet/header/container.tsx
index 6c4ce4088256..28708d25b14b 100644
--- a/shared/wallets/wallet/header/container.js
+++ b/shared/wallets/wallet/header/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import {connect, isMobile} from '../../../util/container'
import {memoize} from '../../../util/memoize'
import * as RouteTreeGen from '../../../actions/route-tree-gen'
@@ -8,7 +7,9 @@ import Header from '.'
const otherUnreadPayments = memoize((map, accID) => !!map.delete(accID).some(Boolean))
-type OwnProps = {onBack: () => void}
+type OwnProps = {
+ onBack: () => void
+}
const mapStateToProps = state => {
const accountID = Constants.getSelectedAccount(state)
@@ -43,7 +44,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
onReceive: () => dispatchProps._onReceive(stateProps.accountID),
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet/header/index.stories.js b/shared/wallets/wallet/header/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet/header/index.stories.js
rename to shared/wallets/wallet/header/index.stories.tsx
index f70a7448e8d0..7c135d8f1a72 100644
--- a/shared/wallets/wallet/header/index.stories.js
+++ b/shared/wallets/wallet/header/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import * as Types from '../../../constants/types/wallets'
diff --git a/shared/wallets/wallet/header/index.js b/shared/wallets/wallet/header/index.tsx
similarity index 93%
rename from shared/wallets/wallet/header/index.js
rename to shared/wallets/wallet/header/index.tsx
index abd3ec52c545..ec9976156db0 100644
--- a/shared/wallets/wallet/header/index.js
+++ b/shared/wallets/wallet/header/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import * as Types from '../../../constants/types/wallets'
@@ -6,16 +5,16 @@ import * as Styles from '../../../styles'
import {DropdownButton, SendButton, SmallAccountID} from '../../common'
import MaybeSwitcher from './maybe-switcher'
-type Props = {|
- accountID: Types.AccountID,
- isDefaultWallet: boolean,
- keybaseUser: string,
- onBack: ?() => void,
- onReceive: () => void,
- thisDeviceIsLockedOut: boolean,
- unreadPayments: boolean,
- walletName: ?string,
-|}
+type Props = {
+ accountID: Types.AccountID
+ isDefaultWallet: boolean
+ keybaseUser: string
+ onBack: (() => void) | null
+ onReceive: () => void
+ thisDeviceIsLockedOut: boolean
+ unreadPayments: boolean
+ walletName: string | null
+}
const Header = (props: Props) => {
const backButton = props.onBack &&
diff --git a/shared/wallets/wallet/header/maybe-switcher.js b/shared/wallets/wallet/header/maybe-switcher.tsx
similarity index 93%
rename from shared/wallets/wallet/header/maybe-switcher.js
rename to shared/wallets/wallet/header/maybe-switcher.tsx
index 58b88bd06969..706f027ed407 100644
--- a/shared/wallets/wallet/header/maybe-switcher.js
+++ b/shared/wallets/wallet/header/maybe-switcher.tsx
@@ -1,12 +1,11 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../common-adapters'
import {isMobile} from '../../../util/container'
import WalletSwitcher from './wallet-switcher/container'
-type Props = {|
- children: React.Node,
-|}
+type Props = {
+ children: React.ReactNode
+}
const NoSwitcher = (props: Props) => props.children
diff --git a/shared/wallets/wallet/header/wallet-switcher/container.js b/shared/wallets/wallet/header/wallet-switcher/container.tsx
similarity index 88%
rename from shared/wallets/wallet/header/wallet-switcher/container.js
rename to shared/wallets/wallet/header/wallet-switcher/container.tsx
index df507750d133..a7d1ee2451d9 100644
--- a/shared/wallets/wallet/header/wallet-switcher/container.js
+++ b/shared/wallets/wallet/header/wallet-switcher/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as RouteTreeGen from '../../../../actions/route-tree-gen'
import {connect, isMobile} from '../../../../util/container'
@@ -6,11 +5,11 @@ import {getAccountIDs} from '../../../../constants/wallets'
import openURL from '../../../../util/open-url'
import {WalletSwitcher} from '.'
-type OwnProps = {|
- getAttachmentRef: () => ?React.Component,
- showingMenu: boolean,
- hideMenu: () => void,
-|}
+type OwnProps = {
+ getAttachmentRef: () => React.Component | null
+ showingMenu: boolean
+ hideMenu: () => void
+}
const mapStateToProps = state => ({
accounts: getAccountIDs(state),
@@ -44,7 +43,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
...ownProps,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet/header/wallet-switcher/index.d.ts b/shared/wallets/wallet/header/wallet-switcher/index.d.ts
new file mode 100644
index 000000000000..d68c1350d6d1
--- /dev/null
+++ b/shared/wallets/wallet/header/wallet-switcher/index.d.ts
@@ -0,0 +1,15 @@
+import * as React from 'react'
+import * as Types from '../../../../constants/types/wallets'
+
+export type Props = {
+ accountIDs: Array
+ getAttachmentRef: (() => React.Component) | null
+ hideMenu: () => void
+ onAddNew: () => void
+ onJoinAirdrop: () => void
+ onLinkExisting: () => void
+ onWhatIsStellar: () => void
+ showingMenu: boolean
+}
+
+export declare class WalletSwitcher extends React.Component {}
diff --git a/shared/wallets/wallet/header/wallet-switcher/index.desktop.js b/shared/wallets/wallet/header/wallet-switcher/index.desktop.tsx
similarity index 58%
rename from shared/wallets/wallet/header/wallet-switcher/index.desktop.js
rename to shared/wallets/wallet/header/wallet-switcher/index.desktop.tsx
index 1f071532279f..112a47b3cc31 100644
--- a/shared/wallets/wallet/header/wallet-switcher/index.desktop.js
+++ b/shared/wallets/wallet/header/wallet-switcher/index.desktop.tsx
@@ -1,4 +1,3 @@
-// @flow
-import {type Props} from '.'
+import {Props} from '.'
export const WalletSwitcher = (props: Props) => null
diff --git a/shared/wallets/wallet/header/wallet-switcher/index.js.flow b/shared/wallets/wallet/header/wallet-switcher/index.js.flow
deleted file mode 100644
index bf43165fce25..000000000000
--- a/shared/wallets/wallet/header/wallet-switcher/index.js.flow
+++ /dev/null
@@ -1,16 +0,0 @@
-// @flow
-import * as React from 'react'
-import * as Types from '../../../../constants/types/wallets'
-
-export type Props = {|
- accountIDs: Array,
- getAttachmentRef: () => ?React.Component,
- hideMenu: () => void,
- onAddNew: () => void,
- onJoinAirdrop: () => void,
- onLinkExisting: () => void,
- onWhatIsStellar: () => void,
- showingMenu: boolean,
-|}
-
-declare export class WalletSwitcher extends React.Component {}
diff --git a/shared/wallets/wallet/header/wallet-switcher/index.native.js b/shared/wallets/wallet/header/wallet-switcher/index.native.tsx
similarity index 89%
rename from shared/wallets/wallet/header/wallet-switcher/index.native.js
rename to shared/wallets/wallet/header/wallet-switcher/index.native.tsx
index 3590c5386635..ad6c566c94b2 100644
--- a/shared/wallets/wallet/header/wallet-switcher/index.native.js
+++ b/shared/wallets/wallet/header/wallet-switcher/index.native.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import WalletRow from './wallet-row/container'
import * as Types from '../../../../constants/types/wallets'
@@ -7,15 +6,15 @@ import * as Flow from '../../../../util/flow'
import * as Styles from '../../../../styles'
import flags from '../../../../util/feature-flags'
import {TouchableOpacity} from 'react-native'
-import {type Props} from '.'
+import {Props} from '.'
-type RowProps = {|
- children: React.Node,
- isLast?: boolean,
- onPress?: () => void,
- containerStyle?: Styles.StylesCrossPlatform,
- style?: Styles.StylesCrossPlatform,
-|}
+type RowProps = {
+ children: React.ReactNode
+ isLast?: boolean
+ onPress?: () => void
+ containerStyle?: Styles.StylesCrossPlatform
+ style?: Styles.StylesCrossPlatform
+}
const Row = (props: RowProps) => (
@@ -29,23 +28,23 @@ const Row = (props: RowProps) => (
)
type MenuItem =
- | {|
- key: string,
- onPress: () => void,
- title: string,
- type: 'item',
- |}
- | {|
- key: Types.AccountID,
- accountID: Types.AccountID,
- type: 'wallet',
- |}
- | {|
- key: string,
- onPress: () => void,
- title: string,
- type: 'airdrop',
- |}
+ | {
+ key: string
+ onPress: () => void
+ title: string
+ type: 'item'
+ }
+ | {
+ key: Types.AccountID
+ accountID: Types.AccountID
+ type: 'wallet'
+ }
+ | {
+ key: string
+ onPress: () => void
+ title: string
+ type: 'airdrop'
+ }
const renderItem = (item: MenuItem, isLast: boolean, hideMenu: () => void) => {
switch (item.type) {
@@ -86,8 +85,7 @@ const renderItem = (item: MenuItem, isLast: boolean, hideMenu: () => void) => {
)
default:
- Flow.ifFlowComplainsAboutThisFunctionYouHaventHandledAllCasesInASwitch(item.type)
- throw new Error(`Invalid type ${item.type} passed to renderItem`)
+ throw new Error(`Invalid type ${item} passed to renderItem`)
}
}
diff --git a/shared/wallets/wallet/header/wallet-switcher/wallet-row/container.js b/shared/wallets/wallet/header/wallet-switcher/wallet-row/container.tsx
similarity index 84%
rename from shared/wallets/wallet/header/wallet-switcher/wallet-row/container.js
rename to shared/wallets/wallet/header/wallet-switcher/wallet-row/container.tsx
index 663b3567852a..b0886e5a0efc 100644
--- a/shared/wallets/wallet/header/wallet-switcher/wallet-row/container.js
+++ b/shared/wallets/wallet/header/wallet-switcher/wallet-row/container.tsx
@@ -1,16 +1,20 @@
-// @flow
-import {WalletRow, type Props} from '.'
+import {WalletRow, Props} from '.'
import {connect} from '../../../../../util/container'
import {getAccount, getSelectedAccount} from '../../../../../constants/wallets'
import * as WalletsGen from '../../../../../actions/wallets-gen'
-import {type AccountID} from '../../../../../constants/types/wallets'
+import {AccountID} from '../../../../../constants/types/wallets'
type OwnProps = {
- accountID: AccountID,
- hideMenu: () => void,
+ accountID: AccountID
+ hideMenu: () => void
}
-const mapStateToProps = (state, ownProps: {accountID: AccountID}) => {
+const mapStateToProps = (
+ state,
+ ownProps: {
+ accountID: AccountID
+ }
+) => {
const account = getAccount(state, ownProps.accountID)
const name = account.name
const me = state.config.username || ''
@@ -37,16 +41,18 @@ const mergeProps = (stateProps, dispatchProps, ownProps): Props => ({
isSelected: stateProps.isSelected,
keybaseUser: stateProps.keybaseUser,
name: stateProps.name,
+
onSelect: () => {
// First clear any new payments on the currently selected acct.
dispatchProps._onClearNewPayments(stateProps.selectedAccount)
dispatchProps._onSelectAccount(ownProps.accountID)
ownProps.hideMenu()
},
+
unreadPayments: stateProps.unreadPayments,
})
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.js b/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.js
rename to shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.tsx
index e23db3308a0d..79d6e6b5ce52 100644
--- a/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.js
+++ b/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../../../stories/storybook'
import {Box2} from '../../../../../common-adapters'
diff --git a/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.js b/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.tsx
similarity index 92%
rename from shared/wallets/wallet/header/wallet-switcher/wallet-row/index.js
rename to shared/wallets/wallet/header/wallet-switcher/wallet-row/index.tsx
index c6b30a4fdff2..55ba4ce17122 100644
--- a/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.js
+++ b/shared/wallets/wallet/header/wallet-switcher/wallet-row/index.tsx
@@ -1,16 +1,15 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../../../common-adapters'
import * as Styles from '../../../../../styles'
-type Props = {|
- contents: string,
- isSelected: boolean,
- keybaseUser: string,
- name: string,
- onSelect: () => void,
- unreadPayments: number,
-|}
+export type Props = {
+ contents: string
+ isSelected: boolean
+ keybaseUser: string
+ name: string
+ onSelect: () => void
+ unreadPayments: number
+}
const styles = Styles.styleSheetCreate({
amount: {
@@ -82,5 +81,4 @@ const WalletRow = (props: Props) => {
)
}
-export type {Props}
export {WalletRow}
diff --git a/shared/wallets/wallet/index.stories.js b/shared/wallets/wallet/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet/index.stories.js
rename to shared/wallets/wallet/index.stories.tsx
index d29e2faf27fd..36971aa90e40 100644
--- a/shared/wallets/wallet/index.stories.js
+++ b/shared/wallets/wallet/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../stories/storybook'
import {stringToAccountID} from '../../constants/types/wallets'
diff --git a/shared/wallets/wallet/index.js b/shared/wallets/wallet/index.tsx
similarity index 94%
rename from shared/wallets/wallet/index.js
rename to shared/wallets/wallet/index.tsx
index 4d3e29a22ce7..ac903ff84ea9 100644
--- a/shared/wallets/wallet/index.js
+++ b/shared/wallets/wallet/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
@@ -14,13 +13,13 @@ const stripePatternName = Styles.isMobile
const stripePatternSize = Styles.isMobile ? 18 : 9
export type Props = {
- acceptedDisclaimer: boolean,
- accountID: Types.AccountID,
- loadingMore: boolean,
- onBack: () => void,
- onLoadMore: () => void,
- onMarkAsRead: () => void,
- sections: any[],
+ acceptedDisclaimer: boolean
+ accountID: Types.AccountID
+ loadingMore: boolean
+ onBack: () => void
+ onLoadMore: () => void
+ onMarkAsRead: () => void
+ sections: any[]
}
const HistoryPlaceholder = () => (
@@ -115,7 +114,7 @@ class Wallet extends React.Component {
render() {
return (
- {(Styles.isMobile) && }
+ {Styles.isMobile && }
({
})
export default Container.compose(
- Container.namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'Settings'),
+ Container.namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'Settings'),
Container.safeSubmit(['onCurrencyChange'], ['currencyWaiting'])
)(Settings)
diff --git a/shared/wallets/wallet/settings/display-currency-dropdown/index.js.flow b/shared/wallets/wallet/settings/display-currency-dropdown/index.d.ts
similarity index 68%
rename from shared/wallets/wallet/settings/display-currency-dropdown/index.js.flow
rename to shared/wallets/wallet/settings/display-currency-dropdown/index.d.ts
index 95401a0d792a..a0eb20987954 100644
--- a/shared/wallets/wallet/settings/display-currency-dropdown/index.js.flow
+++ b/shared/wallets/wallet/settings/display-currency-dropdown/index.d.ts
@@ -1,5 +1,4 @@
-// @flow
import * as React from 'react'
-import type {Props} from './index.types'
+import {Props} from './index.types'
export default class DisplayCurrencyDropdown extends React.Component {}
diff --git a/shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.js b/shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.tsx
similarity index 93%
rename from shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.js
rename to shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.tsx
index 8ae51511d050..88e05ae989e1 100644
--- a/shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.js
+++ b/shared/wallets/wallet/settings/display-currency-dropdown/index.desktop.tsx
@@ -1,10 +1,9 @@
-// @flow
import * as React from 'react'
import * as I from 'immutable'
import * as Kb from '../../../../common-adapters'
import * as Types from '../../../../constants/types/wallets'
import * as Styles from '../../../../styles'
-import type {Props} from './index.types'
+import {Props} from './index.types'
const headerKey = '_header'
@@ -43,8 +42,8 @@ const DisplayCurrencyDropdown = (props: Props) => {
disabled={props.waiting}
items={makeDropdownItems(props.currencies, props.selected)}
selected={makeDropdownItem(props.selected, false, props.waiting)}
- onChanged={(node: React.Node) => {
- // $ForceType doesn't understand key will be string
+ onChanged={(node: React.ReactNode) => {
+ // @ts-ignore doesn't understand key will be string
const selectedCode: Types.CurrencyCode = node.key
if (selectedCode !== props.selected.code && selectedCode !== headerKey) {
props.onCurrencyChange(selectedCode)
diff --git a/shared/wallets/wallet/settings/display-currency-dropdown/index.native.js b/shared/wallets/wallet/settings/display-currency-dropdown/index.native.tsx
similarity index 95%
rename from shared/wallets/wallet/settings/display-currency-dropdown/index.native.js
rename to shared/wallets/wallet/settings/display-currency-dropdown/index.native.tsx
index 860b18e70002..8a834c23ef7e 100644
--- a/shared/wallets/wallet/settings/display-currency-dropdown/index.native.js
+++ b/shared/wallets/wallet/settings/display-currency-dropdown/index.native.tsx
@@ -1,10 +1,9 @@
-// @flow
import * as React from 'react'
import * as I from 'immutable'
import * as Kb from '../../../../common-adapters'
import * as Types from '../../../../constants/types/wallets'
import * as Styles from '../../../../styles'
-import type {Props} from './index.types'
+import {Props} from './index.types'
const makePickerItems = (currencies: I.List) =>
currencies.map(c => ({label: c.description, value: c.code})).toArray()
@@ -20,7 +19,12 @@ const Prompt = () => (
)
-type State = {selected: Types.CurrencyCode, showingMenu: boolean, showingToast: boolean}
+type State = {
+ selected: Types.CurrencyCode
+ showingMenu: boolean
+ showingToast: boolean
+}
+
class _DisplayCurrencyDropdown extends React.Component, State> {
state = {selected: this.props.selected.code, showingMenu: false, showingToast: false}
_toggleShowingMenu = () =>
diff --git a/shared/wallets/wallet/settings/display-currency-dropdown/index.types.d.ts b/shared/wallets/wallet/settings/display-currency-dropdown/index.types.d.ts
new file mode 100644
index 000000000000..d3a89df160cb
--- /dev/null
+++ b/shared/wallets/wallet/settings/display-currency-dropdown/index.types.d.ts
@@ -0,0 +1,10 @@
+import * as I from 'immutable'
+import * as Types from '../../../../constants/types/wallets'
+
+export type Props = {
+ currencies: I.List
+ onCurrencyChange: (currencyCode: Types.CurrencyCode) => void
+ saveCurrencyWaiting: boolean
+ selected: Types.Currency
+ waiting: boolean
+}
diff --git a/shared/wallets/wallet/settings/display-currency-dropdown/index.types.js.flow b/shared/wallets/wallet/settings/display-currency-dropdown/index.types.js.flow
deleted file mode 100644
index 4a05bc6f1121..000000000000
--- a/shared/wallets/wallet/settings/display-currency-dropdown/index.types.js.flow
+++ /dev/null
@@ -1,11 +0,0 @@
-// @flow
-import * as I from 'immutable'
-import * as Types from '../../../../constants/types/wallets'
-
-export type Props = {|
- currencies: I.List,
- onCurrencyChange: Types.CurrencyCode => void,
- saveCurrencyWaiting: boolean,
- selected: Types.Currency,
- waiting: boolean,
-|}
diff --git a/shared/wallets/wallet/settings/index.stories.js b/shared/wallets/wallet/settings/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet/settings/index.stories.js
rename to shared/wallets/wallet/settings/index.stories.tsx
index b73ad30c78b4..1d6a9b472af7 100644
--- a/shared/wallets/wallet/settings/index.stories.js
+++ b/shared/wallets/wallet/settings/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../stories/storybook'
import Settings from '.'
diff --git a/shared/wallets/wallet/settings/index.js b/shared/wallets/wallet/settings/index.tsx
similarity index 94%
rename from shared/wallets/wallet/settings/index.js
rename to shared/wallets/wallet/settings/index.tsx
index 0979dc04e396..f7bf0dddd2c0 100644
--- a/shared/wallets/wallet/settings/index.js
+++ b/shared/wallets/wallet/settings/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as I from 'immutable'
import * as Kb from '../../../common-adapters'
@@ -7,30 +6,30 @@ import * as Types from '../../../constants/types/wallets'
import {AccountPageHeader} from '../../common'
import DisplayCurrencyDropdown from './display-currency-dropdown'
-export type SettingsProps = {|
- accountID: Types.AccountID,
- name: string,
- user: string,
- inflationDestination: string,
- isDefault: boolean,
- currencyWaiting: boolean,
- currency: Types.Currency,
- currencies: I.List,
- canSubmitTx: boolean,
- onBack: () => void,
- onDelete: () => void,
- onSetDefault: () => void,
- onEditName: () => void,
- onSetupInflation: () => void,
- onCurrencyChange: (currency: Types.CurrencyCode) => void,
- onMobileOnlyModeChange: (enabled: boolean) => void,
- refresh: () => void,
- saveCurrencyWaiting: boolean,
- mobileOnlyMode: boolean,
- mobileOnlyWaiting: boolean,
- mobileOnlyEditable: boolean,
- thisDeviceIsLockedOut: boolean,
-|}
+export type SettingsProps = {
+ accountID: Types.AccountID
+ name: string
+ user: string
+ inflationDestination: string
+ isDefault: boolean
+ currencyWaiting: boolean
+ currency: Types.Currency
+ currencies: I.List
+ canSubmitTx: boolean
+ onBack: () => void
+ onDelete: () => void
+ onSetDefault: () => void
+ onEditName: () => void
+ onSetupInflation: () => void
+ onCurrencyChange: (currency: Types.CurrencyCode) => void
+ onMobileOnlyModeChange: (enabled: boolean) => void
+ refresh: () => void
+ saveCurrencyWaiting: boolean
+ mobileOnlyMode: boolean
+ mobileOnlyWaiting: boolean
+ mobileOnlyEditable: boolean
+ thisDeviceIsLockedOut: boolean
+}
const HoverText = Styles.isMobile
? Kb.Text
diff --git a/shared/wallets/wallet/settings/popups/index.stories.js b/shared/wallets/wallet/settings/popups/index.stories.tsx
similarity index 99%
rename from shared/wallets/wallet/settings/popups/index.stories.js
rename to shared/wallets/wallet/settings/popups/index.stories.tsx
index c290efbeb2c1..f623c55f15f7 100644
--- a/shared/wallets/wallet/settings/popups/index.stories.js
+++ b/shared/wallets/wallet/settings/popups/index.stories.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as React from 'react'
import * as Sb from '../../../../stories/storybook'
import * as Constants from '../../../../constants/wallets'
diff --git a/shared/wallets/wallet/settings/popups/index.js b/shared/wallets/wallet/settings/popups/index.tsx
similarity index 97%
rename from shared/wallets/wallet/settings/popups/index.js
rename to shared/wallets/wallet/settings/popups/index.tsx
index 52c0287a151e..58c6e5bc1d49 100644
--- a/shared/wallets/wallet/settings/popups/index.js
+++ b/shared/wallets/wallet/settings/popups/index.tsx
@@ -1,4 +1,3 @@
-// @flow
export {default as ReallyRemoveAccountPopup} from './really-remove-account/container'
export {default as RenameAccountPopup} from './rename-account/container'
export {default as RemoveAccountPopup} from './remove-account/container'
diff --git a/shared/wallets/wallet/settings/popups/inflation-destination/container.js b/shared/wallets/wallet/settings/popups/inflation-destination/container.tsx
similarity index 92%
rename from shared/wallets/wallet/settings/popups/inflation-destination/container.js
rename to shared/wallets/wallet/settings/popups/inflation-destination/container.tsx
index 47df687bd282..8ae091ba7d9a 100644
--- a/shared/wallets/wallet/settings/popups/inflation-destination/container.js
+++ b/shared/wallets/wallet/settings/popups/inflation-destination/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../../../../util/container'
import * as Constants from '../../../../../constants/wallets'
import * as Types from '../../../../../constants/types/wallets'
@@ -7,7 +6,12 @@ import * as RouteTreeGen from '../../../../../actions/route-tree-gen'
import logger from '../../../../../logger'
import InflationDestination from '.'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const accountID = Container.getRouteProps(ownProps, 'accountID')
@@ -47,7 +51,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
options: stateProps._options.toArray().map(o => o.toObject()),
})
-export default Container.namedConnect(
+export default Container.namedConnect(
mapStateToProps,
mapDispatchToProps,
mergeProps,
diff --git a/shared/wallets/wallet/settings/popups/inflation-destination/index.js b/shared/wallets/wallet/settings/popups/inflation-destination/index.tsx
similarity index 94%
rename from shared/wallets/wallet/settings/popups/inflation-destination/index.js
rename to shared/wallets/wallet/settings/popups/inflation-destination/index.tsx
index 57aa0519bfca..008a317173ff 100644
--- a/shared/wallets/wallet/settings/popups/inflation-destination/index.js
+++ b/shared/wallets/wallet/settings/popups/inflation-destination/index.tsx
@@ -1,4 +1,3 @@
-// @flow
import React from 'react'
import * as Kb from '../../../../../common-adapters'
import * as Styles from '../../../../../styles'
@@ -7,24 +6,24 @@ import * as Constants from '../../../../../constants/wallets'
import {WalletPopup} from '../../../../common'
import openUrl from '../../../../../util/open-url'
-export type Props = {|
- error: string,
- inflationDestination: Types.AccountInflationDestination,
+export type Props = {
+ error: string
+ inflationDestination: Types.AccountInflationDestination
options: Array<{
- name: string,
- recommended: boolean,
- address: Types.AccountID,
- link: string,
- }>,
- onSubmit: (dest: string, name: string) => void,
- onClose: () => void,
-|}
+ name: string
+ recommended: boolean
+ address: Types.AccountID
+ link: string
+ }>
+ onSubmit: (dest: string, name: string) => void
+ onClose: () => void
+}
-type State = {|
- address: string,
- name: string,
- otherAddress: string,
-|}
+type State = {
+ address: string
+ name: string
+ otherAddress: string
+}
class InflationDestinationPopup extends React.Component {
constructor(props: Props) {
@@ -43,8 +42,8 @@ class InflationDestinationPopup extends React.Component {
// choose first recommended
if (!Types.isValidAccountID(address)) {
const reco = props.options.find(o => o.recommended)
- address = reco?.address || ''
- name = reco?.name || ''
+ address = reco && reco.address ? reco.address : ''
+ name = reco && reco.name ? reco.name : ''
}
this.state = {address, name, otherAddress}
diff --git a/shared/wallets/wallet/settings/popups/really-remove-account/container.js b/shared/wallets/wallet/settings/popups/really-remove-account/container.tsx
similarity index 93%
rename from shared/wallets/wallet/settings/popups/really-remove-account/container.js
rename to shared/wallets/wallet/settings/popups/really-remove-account/container.tsx
index ca31fb31567e..71abcc2db337 100644
--- a/shared/wallets/wallet/settings/popups/really-remove-account/container.js
+++ b/shared/wallets/wallet/settings/popups/really-remove-account/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../../../../util/container'
import * as Constants from '../../../../../constants/wallets'
import * as ConfigGen from '../../../../../actions/config-gen'
@@ -8,7 +7,12 @@ import * as Types from '../../../../../constants/types/wallets'
import {anyWaiting} from '../../../../../constants/waiting'
import ReallyRemoveAccountPopup from '.'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const accountID = Container.getRouteProps(ownProps, 'accountID')
@@ -49,7 +53,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
waiting: stateProps.waiting,
})
-export default Container.namedConnect(
+export default Container.namedConnect(
mapStateToProps,
mapDispatchToProps,
mergeProps,
diff --git a/shared/wallets/wallet/settings/popups/really-remove-account/index.js b/shared/wallets/wallet/settings/popups/really-remove-account/index.tsx
similarity index 94%
rename from shared/wallets/wallet/settings/popups/really-remove-account/index.js
rename to shared/wallets/wallet/settings/popups/really-remove-account/index.tsx
index 6d0b88730b15..f01227959c45 100644
--- a/shared/wallets/wallet/settings/popups/really-remove-account/index.js
+++ b/shared/wallets/wallet/settings/popups/really-remove-account/index.tsx
@@ -1,22 +1,21 @@
-// @flow
import React from 'react'
import * as Kb from '../../../../../common-adapters'
import * as Styles from '../../../../../styles'
import {WalletPopup} from '../../../../common'
-type Props = Kb.PropsWithTimer<{|
- name: string,
- loading: boolean,
- waiting: boolean,
- onCopyKey: () => void,
- onFinish: () => void,
- onCancel: () => void,
- onLoadSecretKey: () => void,
- onSecretKeySeen: () => void,
-|}>
+type Props = Kb.PropsWithTimer<{
+ name: string
+ loading: boolean
+ waiting: boolean
+ onCopyKey: () => void
+ onFinish: () => void
+ onCancel: () => void
+ onLoadSecretKey: () => void
+ onSecretKeySeen: () => void
+}>
type State = {
- showingToast: boolean,
+ showingToast: boolean
}
class ReallyRemoveAccountPopup extends React.Component {
diff --git a/shared/wallets/wallet/settings/popups/remove-account/container.js b/shared/wallets/wallet/settings/popups/remove-account/container.tsx
similarity index 82%
rename from shared/wallets/wallet/settings/popups/remove-account/container.js
rename to shared/wallets/wallet/settings/popups/remove-account/container.tsx
index 11bce5abd88e..b1ea1e350c8d 100644
--- a/shared/wallets/wallet/settings/popups/remove-account/container.js
+++ b/shared/wallets/wallet/settings/popups/remove-account/container.tsx
@@ -1,11 +1,15 @@
-// @flow
import * as Container from '../../../../../util/container'
import * as Constants from '../../../../../constants/wallets'
import * as Types from '../../../../../constants/types/wallets'
import * as RouteTreeGen from '../../../../../actions/route-tree-gen'
import RemoveAccountPopup from '.'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const accountID = Container.getRouteProps(ownProps, 'accountID')
@@ -41,9 +45,6 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
onDelete: () => dispatchProps._onDelete(stateProps.accountID),
})
-export default Container.namedConnect(
- mapStateToProps,
- mapDispatchToProps,
- mergeProps,
- 'RemoveAccountPopup'
-)(RemoveAccountPopup)
+export default Container.namedConnect(mapStateToProps, mapDispatchToProps, mergeProps, 'RemoveAccountPopup')(
+ RemoveAccountPopup
+)
diff --git a/shared/wallets/wallet/settings/popups/remove-account/index.js b/shared/wallets/wallet/settings/popups/remove-account/index.tsx
similarity index 95%
rename from shared/wallets/wallet/settings/popups/remove-account/index.js
rename to shared/wallets/wallet/settings/popups/remove-account/index.tsx
index bf415d91b3a7..8a3951dd3268 100644
--- a/shared/wallets/wallet/settings/popups/remove-account/index.js
+++ b/shared/wallets/wallet/settings/popups/remove-account/index.tsx
@@ -1,15 +1,14 @@
-// @flow
import React from 'react'
import * as Kb from '../../../../../common-adapters'
import * as Styles from '../../../../../styles'
import {WalletPopup} from '../../../../common'
-export type Props = {|
- name: string,
- balance: string,
- onDelete: () => void,
- onClose: () => void,
-|}
+export type Props = {
+ name: string
+ balance: string
+ onDelete: () => void
+ onClose: () => void
+}
const RemoveAccountPopup = (props: Props) => {
const buttons = [
diff --git a/shared/wallets/wallet/settings/popups/rename-account/container.js b/shared/wallets/wallet/settings/popups/rename-account/container.tsx
similarity index 93%
rename from shared/wallets/wallet/settings/popups/rename-account/container.js
rename to shared/wallets/wallet/settings/popups/rename-account/container.tsx
index 5316b53a4b2c..891652c6fa5d 100644
--- a/shared/wallets/wallet/settings/popups/rename-account/container.js
+++ b/shared/wallets/wallet/settings/popups/rename-account/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import {capitalize} from 'lodash-es'
import * as Container from '../../../../../util/container'
import * as Constants from '../../../../../constants/wallets'
@@ -8,7 +7,12 @@ import * as RouteTreeGen from '../../../../../actions/route-tree-gen'
import {anyWaiting} from '../../../../../constants/waiting'
import RenameAccount from '.'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const accountID = Container.getRouteProps(ownProps, 'accountID')
@@ -49,7 +53,7 @@ const mergeProps = (stateProps, dispatchProps) => ({
waiting: stateProps.waiting,
})
-export default Container.connect(
+export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallet/settings/popups/rename-account/index.js b/shared/wallets/wallet/settings/popups/rename-account/index.tsx
similarity index 82%
rename from shared/wallets/wallet/settings/popups/rename-account/index.js
rename to shared/wallets/wallet/settings/popups/rename-account/index.tsx
index ad060b40d012..8009674c90f8 100644
--- a/shared/wallets/wallet/settings/popups/rename-account/index.js
+++ b/shared/wallets/wallet/settings/popups/rename-account/index.tsx
@@ -1,25 +1,24 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../../../common-adapters'
-import type {ValidationState} from '../../../../../constants/types/wallets'
+import {ValidationState} from '../../../../../constants/types/wallets'
import {EnterName, WalletPopup} from '../../../../common'
import * as Styles from '../../../../../styles'
-type Props = {|
- renameAccountError: string,
- error: string,
- initialName: string,
- nameValidationState: ValidationState,
- onCancel: () => void,
- onClearErrors: () => void,
- onChangeAccountName: (name: string) => void,
- onDone: (name: string) => void,
- waiting: boolean,
-|}
+type Props = {
+ renameAccountError: string
+ error: string
+ initialName: string
+ nameValidationState: ValidationState
+ onCancel: () => void
+ onClearErrors: () => void
+ onChangeAccountName: (name: string) => void
+ onDone: (name: string) => void
+ waiting: boolean
+}
-type State = {|
- name: string,
-|}
+type State = {
+ name: string
+}
class RenameAccountPopup extends React.Component {
state = {name: this.props.initialName}
diff --git a/shared/wallets/wallet/settings/popups/set-default/container.js b/shared/wallets/wallet/settings/popups/set-default/container.tsx
similarity index 90%
rename from shared/wallets/wallet/settings/popups/set-default/container.js
rename to shared/wallets/wallet/settings/popups/set-default/container.tsx
index c9cfb34ebfa0..c0f4b9b0e7cd 100644
--- a/shared/wallets/wallet/settings/popups/set-default/container.js
+++ b/shared/wallets/wallet/settings/popups/set-default/container.tsx
@@ -1,4 +1,3 @@
-// @flow
import * as Container from '../../../../../util/container'
import * as Constants from '../../../../../constants/wallets'
import * as Types from '../../../../../constants/types/wallets'
@@ -7,7 +6,12 @@ import * as RouteTreeGen from '../../../../../actions/route-tree-gen'
import {anyWaiting} from '../../../../../constants/waiting'
import SetDefaultAccountPopup from '.'
-type OwnProps = Container.RouteProps<{accountID: Types.AccountID}, {}>
+type OwnProps = Container.RouteProps<
+ {
+ accountID: Types.AccountID
+ },
+ {}
+>
const mapStateToProps = (state, ownProps) => {
const accountID = Container.getRouteProps(ownProps, 'accountID')
@@ -36,7 +40,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => ({
waiting: stateProps.waiting,
})
-export default Container.namedConnect(
+export default Container.namedConnect(
mapStateToProps,
mapDispatchToProps,
mergeProps,
diff --git a/shared/wallets/wallet/settings/popups/set-default/index.js b/shared/wallets/wallet/settings/popups/set-default/index.tsx
similarity index 95%
rename from shared/wallets/wallet/settings/popups/set-default/index.js
rename to shared/wallets/wallet/settings/popups/set-default/index.tsx
index f4c1baa566d6..99aa4959982a 100644
--- a/shared/wallets/wallet/settings/popups/set-default/index.js
+++ b/shared/wallets/wallet/settings/popups/set-default/index.tsx
@@ -1,16 +1,15 @@
-// @flow
import * as React from 'react'
import * as Kb from '../../../../../common-adapters'
import * as Styles from '../../../../../styles'
import {WalletPopup} from '../../../../common'
-type Props = {|
- accountName: string,
- onAccept: () => void,
- onClose: () => void,
- username: string,
- waiting: boolean,
-|}
+type Props = {
+ accountName: string
+ onAccept: () => void
+ onClose: () => void
+ username: string
+ waiting: boolean
+}
const SetDefaultAccountPopup = (props: Props) => {
const buttons = [
diff --git a/shared/wallets/wallets-and-details/container.js b/shared/wallets/wallets-and-details/container.tsx
similarity index 81%
rename from shared/wallets/wallets-and-details/container.js
rename to shared/wallets/wallets-and-details/container.tsx
index 50bdd1866021..5354ecec0a05 100644
--- a/shared/wallets/wallets-and-details/container.js
+++ b/shared/wallets/wallets-and-details/container.tsx
@@ -1,10 +1,11 @@
-// @flow
import * as React from 'react'
import WalletsAndDetails from '.'
import Onboarding from '../onboarding/container'
-import {connect, type RouteProps} from '../../util/container'
+import {connect, RouteProps} from '../../util/container'
-type OwnProps = RouteProps<{}, {}> & {children: React.Node}
+type OwnProps = RouteProps<{}, {}> & {
+ children: React.ReactNode
+}
const mapStateToProps = state => ({
acceptedDisclaimer: state.wallets.acceptedDisclaimer,
@@ -28,7 +29,7 @@ const WalletsOrOnboarding = props =>
)
-export default connect(
+export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
diff --git a/shared/wallets/wallets-and-details/index.js b/shared/wallets/wallets-and-details/index.tsx
similarity index 88%
rename from shared/wallets/wallets-and-details/index.js
rename to shared/wallets/wallets-and-details/index.tsx
index ac01f21a8d2d..72b6bddb4df5 100644
--- a/shared/wallets/wallets-and-details/index.js
+++ b/shared/wallets/wallets-and-details/index.tsx
@@ -1,15 +1,14 @@
-// @flow
import * as React from 'react'
import {Box2} from '../../common-adapters'
import AccountReloader from '../common/account-reloader'
import WalletList from '../wallet-list/container'
import {globalColors, styleSheetCreate} from '../../styles'
-type Props = {|
- children: React.Node,
- navigateAppend: any => void,
- navigateUp: () => void,
-|}
+type Props = {
+ children: React.ReactNode
+ navigateAppend: (append: any) => void
+ navigateUp: () => void
+}
const WalletsAndDetails = (props: Props) => (