From 63eb8aadafcabd94015151eec7c2ff3c27ee2c47 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 30 Jul 2021 00:52:42 -0400 Subject: [PATCH] fix: Flow, remove misused withTranslation on functional component --- app/scenes/Login/index.js | 14 ++++---------- app/utils/language.js | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/scenes/Login/index.js b/app/scenes/Login/index.js index 333d8cc81..1f674c8bf 100644 --- a/app/scenes/Login/index.js +++ b/app/scenes/Login/index.js @@ -3,12 +3,7 @@ import { find } from "lodash"; import { observer } from "mobx-react"; import { BackIcon, EmailIcon } from "outline-icons"; import * as React from "react"; -import { - Trans, - withTranslation, - type TFunction, - useTranslation, -} from "react-i18next"; +import { Trans, useTranslation } from "react-i18next"; import { Link, type Location, Redirect } from "react-router-dom"; import styled from "styled-components"; import { setCookie } from "tiny-cookie"; @@ -29,12 +24,11 @@ import useStores from "hooks/useStores"; type Props = {| location: Location, - t: TFunction, |}; -function Login({ location, t }: Props) { +function Login({ location }: Props) { const query = useQuery(); - const { i18n } = useTranslation(); + const { t, i18n } = useTranslation(); const { auth } = useStores(); const { config } = auth; const [emailLinkSentTo, setEmailLinkSentTo] = React.useState(""); @@ -278,4 +272,4 @@ const Centered = styled(Flex)` margin: 0 auto; `; -export default withTranslation()(observer(Login)); +export default observer(Login); diff --git a/app/utils/language.js b/app/utils/language.js index 050ae4902..8fe0b6115 100644 --- a/app/utils/language.js +++ b/app/utils/language.js @@ -6,7 +6,7 @@ export function detectLanguage() { return `${ln}_${region}`; } -export function changeLanguage(toLanguageString, i18n) { +export function changeLanguage(toLanguageString: ?string, i18n: any) { if (toLanguageString && i18n.language !== toLanguageString) { // Languages are stored in en_US format in the database, however the // frontend translation framework (i18next) expects en-US