index.tsx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import {
  2. useLayoutEffect
  3. } from "react";
  4. import {
  5. View
  6. } from "react-native";
  7. import stylesheet from "./stylesheet";
  8. import {
  9. NCoreUIKitLocalize,
  10. NCoreUIKitTheme,
  11. PageContainer,
  12. CodeViewer,
  13. Button,
  14. Header,
  15. Text
  16. } from "ncore-ui-kit";
  17. import {
  18. useNavigation
  19. } from "@react-navigation/native";
  20. import type RootStackParamList from "../../navigation/type";
  21. import type {
  22. NativeStackNavigationProp
  23. } from "@react-navigation/native-stack";
  24. import {
  25. ChevronRightIcon,
  26. ChevronLeftIcon
  27. } from "lucide-react-native";
  28. const Implementation = () => {
  29. const {
  30. colors,
  31. spaces
  32. } = NCoreUIKitTheme.useContext();
  33. const {
  34. localize
  35. } = NCoreUIKitLocalize.useContext();
  36. const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
  37. useLayoutEffect(() => {
  38. navigation.setOptions({
  39. header: () => <Header
  40. title={localize("implementation-title")}
  41. isWrapSafeareaContext={false}
  42. navigation={navigation}
  43. isGoBackEnable={true}
  44. />,
  45. headerShown: true
  46. });
  47. }, []);
  48. const exampleCode = `import {
  49. type NCoreUIKitConfig,
  50. setupNCoreUIKit,
  51. Host
  52. } from "ncore-ui-kit";
  53. // Kendi temanızı ve dil dosyanızı dahil edin
  54. import defaultLocaleJSON from "./variants/locales/default.json";
  55. import defaultThemeJSON from "./variants/themes/default.json";
  56. // NCore konfigürasyonunu oluşturun
  57. const NCoreConfig: NCoreUIKitConfig = {
  58. projectThemes: defaultThemeJSON as NCoreUIKit.Palette,
  59. initialSelectedGapPropagation: "spacious",
  60. projectLocales: defaultLocaleJSON,
  61. initialSelectedPalette: "nibgat",
  62. initialSelectedTheme: "light"
  63. };
  64. // NCoreUIKitBase nesnesini ayağa kaldırın
  65. const NCoreUIKitBase = setupNCoreUIKit(NCoreConfig);
  66. const App = () => {
  67. return <NCoreUIKitBase.Provider>
  68. <Host name="main-header">
  69. {/* Sayfalarınız veya Navigasyon yapınız burada yer almalı */}
  70. </Host>
  71. </NCoreUIKitBase.Provider>;
  72. };
  73. export default App;`;
  74. return <PageContainer
  75. isWorkWithHeaderSpace={false}
  76. isScrollable={true}
  77. >
  78. <View
  79. style={[
  80. stylesheet.paddedContainer,
  81. {
  82. padding: spaces.spacingMd
  83. }
  84. ]}
  85. >
  86. <Text
  87. variant="bodyMediumSize"
  88. color="mid"
  89. style={{
  90. marginBottom: spaces.spacingMd
  91. }}
  92. >
  93. {localize("implementation-desc")}
  94. </Text>
  95. <View
  96. style={[
  97. stylesheet.borderedCard,
  98. {
  99. backgroundColor: colors.content.container.default,
  100. borderColor: colors.content.border.subtle,
  101. marginBottom: spaces.spacingMd,
  102. padding: spaces.spacingMd
  103. }
  104. ]}
  105. >
  106. <Text
  107. variant="headlineSmallSize"
  108. >
  109. {localize("your-project-main-directory")}/src/index.tsx
  110. </Text>
  111. <CodeViewer
  112. code={exampleCode}
  113. language="tsx"
  114. />
  115. </View>
  116. <View
  117. style={[
  118. stylesheet.rowSpaceBetween,
  119. {
  120. marginTop: spaces.spacingMd
  121. }
  122. ]}
  123. >
  124. <Button
  125. icon={({
  126. color,
  127. size
  128. }) => {
  129. return <ChevronLeftIcon
  130. color={colors.content.icon[color]}
  131. size={size + 3}
  132. />;
  133. }}
  134. title={localize("installation")}
  135. iconDirection="left"
  136. onPress={() => {
  137. navigation.navigate("GettingStarted", {
  138. screen: "Installation"
  139. });
  140. }}
  141. />
  142. <Button
  143. icon={({
  144. color,
  145. size
  146. }) => {
  147. return <ChevronRightIcon
  148. color={colors.content.icon[color]}
  149. size={size + 3}
  150. />;
  151. }}
  152. title={localize("coreFeatures")}
  153. iconDirection="right"
  154. onPress={() => {
  155. navigation.navigate("CoreFeatures", {
  156. screen: "ToolsUsage"
  157. });
  158. }}
  159. />
  160. </View>
  161. </View>
  162. </PageContainer>;
  163. };
  164. export default Implementation;