import React, { useEffect } from 'react'; import { useSelector } from 'react-redux'; import I18n from '../i18n'; import StatusBar from '../containers/StatusBar'; import openLink from '../lib/methods/helpers/openLink'; import { useTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import * as List from '../containers/List'; import { OutsideParamList } from '../stacks/types'; import { IBaseScreen, IApplicationState } from '../definitions'; interface ILegalViewProps extends IBaseScreen { server: string; } const LegalView = ({ navigation }: ILegalViewProps): React.ReactElement => { const server = useSelector((state: IApplicationState) => state.server.server); const { theme } = useTheme(); useEffect(() => { navigation.setOptions({ title: I18n.t('Legal') }); }, []); const onPressItem = ({ route }: { route: string }) => { if (!server) { return; } openLink(`${server}/${route}`, theme); }; return ( onPressItem({ route: 'terms-of-service' })} testID='legal-terms-button' showActionIndicator /> onPressItem({ route: 'privacy-policy' })} testID='legal-privacy-button' showActionIndicator /> ); }; export default LegalView;