index.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import {
  2. useRef
  3. } from "react";
  4. import {
  5. View
  6. } from "react-native";
  7. import stylesheet from "./stylesheet";
  8. import {
  9. type IBottomSheetRef,
  10. getNCoreUIKitVersion,
  11. NCoreUIKitTheme,
  12. BottomSheet,
  13. TextInput,
  14. SelectBox,
  15. Button,
  16. Text
  17. } from "ncore-ui-kit-mobile";
  18. import {
  19. useNavigation
  20. } from "@react-navigation/native";
  21. const X = [{
  22. t: "x",
  23. p: "y",
  24. n: 90
  25. }];
  26. const Home = () => {
  27. const {
  28. colors
  29. } = NCoreUIKitTheme.useContext();
  30. const bottomSheetRef = useRef<IBottomSheetRef>(null);
  31. const navigation = useNavigation();
  32. return <View
  33. style={[
  34. stylesheet.container,
  35. {
  36. backgroundColor: colors.content.container.default
  37. }
  38. ]}
  39. >
  40. <SelectBox
  41. keyExtractor={(data, index) => `${data.t}-${index}`}
  42. titleExtractor={(data) => data.t}
  43. subTitle="Deneme Subtitle"
  44. hintText="Test deneme"
  45. isShowSubTitle={true}
  46. initialSelectedItems={[{
  47. __title: X[0]?.t as string,
  48. __key: `${X[0]?.t}-0`,
  49. __originalIndex: 0
  50. }]}
  51. title="Deneme Box"
  52. isRequired={true}
  53. data={X}
  54. />
  55. <TextInput
  56. variant="hidden"
  57. />
  58. <Text>Version: v{getNCoreUIKitVersion()}</Text>
  59. <Button
  60. onPress={() => {
  61. navigation.navigate("TestSubPage");
  62. }}
  63. type="success"
  64. title="Open Test Sub Page"
  65. variant="filled"
  66. />
  67. <Button
  68. onPress={() => {
  69. bottomSheetRef.current?.open();
  70. }}
  71. type="success"
  72. title="Open BottomSheet"
  73. variant="filled"
  74. />
  75. <BottomSheet
  76. isWorkAsFullScreen={true}
  77. ref={bottomSheetRef}
  78. renderHeader={() => {
  79. return <View
  80. style={[
  81. {
  82. backgroundColor: "blue",
  83. padding: 20
  84. }
  85. ]}
  86. >
  87. <Text>Burası header.</Text>
  88. </View>;
  89. }}
  90. // snapPoint={300}
  91. key="ahmet"
  92. >
  93. <Button
  94. onPress={() => {
  95. navigation.navigate("TestSubPage");
  96. }}
  97. title="Git."
  98. />
  99. <View
  100. style={{
  101. backgroundColor: "red",
  102. height: 2400
  103. }}
  104. />
  105. <Text>Deneme 123</Text>
  106. <Text>Deneme 123</Text>
  107. <Text>Deneme 123</Text>
  108. <Text>Deneme 123</Text>
  109. <Text>Deneme 123</Text>
  110. <Text>Deneme 123</Text>
  111. <Text>Deneme 123</Text>
  112. </BottomSheet>
  113. </View>;
  114. };
  115. export default Home;