index.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. PaletteSwitcher,
  11. PageContainer,
  12. Header,
  13. Text
  14. } from "ncore-ui-kit";
  15. import {
  16. useNavigation
  17. } from "@react-navigation/native";
  18. import type RootStackParamList from "../../../navigation/type";
  19. import type {
  20. NativeStackNavigationProp
  21. } from "@react-navigation/native-stack";
  22. const PaletteSwitcherPage = () => {
  23. const {
  24. localize
  25. } = NCoreUIKitLocalize.useContext();
  26. const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
  27. useLayoutEffect(() => {
  28. navigation.setOptions({
  29. header: () => <Header
  30. title={localize("components-paletteSwitcher")}
  31. isWrapSafeareaContext={false}
  32. navigation={navigation}
  33. isGoBackEnable={true}
  34. />,
  35. headerShown: true
  36. });
  37. }, []);
  38. return <PageContainer
  39. scrollViewProps={{
  40. contentContainerStyle: stylesheet.scrollContent
  41. }}
  42. scrollViewStyle={[
  43. stylesheet.container
  44. ]}
  45. isWorkWithHeaderSpace={false}
  46. isScrollable={true}
  47. >
  48. <View
  49. style={[
  50. stylesheet.contentContainer
  51. ]}
  52. >
  53. <Text
  54. variant="bodyMediumSize"
  55. color="mid"
  56. style={stylesheet.descText}
  57. >
  58. {localize("paletteSwitcher-desc")}
  59. </Text>
  60. <Text
  61. style={stylesheet.title}
  62. variant="titleMediumSize"
  63. >
  64. {localize("components-paletteSwitcher")}
  65. </Text>
  66. <PaletteSwitcher />
  67. </View>
  68. </PageContainer>;
  69. };
  70. export default PaletteSwitcherPage;