Berikut step by step untuk setup project React Native dengan Expo : 1. Buat project menggunakan CLI seperti berikut:
npx create-expo-app@latest
npx expo install expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar
npx expo install expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar react-native-gesture-handler
{
"main": "expo-router/entry"
}
{
"scheme": "ganti-dengan-app-name"
}
npx expo install react-native-web react-dom
{
"web": {
"bundler": "metro"
}
}
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
npx expo start -c
npx expo install nativewind tailwindcss react-native-reanimated react-native-safe-area-context
Run npx tailwindcss init to create a tailwind.config.js file
/** @type {import('tailwindcss').Config} */
module.exports = {
// NOTE: Update this to include the paths to all of your component files.
content: ["./app/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
theme: {
extend: {},
},
plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;
module.exports = function (api) {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
};
};
npx expo customize metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");
const config = getDefaultConfig(__dirname);
module.exports = withNativeWind(config, { input: "./global.css" });
// Import your global CSS file
import "../global.css";
Sekian sharing ilmu dari saya, jika blog ini berguna bisa kalian share sebanyak-banyaknya.
Sebaik baik blog adalah blog yang bermanfaat bagi pembacanya
0 Comments