Skip to content

Commit f9628ed

Browse files
Merge pull request #199 from OpenDTU-App/198-fix-layout-issues-differences-between-android-and-ios
2 parents 28fa72f + 76eb889 commit f9628ed

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
import type { FC } from 'react';
2-
import type { SurfaceProps } from 'react-native-paper';
3-
import { Surface } from 'react-native-paper';
2+
import type { ViewProps } from 'react-native';
3+
import { useTheme } from 'react-native-paper';
44
import type { ThemeProp } from 'react-native-paper/lib/typescript/types';
55

6-
import styled from 'styled-components';
6+
import { View } from 'react-native';
77

8-
const InternalStyledSurface = styled(Surface)<ExtraProps>`
9-
border-radius: ${({ theme, roundness }) =>
10-
theme.roundness! * (roundness ?? 4)}px;
11-
flex: 1;
12-
box-shadow: ${({ theme, disableShadow }) =>
13-
disableShadow ? 'none' : theme.shadow};
14-
`;
15-
16-
interface ExtraProps {
8+
export type StyledSurfaceProps = ViewProps & {
9+
theme: ThemeProp;
1710
roundness?: number;
18-
disableShadow?: boolean;
19-
}
11+
};
2012

21-
export type StyledSurfaceProps = SurfaceProps & {
22-
theme: ThemeProp;
23-
} & ExtraProps;
13+
const StyledSurface: FC<StyledSurfaceProps> = ({ children, ...props }) => {
14+
const theme = useTheme();
2415

25-
const StyledSurface: FC<StyledSurfaceProps> = ({ children, ...props }) => (
26-
<InternalStyledSurface elevation={5} mode="flat" disableShadow {...props}>
27-
{children}
28-
</InternalStyledSurface>
29-
);
16+
return (
17+
<View
18+
{...props}
19+
style={{
20+
//@ts-expect-error: 2698 because idk
21+
...(props?.style ?? {}),
22+
borderRadius: theme.roundness! * (props.roundness ?? 4),
23+
backgroundColor: theme.colors.elevation.level5,
24+
flex: 1,
25+
}}
26+
>
27+
{children}
28+
</View>
29+
);
30+
};
3031

3132
export default StyledSurface;

src/views/navigation/tabs/GraphTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import DeviceOfflineWrapper from '@/components/DeviceOfflineWrapper';
55

66
import { StyledScrollView, StyledView } from '@/style';
77

8-
const LivedataTab = () => {
8+
const GraphTab = () => {
99
const theme = useTheme();
1010

1111
return (
@@ -19,4 +19,4 @@ const LivedataTab = () => {
1919
);
2020
};
2121

22-
export default LivedataTab;
22+
export default GraphTab;

0 commit comments

Comments
 (0)