// @flow import React, { useState } from 'react'; import type { AbstractComponent } from 'react'; import { useTranslation } from 'react-i18next'; /* * Props that will be passed by the AbstractPollsPane to its * concrete implementations (web/native). **/ export type AbstractProps = { createMode: boolean, onCreate: void => void, setCreateMode: boolean => void, t: Function, }; /** * Higher Order Component taking in a concrete PollsPane component and * augmenting it with state/behavior common to both web and native implementations. * * @param {React.AbstractComponent} Component - The concrete component. * @returns {React.AbstractComponent} */ const AbstractPollsPane = (Component: AbstractComponent) => () => { const [ createMode, setCreateMode ] = useState(false); const onCreate = () => { setCreateMode(true); }; const { t } = useTranslation(); return (); }; export default AbstractPollsPane;