Skip to content

Commit 0fbc747

Browse files
committed
switch to Tailwind v3, add custom config, patch twrnc, further tweaks
1 parent b17dbe3 commit 0fbc747

17 files changed

Lines changed: 99 additions & 124 deletions

bun.lock

Lines changed: 12 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/Libraries.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import dynamic from 'next/dynamic';
22
import { View } from 'react-native';
3-
import tw from 'twrnc';
43

54
import LoadingContent from '~/components/Library/LoadingContent';
65
import NotFound from '~/components/Package/NotFound';
76
import { type LibraryType } from '~/types';
7+
import tw from '~/util/tailwind';
88

99
type Props = {
1010
libraries: LibraryType[];

components/NotFoundContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { type ReactElement } from 'react';
22
import { Image, View } from 'react-native';
3-
import tw from 'twrnc';
43

54
import { A, H3, P } from '~/common/styleguide';
5+
import tw from '~/util/tailwind';
66

77
type Props = {
88
header?: string;

components/Package/NotFound.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import tw from 'twrnc';
2-
31
import { Button } from '~/components/Button';
42
import ContentContainer from '~/components/ContentContainer';
53
import Navigation from '~/components/Navigation';
64
import NotFoundContent from '~/components/NotFoundContent';
75
import PageMeta from '~/components/PageMeta';
6+
import tw from '~/util/tailwind';
87

98
export default function NotFound() {
109
return (

components/TopBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { Header as HtmlHeader } from '@expo/html-elements';
22
import Link from 'next/link';
33
import { useContext } from 'react';
44
import { StyleSheet, View } from 'react-native';
5-
import tw from 'twrnc';
65

76
import { layout, colors, H5, P, darkColors, useLayout } from '~/common/styleguide';
87
import ContentContainer from '~/components/ContentContainer';
98
import NavigationTab from '~/components/NavigationTab';
109
import CustomAppearanceContext from '~/context/CustomAppearanceContext';
10+
import tw from '~/util/tailwind';
1111

1212
import { Button } from './Button';
1313
import { GitHub, Logo, Plus, ThemeDark, ThemeLight, Tools } from './Icons';

context/CustomAppearanceProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import AsyncStorage from '@react-native-async-storage/async-storage';
22
import { type PropsWithChildren, useEffect, useState } from 'react';
33
import { View } from 'react-native';
4-
import tw, { useDeviceContext, useAppColorScheme } from 'twrnc';
4+
5+
import tw, { useDeviceContext, useAppColorScheme } from '~/util/tailwind';
56

67
import CustomAppearanceContext, {
78
type CustomAppearanceContextType,
@@ -52,6 +53,7 @@ export default function CustomAppearanceProvider({ children }: PropsWithChildren
5253
} else {
5354
return (
5455
<CustomAppearanceContext.Provider
56+
key={tw.memoBuster}
5557
value={{
5658
isDark,
5759
setIsDark: isDark => {

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@react-native-async-storage/async-storage": "^2.2.0",
2727
"@react-native-picker/picker": "^2.11.4",
2828
"@sentry/react": "^10.30.0",
29-
"@tailwindcss/postcss": "^4.1.18",
3029
"crypto-js": "^4.2.0",
3130
"es-toolkit": "^1.43.0",
3231
"expo": "54.0.29",
@@ -47,7 +46,7 @@
4746
"rehype-sanitize": "^6.0.0",
4847
"remark-emoji": "^5.0.2",
4948
"remark-gfm": "^4.0.1",
50-
"tailwindcss": "^4.1.18",
49+
"tailwindcss": "^3.4.19",
5150
"twrnc": "^4.11.1",
5251
"use-debounce": "^10.0.6"
5352
},
@@ -90,5 +89,8 @@
9089
"react-native-libraries.json": [
9190
"bun libraries:cleanup"
9291
]
92+
},
93+
"patchedDependencies": {
94+
"twrnc@4.11.1": "patches/twrnc@4.11.1.patch"
9395
}
9496
}

pages/_app.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ Sentry.init({
2222
function App({ pageProps, Component }: AppProps) {
2323
return (
2424
<CustomAppearanceProvider>
25-
<SafeAreaProvider
26-
style={{
27-
flex: 1,
28-
}}>
25+
<SafeAreaProvider style={{ flex: 1 }}>
2926
<Head>
3027
<meta
3128
name="viewport"

pages/index.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { type NextPageContext } from 'next';
22
import { useRouter } from 'next/router';
33
import { type ParsedUrlQuery } from 'node:querystring';
4-
import { StyleSheet } from 'react-native';
54

65
import ContentContainer from '~/components/ContentContainer';
76
import Libraries from '~/components/Libraries';
@@ -11,6 +10,7 @@ import Pagination from '~/components/Pagination';
1110
import Search from '~/components/Search';
1211
import { type APIResponseType } from '~/types';
1312
import getApiUrl from '~/util/getApiUrl';
13+
import tw from '~/util/tailwind';
1414
import urlWithQuery from '~/util/urlWithQuery';
1515

1616
type Props = {
@@ -21,11 +21,12 @@ type Props = {
2121
function Index({ data, query }: Props) {
2222
const router = useRouter();
2323
const total = data.total ?? 0;
24+
2425
return (
2526
<>
2627
<PageMeta searchQuery={router.query?.search} />
2728
<Navigation header={<Search query={router.query} total={total} />} />
28-
<ContentContainer style={styles.container}>
29+
<ContentContainer style={tw`px-4 py-3`}>
2930
<Pagination query={query} total={total} />
3031
<Libraries libraries={data && data.libraries} />
3132
<Pagination query={query} total={total} />
@@ -45,11 +46,4 @@ Index.getInitialProps = async (ctx: NextPageContext) => {
4546
};
4647
};
4748

48-
const styles = StyleSheet.create({
49-
container: {
50-
paddingHorizontal: 16,
51-
paddingVertical: 12,
52-
},
53-
});
54-
5549
export default Index;

pages/tools.tsx

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { StyleSheet } from 'react-native';
2-
31
import ContentContainer from '~/components/ContentContainer';
42
import Navigation from '~/components/Navigation';
53
import PageMeta from '~/components/PageMeta';
64
import ToolEntry from '~/components/Tools/ToolEntry';
5+
import tw from '~/util/tailwind';
76

87
export default function Tools() {
98
return (
@@ -17,7 +16,7 @@ export default function Tools() {
1716
title="Tools"
1817
description="List of development tools, apps and websites using React Native Directory data."
1918
/>
20-
<ContentContainer style={styles.container}>
19+
<ContentContainer style={tw`my-10 px-4 gap-4`}>
2120
<ToolEntry
2221
name="React Native Directory VS Code extension"
2322
description="Browse through the React Native Directory and perform actions related to the chosen package inside the built-in editor Command Palette."
@@ -85,35 +84,3 @@ export default function Tools() {
8584
</>
8685
);
8786
}
88-
89-
const styles = StyleSheet.create({
90-
container: {
91-
marginVertical: 40,
92-
paddingHorizontal: 16,
93-
gap: 16,
94-
},
95-
subHeader: {
96-
fontSize: 22,
97-
marginTop: 16,
98-
marginBottom: 12,
99-
},
100-
paragraph: {
101-
fontSize: 17,
102-
lineHeight: 29,
103-
marginBottom: 17,
104-
fontWeight: 300,
105-
},
106-
buttonsContainer: {
107-
flexDirection: 'row',
108-
flexWrap: 'wrap',
109-
gap: 12,
110-
marginBottom: 24,
111-
},
112-
button: {
113-
flexDirection: 'row',
114-
paddingHorizontal: 12,
115-
minHeight: 32,
116-
fontSize: 14,
117-
gap: 6,
118-
},
119-
});

0 commit comments

Comments
 (0)