-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebToolbar.tsx
53 lines (51 loc) · 1.5 KB
/
WebToolbar.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
52
53
import { Image, TouchableOpacity, View } from "react-native";
import {
useBridgeState,
DEFAULT_TOOLBAR_ITEMS,
type EditorBridge,
} from "@10play/tentap-editor";
export const WebToolbar = ({ editor }: { editor: EditorBridge }) => {
const editorState = useBridgeState(editor);
const args: any = {
editor,
editorState,
};
return (
<View style={{ flexDirection: "row" }}>
{DEFAULT_TOOLBAR_ITEMS.map(({ onPress, disabled, active, image }, i) => {
return (
<TouchableOpacity
onPress={onPress(args)}
disabled={disabled(args)}
style={[editor.theme.toolbar.toolbarButton]}
key={i}
>
<View
style={[
editor.theme.toolbar.iconWrapper,
active(args)
? editor.theme.toolbar.iconWrapperActive
: undefined,
disabled(args)
? editor.theme.toolbar.iconWrapperDisabled
: undefined,
]}
>
<Image
source={image(args)}
style={[
editor.theme.toolbar.icon,
active(args) ? editor.theme.toolbar.iconActive : undefined,
disabled(args)
? editor.theme.toolbar.iconDisabled
: undefined,
]}
resizeMode="contain"
/>
</View>
</TouchableOpacity>
);
})}
</View>
);
};