Skip to content

Commit 60d60d3

Browse files
authored
perf(onboarding): memo ToS (#2503)
1 parent d1be101 commit 60d60d3

File tree

1 file changed

+38
-41
lines changed

1 file changed

+38
-41
lines changed

src/assets/tos.tsx

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,53 @@
1-
import React, { ReactElement } from 'react';
2-
import { StyleSheet, View } from 'react-native';
3-
1+
import React, { memo, ReactElement, ReactNode } from 'react';
2+
import { StyleProp, StyleSheet, TextStyle, View } from 'react-native';
43
import { BodyM } from '../styles/text';
54

65
const T = ({
76
children,
87
style,
98
}: {
10-
children: React.ReactNode;
11-
style: any;
12-
}): ReactElement => {
13-
return (
14-
<BodyM color="secondary" style={style}>
15-
{children}
16-
</BodyM>
17-
);
18-
};
19-
20-
const s = StyleSheet.create({
21-
root: {
22-
marginTop: 8,
23-
marginBottom: 300,
24-
},
25-
i: {
26-
fontStyle: 'italic',
27-
},
28-
u: {
29-
textDecorationLine: 'underline',
30-
},
31-
b: {
32-
fontWeight: 'bold',
33-
},
34-
p: {
35-
marginTop: 10,
36-
},
37-
});
9+
children: ReactNode;
10+
style: StyleProp<TextStyle>;
11+
}): ReactElement => (
12+
<BodyM style={style} color="secondary">
13+
{children}
14+
</BodyM>
15+
);
3816

3917
type Props = {
40-
children: React.ReactNode;
18+
children: ReactNode;
4119
};
4220

4321
const B = ({ children }: Props): ReactElement => {
44-
return <T style={s.b}>{children}</T>;
22+
return <T style={styles.b}>{children}</T>;
4523
};
4624

4725
const U = ({ children }: Props): ReactElement => {
48-
return <T style={s.u}>{children}</T>;
26+
return <T style={styles.u}>{children}</T>;
4927
};
5028

5129
const I = ({ children }: Props): ReactElement => {
52-
return <T style={s.i}>{children}</T>;
30+
return <T style={styles.i}>{children}</T>;
5331
};
5432

5533
const BU = ({ children }: Props): ReactElement => {
56-
return <T style={[s.b, s.u]}>{children}</T>;
34+
return <T style={[styles.b, styles.u]}>{children}</T>;
5735
};
5836

5937
const P = ({ children }: Props): ReactElement => {
60-
return <T style={s.p}>{children}</T>;
38+
return <T style={styles.p}>{children}</T>;
6139
};
6240

6341
const BI = ({ children }: Props): ReactElement => {
64-
return <T style={[s.b, s.i]}>{children}</T>;
42+
return <T style={[styles.b, styles.i]}>{children}</T>;
6543
};
6644

6745
const BUI = ({ children }: Props): ReactElement => {
68-
return <T style={[s.b, s.u, s.i]}>{children}</T>;
46+
return <T style={[styles.b, styles.u, styles.i]}>{children}</T>;
6947
};
7048

7149
const TOS = (): ReactElement => (
72-
<View style={s.root}>
50+
<View style={styles.root}>
7351
<P>
7452
<B>Effective date: February 4, 2025</B>
7553
</P>
@@ -1898,4 +1876,23 @@ const TOS = (): ReactElement => (
18981876
</View>
18991877
);
19001878

1901-
export default TOS;
1879+
const styles = StyleSheet.create({
1880+
root: {
1881+
marginTop: 8,
1882+
marginBottom: 300,
1883+
},
1884+
i: {
1885+
fontStyle: 'italic',
1886+
},
1887+
u: {
1888+
textDecorationLine: 'underline',
1889+
},
1890+
b: {
1891+
fontWeight: 'bold',
1892+
},
1893+
p: {
1894+
marginTop: 10,
1895+
},
1896+
});
1897+
1898+
export default memo(TOS);

0 commit comments

Comments
 (0)