REF: Header

This commit is contained in:
Marcos Rodriguez Velez 2024-05-03 19:03:40 -04:00
parent 70c8c1fa00
commit 17ff5de564
No known key found for this signature in database
GPG Key ID: 6030B2F48CCE86D7
3 changed files with 6 additions and 37 deletions

View File

@ -1,7 +1,7 @@
/* eslint react/prop-types: "off", react-native/no-inline-styles: "off" */
import React, { Component, forwardRef } from 'react';
import PropTypes from 'prop-types';
import { Icon, Text, Header } from 'react-native-elements';
import { Icon, Text } from 'react-native-elements';
import {
ActivityIndicator,
Dimensions,
@ -20,7 +20,6 @@ import NetworkTransactionFees, { NetworkTransactionFee, NetworkTransactionFeeTyp
import AsyncStorage from '@react-native-async-storage/async-storage';
import { BlueCurrentTheme, useTheme } from './components/themes';
import loc, { formatStringAddTwoWhiteSpaces } from './loc';
import SafeArea from './components/SafeArea';
const { height, width } = Dimensions.get('window');
const aspectRatio = height / width;
@ -118,36 +117,6 @@ export const BlueFormMultiInput = props => {
);
};
export const BlueHeaderDefaultSub = props => {
const { colors } = useTheme();
return (
<SafeArea>
<Header
backgroundColor={colors.background}
leftContainerStyle={{ minWidth: '100%' }}
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
leftComponent={
<Text
adjustsFontSizeToFit
style={{
fontWeight: 'bold',
fontSize: 30,
color: colors.foregroundColor,
}}
>
{props.leftText}
</Text>
}
{...props}
/>
</SafeArea>
);
};
export const BlueSpacing = props => {
return <View {...props} style={{ height: 60 }} />;
};

View File

@ -1,10 +1,10 @@
import React from 'react';
import { ScrollView, StyleSheet, Platform } from 'react-native';
import { BlueHeaderDefaultSub } from '../../BlueComponents';
import loc from '../../loc';
import ListItem from '../../components/ListItem';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import { useSettings } from '../../components/Context/SettingsContext';
import { Header } from '../../components/Header';
const styles = StyleSheet.create({
root: {
@ -31,7 +31,7 @@ const Settings = () => {
contentInsetAdjustmentBehavior="automatic"
automaticallyAdjustContentInsets
>
{Platform.OS === 'android' ? <BlueHeaderDefaultSub leftText={loc.settings.header} /> : <></>}
{Platform.OS === 'android' ? <Header leftText={loc.settings.header} /> : <></>}
<ListItem title={loc.settings.general} onPress={() => navigate('GeneralSettings')} testID="GeneralSettings" chevron />
<ListItem title={loc.settings.currency} onPress={() => navigate('Currency')} testID="Currency" chevron />
<ListItem title={loc.settings.language} onPress={() => navigate('Language')} testID="Language" chevron />

View File

@ -3,7 +3,7 @@ import React from 'react';
import TestRenderer from 'react-test-renderer';
import Settings from '../../screen/settings/Settings';
import Selftest from '../../screen/selftest';
import { BlueHeaderDefaultSub } from '../../BlueComponents';
import { Header } from '../../components/Header';
jest.mock('../../blue_modules/BlueElectrum', () => {
return {
@ -11,8 +11,8 @@ jest.mock('../../blue_modules/BlueElectrum', () => {
};
});
it('BlueHeaderDefaultSub works', () => {
const rendered = TestRenderer.create(<BlueHeaderDefaultSub />).toJSON();
it('Header works', () => {
const rendered = TestRenderer.create(<Header />).toJSON();
expect(rendered).toBeTruthy();
});