Skip to content

Commit e73f98c

Browse files
committed
WIP: Apple Design
1 parent 41f7a53 commit e73f98c

9 files changed

+590
-267
lines changed

src/App.tsx

Lines changed: 311 additions & 129 deletions
Large diffs are not rendered by default.

src/ComponentListPage.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,35 @@ import {HomeComponentTile} from './components/ControlItem';
1616

1717
const textColor = Platform.select<ColorValue>({
1818
windows: PlatformColor('TextFillColorPrimaryBrush'),
19+
macos: PlatformColor('labelColor'),
1920
default: 'black',
2021
});
2122

23+
const appleTypography = StyleSheet.create({
24+
largeTitle: {
25+
fontSize: 26,
26+
lineHeight: 32,
27+
},
28+
headline: {
29+
fontSize: 13,
30+
lineHeight: 16,
31+
fontWeight: 'bold',
32+
color: textColor,
33+
},
34+
title1: {
35+
fontSize: 22,
36+
lineHeight: 26,
37+
fontWeight: 'regular',
38+
color: textColor,
39+
},
40+
title1Emphasized: {
41+
fontSize: 22,
42+
lineHeight: 26,
43+
fontWeight: 'bold',
44+
color: textColor,
45+
},
46+
});
47+
2248
const createStyles = () =>
2349
StyleSheet.create({
2450
container: {
@@ -69,7 +95,9 @@ const ListOfComponents = ({
6995
accessibilityLabel={heading + 'components'}
7096
accessible={true}
7197
accessibilityRole="none">
72-
<Text accessibilityRole="header" style={styles.heading}>
98+
<Text
99+
accessibilityRole="header"
100+
style={[styles.heading, appleTypography.title1Emphasized]}>
73101
{heading}
74102
</Text>
75103
<View style={styles.controlItems}>
@@ -131,7 +159,9 @@ const ComponentListPage = ({route, navigation}: ComponentListPageProps) => {
131159
</View>
132160
) : (
133161
<View style={styles.container}>
134-
<Text accessibilityRole={'header'} style={styles.title}>
162+
<Text
163+
accessibilityRole={'header'}
164+
style={[styles.title, appleTypography.largeTitle]}>
135165
All samples
136166
</Text>
137167
<GroupedListOfAllComponents

src/HomePage.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ import RNGalleryList from './RNGalleryList';
1414
import {ScreenWrapper} from './components/ScreenWrapper';
1515
import {TileGallery} from './components/TileGallery';
1616
import {ListOfComponents} from './ComponentListPage';
17-
import {Svg, Defs, Stop, Rect, LinearGradient} from 'react-native-svg';
1817
import useHighContrastState from './hooks/useHighContrastState';
1918

2019
const createStyles = () =>
2120
StyleSheet.create({
2221
container: {
2322
padding: 10,
2423
paddingBottom: 40,
25-
paddingLeft: 36,
24+
paddingStart: 36,
2625
alignSelf: 'stretch',
2726
height: '100%',
2827
alignContent: 'flex-start',
@@ -44,7 +43,8 @@ const createStyles = () =>
4443
},
4544
pageHeader: {},
4645
pageTitleContainer: {
47-
height: 204,
46+
// height: 204,
47+
height: 76,
4848
justifyContent: 'center',
4949
},
5050
pageTitle: {
@@ -56,6 +56,18 @@ const createStyles = () =>
5656
},
5757
});
5858

59+
const appleTypography = StyleSheet.create({
60+
largeTitle: {
61+
fontSize: 26,
62+
lineHeight: 32,
63+
},
64+
largeTitleEmphasized: {
65+
fontSize: 26,
66+
lineHeight: 32,
67+
fontWeight: 'bold',
68+
},
69+
});
70+
5971
interface BackgroundGradientProps {
6072
colorStop1: ColorValue;
6173
colorStop2: ColorValue;
@@ -81,33 +93,24 @@ const PageTitle = () => {
8193
return (
8294
// https://github.com/microsoft/WinUI-Gallery/blob/c3cf8db5607c71f5df51fd4eb45d0ce6e932d338/WinUIGallery/Controls/HomePageHeaderImage.xaml#L19
8395
<View style={styles.heroGradient}>
84-
{/* <Svg height="100%" width="100%" style={StyleSheet.absoluteFillObject}>
85-
<Defs>
86-
<LinearGradient id="grad" x1={0.5} y1={0} x2={0.5} y2={1}>
87-
<Stop offset="0" stopColor={colorStops[0]} />
88-
<Stop offset="1" stopColor={colorStops[1]} />
89-
</LinearGradient>
90-
</Defs>
91-
<Rect width="100%" height="100%" fill="url(#grad)" />
92-
</Svg> */}
93-
<Image
96+
{/* <Image
9497
source={require('../assets/GalleryHeaderImage.png')}
9598
style={[
9699
styles.heroBackgroundImage,
97100
{
98101
opacity: colorScheme === 'light' ? 0.9 : 0.8,
99102
aspectRatio: 1,
100-
height: 450,
103+
height: 330,
101104
// margin: 20,
102105
},
103106
]}
104-
/>
107+
/> */}
105108
<View style={styles.pageHeader}>
106109
<View style={styles.pageTitleContainer}>
107110
<Text
108111
accessible
109112
accessibilityRole={'header'}
110-
style={styles.pageTitle}>
113+
style={[styles.pageTitle, appleTypography.largeTitle]}>
111114
React Native Gallery
112115
</Text>
113116
</View>
@@ -117,9 +120,10 @@ const PageTitle = () => {
117120
);
118121
};
119122

120-
export const HomePage: React.FunctionComponent<{}> = ({navigation}) => {
121-
const {colors} = useTheme();
122-
const styles = createStyles(colors);
123+
export const HomePage: React.FunctionComponent<{navigation: any}> = ({
124+
navigation,
125+
}) => {
126+
const styles = createStyles();
123127
const isScreenFocused = useIsFocused();
124128

125129
return isScreenFocused ? (

0 commit comments

Comments
 (0)