index.tsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import {
  2. useEffect,
  3. useLayoutEffect
  4. } from "react";
  5. import {
  6. Image,
  7. View
  8. } from "react-native";
  9. import stylesheet from "./stylesheet";
  10. import {
  11. NCoreUIKitLocalize,
  12. NCoreUIKitTheme,
  13. PaletteSwitcher,
  14. NCoreUIKitMenu,
  15. PageContainer,
  16. ThemeSwitcher,
  17. AvatarGroup,
  18. RowCard,
  19. Button,
  20. Avatar,
  21. Text
  22. } from "ncore-ui-kit";
  23. import {
  24. useNavigation
  25. } from "@react-navigation/native";
  26. import type RootStackParamList from "../../navigation/type";
  27. import type {
  28. NativeStackNavigationProp
  29. } from "@react-navigation/native-stack";
  30. import {
  31. ChevronRight
  32. } from "lucide-react-native";
  33. import packageJSON from "../../../../package.json";
  34. const Home = () => {
  35. const {
  36. colors,
  37. spaces
  38. } = NCoreUIKitTheme.useContext();
  39. const {
  40. localize
  41. } = NCoreUIKitLocalize.useContext();
  42. const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
  43. useEffect(() => {
  44. NCoreUIKitMenu.load({
  45. buttons: [{
  46. title: "Ana Sayfa"
  47. }],
  48. id: "test"
  49. });
  50. }, []);
  51. useLayoutEffect(() => {
  52. navigation.setOptions({
  53. headerShown: false
  54. });
  55. }, []);
  56. return <PageContainer
  57. scrollViewStyle={stylesheet.container}
  58. isScrollable={true}
  59. scrollViewProps={{
  60. showsHorizontalScrollIndicator: false,
  61. showsVerticalScrollIndicator: false,
  62. contentContainerStyle: {
  63. backgroundColor: colors.content.container.default,
  64. ...stylesheet.contentContainer
  65. }
  66. }}
  67. >
  68. <Button
  69. title="Open Menu"
  70. onPress={() => {
  71. NCoreUIKitMenu.open({
  72. id: "test"
  73. });
  74. }}
  75. />
  76. <PaletteSwitcher/>
  77. <ThemeSwitcher/>
  78. <View
  79. style={{
  80. justifyContent: "center",
  81. alignItems: "center",
  82. maxWidth: 850,
  83. width: "100%"
  84. }}
  85. >
  86. <Image
  87. source={{
  88. uri: "https://ncore.nibgat.space/assets/images/ncorelogo.png"
  89. }}
  90. style={{
  91. height: 300,
  92. width: 300
  93. }}
  94. />
  95. <Text
  96. variant="displayMediumSize"
  97. style={{
  98. marginBottom: spaces.spacingMd,
  99. textAlign: "center"
  100. }}
  101. >
  102. {localize("ncore-design-system")}
  103. </Text>
  104. <Text
  105. variant="headlineLargeSize"
  106. style={{
  107. marginBottom: spaces.spacingLg,
  108. textAlign: "center"
  109. }}
  110. >
  111. {localize("ui-kit-library")}
  112. </Text>
  113. <Text
  114. variant="bodyLargeSize"
  115. style={{
  116. marginBottom: spaces.spacingMd,
  117. textAlign: "center"
  118. }}
  119. >
  120. {localize("ncore-about")}
  121. </Text>
  122. <Text
  123. color="low"
  124. style={{
  125. marginBottom: spaces.spacingMd
  126. }}
  127. >
  128. {localize("version")}: {packageJSON.version}
  129. </Text>
  130. <RowCard
  131. title={localize("text")}
  132. rightIcon={({
  133. customColor,
  134. color,
  135. size
  136. }) => {
  137. return <ChevronRight
  138. color={customColor ? customColor : colors.content.icon[color]}
  139. size={size}
  140. />;
  141. }}
  142. onPress={() => {
  143. navigation.navigate("TextPage");
  144. }}
  145. />
  146. </View>
  147. </PageContainer>;
  148. };
  149. export default Home;