| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import {
- useLayoutEffect
- } from "react";
- import {
- View
- } from "react-native";
- import stylesheet from "./stylesheet";
- import {
- NCoreUIKitLocalize,
- NCoreUIKitTheme,
- MarkdownEditor,
- PageContainer,
- CodeViewer,
- Header,
- Text
- } from "ncore-ui-kit";
- import {
- useNavigation
- } from "@react-navigation/native";
- import type RootStackParamList from "../../../navigation/type";
- import type {
- NativeStackNavigationProp
- } from "@react-navigation/native-stack";
- const MarkdownEditorPage = () => {
- const {
- spaces
- } = NCoreUIKitTheme.useContext();
- const {
- localize
- } = NCoreUIKitLocalize.useContext();
- const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
- useLayoutEffect(() => {
- navigation.setOptions({
- header: () => <Header
- title={localize("markdownEditor-title")}
- isWrapSafeareaContext={false}
- navigation={navigation}
- isGoBackEnable={true}
- />,
- headerShown: true
- });
- }, []);
- return <PageContainer
- scrollViewProps={{
- contentContainerStyle: stylesheet.scrollContent
- }}
- isWorkWithHeaderSpace={false}
- scrollViewStyle={[
- stylesheet.container
- ]}
- isScrollable={true}
- >
- <View
- style={[
- stylesheet.contentContainer
- ]}
- >
- <Text
- style={stylesheet.marginContainer}
- variant="bodyMediumSize"
- color="mid"
- >
- {localize("markdownEditor-desc")}
- </Text>
- <View
- style={{
- marginBottom: spaces.spacingMd
- }}
- >
- <Text
- style={{
- marginBottom: spaces.spacingSm
- }}
- variant="headlineSmallSize"
- >
- {localize("usage") || "Usage"}
- </Text>
- <CodeViewer
- code={"import {\n MarkdownEditor\n} from \"ncore-ui-kit\";\n\n<MarkdownEditor\n initialValue=\"# Hello\"\n/>"}
- language="tsx"
- />
- </View>
- <MarkdownEditor
- initialValue="# Markdown Editor\n\nThis is a **MarkdownEditor** component from *NCore UI Kit*.\n\n- Write your markdown here."
- style={stylesheet.editor}
- />
- </View>
- </PageContainer>;
- };
- export default MarkdownEditorPage;
|