| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- import {
- useLayoutEffect
- } from "react";
- import {
- View
- } from "react-native";
- import stylesheet from "./stylesheet";
- import {
- NCoreUIKitLocalize,
- NCoreUIKitTheme,
- PageContainer,
- CodeViewer,
- Button,
- Header,
- Text
- } from "ncore-ui-kit";
- import {
- useNavigation
- } from "@react-navigation/native";
- import type RootStackParamList from "../../navigation/type";
- import type {
- NativeStackNavigationProp
- } from "@react-navigation/native-stack";
- import {
- ChevronRightIcon,
- ChevronLeftIcon
- } from "lucide-react-native";
- const Implementation = () => {
- const {
- colors,
- spaces
- } = NCoreUIKitTheme.useContext();
- const {
- localize
- } = NCoreUIKitLocalize.useContext();
- const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
- useLayoutEffect(() => {
- navigation.setOptions({
- header: () => <Header
- title={localize("implementation-title")}
- isWrapSafeareaContext={false}
- navigation={navigation}
- isGoBackEnable={true}
- />,
- headerShown: true
- });
- }, []);
- const exampleCode = `import {
- type NCoreUIKitConfig,
- setupNCoreUIKit,
- Host
- } from "ncore-ui-kit";
- // Kendi temanızı ve dil dosyanızı dahil edin
- import defaultLocaleJSON from "./variants/locales/default.json";
- import defaultThemeJSON from "./variants/themes/default.json";
- // NCore konfigürasyonunu oluşturun
- const NCoreConfig: NCoreUIKitConfig = {
- projectThemes: defaultThemeJSON as NCoreUIKit.Palette,
- initialSelectedGapPropagation: "spacious",
- projectLocales: defaultLocaleJSON,
- initialSelectedPalette: "nibgat",
- initialSelectedTheme: "light"
- };
- // NCoreUIKitBase nesnesini ayağa kaldırın
- const NCoreUIKitBase = setupNCoreUIKit(NCoreConfig);
- const App = () => {
- return <NCoreUIKitBase.Provider>
- <Host name="main-header">
- {/* Sayfalarınız veya Navigasyon yapınız burada yer almalı */}
- </Host>
- </NCoreUIKitBase.Provider>;
- };
- export default App;`;
- const expoMetroConfigCode = `// For Expo
- const { getDefaultConfig } = require("expo/metro-config");
- const { withNCoreUIKit } = require("ncore-ui-kit/metro-config");
- const config = getDefaultConfig(__dirname);
- module.exports = withNCoreUIKit(config);`;
- const bareMetroConfigCode = `// For Bare React Native CLI
- const { getDefaultConfig } = require("@react-native/metro-config");
- const { withNCoreUIKit } = require("ncore-ui-kit/metro-config");
- const config = getDefaultConfig(__dirname);
- module.exports = withNCoreUIKit(config);`;
- const defaultWebpackCode = `// webpack.config.js
- const { createDefaultWebpackConfig } = require("ncore-ui-kit/webpack-config");
- module.exports = createDefaultWebpackConfig({
- appDirectory: require("path").resolve(__dirname, "./"),
- HtmlWebpackPlugin: require("html-webpack-plugin"),
- ESLintPlugin: require("eslint-webpack-plugin"),
- CopyPlugin: require("copy-webpack-plugin"),
- webpack: require("webpack")
- });`;
- const wrapWebpackCode = `// webpack.config.js
- const { withNCoreUIKitWebpack } = require("ncore-ui-kit/webpack-config");
- const webpack = require("webpack");
- let config = {
- // ... existing configuration
- };
- module.exports = withNCoreUIKitWebpack(config, webpack);`;
- const envSetupCode = `npx ncore-type-kit`;
- const autoSetupCode = `npx ncore-setup
- # Sadece web için: npx ncore-setup-web
- # Sadece mobil için: npx ncore-setup-mobile`;
- return <PageContainer
- isWorkWithHeaderSpace={false}
- isScrollable={true}
- >
- <View
- style={[
- stylesheet.paddedContainer,
- {
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- style={{
- marginBottom: spaces.spacingMd
- }}
- variant="bodyMediumSize"
- color="mid"
- >
- {localize("implementation-desc")}
- </Text>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- {localize("your-project-main-directory")}/src/index.tsx
- </Text>
- <CodeViewer
- code={exampleCode}
- language="tsx"
- />
- </View>
- <Text
- style={{
- marginBottom: spaces.spacingMd
- }}
- variant="bodyMediumSize"
- color="mid"
- >
- Web (Webpack) ve Mobil (Metro) ayarlarınızı NCore UI Kit ile uyumlu hale getirmek için otomatik kurulum komutlarını kullanabilirsiniz:
- </Text>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- Terminal (Otomatik Yapılandırma)
- </Text>
- <CodeViewer
- code={autoSetupCode}
- language="bash"
- />
- </View>
- <Text
- style={{
- marginBottom: spaces.spacingMd
- }}
- variant="bodyMediumSize"
- color="mid"
- >
- Mobil (React Native / Expo) ortamında kurulum yaparken, otomatik kurulumu tercih etmezseniz metro.config.js dosyanızı NCore UIKit ile manuel sarmalamanız (wrap) gerekir.
- </Text>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- {localize("your-project-main-directory")}/metro.config.js (Expo)
- </Text>
- <CodeViewer
- code={expoMetroConfigCode}
- language="javascript"
- />
- </View>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- {localize("your-project-main-directory")}/metro.config.js (React Native CLI)
- </Text>
- <CodeViewer
- code={bareMetroConfigCode}
- language="javascript"
- />
- </View>
- <Text
- style={{
- marginBottom: spaces.spacingMd
- }}
- variant="bodyMediumSize"
- color="mid"
- >
- Web (React Native Web) ortamında derleme yapmak için, otomatik kurulumu kullanmak yerine NCore'un hazır Webpack ayarını kullanabilir veya mevcut ayarınızı manuel sarmalayabilirsiniz.
- </Text>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- {localize("your-project-main-directory")}/webpack.config.js (Hazır Ayar)
- </Text>
- <CodeViewer
- code={defaultWebpackCode}
- language="javascript"
- />
- </View>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- {localize("your-project-main-directory")}/webpack.config.js (Sarmalama)
- </Text>
- <CodeViewer
- code={wrapWebpackCode}
- language="javascript"
- />
- </View>
- <Text
- style={{
- marginBottom: spaces.spacingMd
- }}
- variant="bodyMediumSize"
- color="mid"
- >
- Geliştirme ortamınızın (ESLint, TS, VSCode vb.) NCore UI Kit ile aynı standartlara sahip olmasını istiyorsanız tek tıkla projenizi yapılandırabilirsiniz:
- </Text>
- <View
- style={[
- stylesheet.borderedCard,
- {
- backgroundColor: colors.content.container.default,
- borderColor: colors.content.border.subtle,
- marginBottom: spaces.spacingMd,
- padding: spaces.spacingMd
- }
- ]}
- >
- <Text
- variant="headlineSmallSize"
- >
- Terminal (Tip ve Lint Ayarları)
- </Text>
- <CodeViewer
- code={envSetupCode}
- language="bash"
- />
- </View>
- <View
- style={[
- stylesheet.rowSpaceBetween,
- {
- marginTop: spaces.spacingMd
- }
- ]}
- >
- <Button
- onPress={() => {
- navigation.navigate("GettingStarted", {
- screen: "Installation"
- });
- }}
- icon={({
- color,
- size
- }) => {
- return <ChevronLeftIcon
- color={colors.content.icon[color]}
- size={size + 3}
- />;
- }}
- title={localize("installation")}
- iconDirection="left"
- />
- <Button
- icon={({
- color,
- size
- }) => {
- return <ChevronRightIcon
- color={colors.content.icon[color]}
- size={size + 3}
- />;
- }}
- onPress={() => {
- navigation.navigate("CoreFeatures", {
- screen: "ToolsUsage"
- });
- }}
- title={localize("coreFeatures")}
- iconDirection="right"
- />
- </View>
- </View>
- </PageContainer>;
- };
- export default Implementation;
|