index.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import {
  2. useLayoutEffect,
  3. useState
  4. } from "react";
  5. import {
  6. View
  7. } from "react-native";
  8. import stylesheet from "./stylesheet";
  9. import {
  10. NCoreUIKitLocalize,
  11. NCoreUIKitTheme,
  12. PageContainer,
  13. CodeViewer,
  14. Seperator,
  15. TextInput,
  16. Header,
  17. Text
  18. } from "ncore-ui-kit";
  19. import {
  20. useNavigation
  21. } from "@react-navigation/native";
  22. import type RootStackParamList from "../../../navigation/type";
  23. import type {
  24. NativeStackNavigationProp
  25. } from "@react-navigation/native-stack";
  26. const SeperatorPage = () => {
  27. const {
  28. radiuses,
  29. borders,
  30. spaces,
  31. colors
  32. } = NCoreUIKitTheme.useContext();
  33. const {
  34. localize
  35. } = NCoreUIKitLocalize.useContext();
  36. const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
  37. const [
  38. title,
  39. setTitle
  40. ] = useState<string>("Or");
  41. useLayoutEffect(() => {
  42. navigation.setOptions({
  43. header: () => <Header
  44. title={localize("seperator-title")}
  45. isWrapSafeareaContext={false}
  46. navigation={navigation}
  47. isGoBackEnable={true}
  48. />,
  49. headerShown: true
  50. });
  51. }, []);
  52. return <PageContainer
  53. scrollViewProps={{
  54. contentContainerStyle: stylesheet.scrollContent
  55. }}
  56. isWorkWithHeaderSpace={false}
  57. scrollViewStyle={[
  58. stylesheet.container
  59. ]}
  60. isScrollable={true}
  61. >
  62. <View
  63. style={[
  64. stylesheet.contentContainer
  65. ]}
  66. >
  67. <Text
  68. style={stylesheet.marginContainer}
  69. variant="bodyMediumSize"
  70. color="mid"
  71. >
  72. {localize("seperator-desc")}
  73. </Text>
  74. <View
  75. style={[
  76. stylesheet.paddedMarginContainer,
  77. {
  78. borderColor: colors.content.border.subtle,
  79. marginBottom: spaces.spacingMd,
  80. borderRadius: radiuses.form,
  81. borderWidth: borders.line,
  82. padding: spaces.spacingMd
  83. }
  84. ]}
  85. >
  86. <Seperator
  87. title={title}
  88. />
  89. </View>
  90. <View
  91. style={{
  92. marginBottom: spaces.spacingMd
  93. }}
  94. >
  95. <Text
  96. style={{
  97. marginBottom: spaces.spacingSm
  98. }}
  99. variant="headlineSmallSize"
  100. >
  101. {localize("usage")}
  102. </Text>
  103. <CodeViewer
  104. code={"import {\n Seperator\n} from \"ncore-ui-kit\";\n\n<Seperator\n title=\"Or\"\n/>"}
  105. language="tsx"
  106. />
  107. </View>
  108. <TextInput
  109. placeholder={localize("seperator-enterTitle")}
  110. title={localize("seperator-titleLabel")}
  111. style={{
  112. marginBottom: spaces.spacingMd
  113. }}
  114. spreadBehaviour="stretch"
  115. onChangeText={setTitle}
  116. value={title}
  117. />
  118. </View>
  119. </PageContainer>;
  120. };
  121. export default SeperatorPage;