Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
feat(app): add nativewind support (#19)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request! -->

#### What this PR does / why we need it:

Add `nativewind` support as opposed to `tailwind-rn`, you can use
`className` directly and babel will takecare of it.

```tsx
import { View } from 'react-native';

export default function App(): JSX.Element {
  return (
    <View className="flex-1 items-center justify-center bg-white">
    </View>
  );
}
```
  • Loading branch information
fuxingloh authored Jun 20, 2023
1 parent 15c4ba9 commit ddf6302
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 34 deletions.
23 changes: 23 additions & 0 deletions .idea/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions .idea/keychain.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions app/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* This file is used to declare global types for your application.
*/
/// <reference types="nativewind/types" />
1 change: 1 addition & 0 deletions app/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['nativewind/babel'],
};
};
7 changes: 5 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@
"dependencies": {
"@babel/core": "^7.20.0",
"@types/react": "~18.0.27",
"@types/react-native": "^0.72.2",
"expo": "~48.0.18",
"expo-status-bar": "~1.4.4",
"nativewind": "^2.0.11",
"react": "18.2.0",
"react-native": "0.71.3",
"typescript": "4.9.5"
"typescript": "^4.9.4"
},
"devDependencies": {
"@levain-keychain/eslint-config": "0.0.0",
"eas-cli": "^3.13.3",
"expo-cli": "^6.3.8"
"expo-cli": "^6.3.8",
"tailwindcss": "^3.3.2"
}
}
15 changes: 3 additions & 12 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import { Text, View } from 'react-native';

export default function App(): JSX.Element {
return (
<View style={styles.container}>
<Text>KeyChain — Open up App.js to start working on your app!</Text>
<View className="flex-1 items-center justify-center bg-white">
<Text className="font-medium">KeyChain — Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
8 changes: 8 additions & 0 deletions app/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
};
Loading

0 comments on commit ddf6302

Please sign in to comment.