-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
51 lines (45 loc) · 1.08 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import {
SafeAreaView,
KeyboardAvoidingView,
Platform,
StyleSheet,
} from "react-native";
import { RichText, Toolbar, useEditorBridge } from "@10play/tentap-editor";
const App = () => {
const editor = useEditorBridge({
autofocus: true,
avoidIosKeyboard: true,
initialContent,
});
if (Platform.OS === "web") {
return (
<SafeAreaView style={exampleStyles.fullScreen}>
<Toolbar editor={editor} />
<RichText editor={editor} />
</SafeAreaView>
);
}
return (
<SafeAreaView style={exampleStyles.fullScreen}>
<RichText editor={editor} />
<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
style={exampleStyles.keyboardAvoidingView}
>
<Toolbar editor={editor} />
</KeyboardAvoidingView>
</SafeAreaView>
);
};
const exampleStyles = StyleSheet.create({
fullScreen: {
flex: 1,
},
keyboardAvoidingView: {
position: "absolute",
width: "100%",
bottom: 0,
},
});
const initialContent = `<p>This is a basic example!</p>`;
export default App;