-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathTextShortcutsEditor.tsx
More file actions
39 lines (36 loc) · 1.12 KB
/
Copy pathTextShortcutsEditor.tsx
File metadata and controls
39 lines (36 loc) · 1.12 KB
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
import { EnrichedTextInput } from 'react-native-enriched-html';
import type { EnrichedTextInputInstance } from 'react-native-enriched-html';
import { useRef } from 'react';
import { View, StyleSheet } from 'react-native';
import { htmlStyle } from './htmlStyle';
export default function App() {
const ref = useRef<EnrichedTextInputInstance>(null);
return (
<View style={styles.container}>
<EnrichedTextInput
ref={ref}
style={styles.input}
htmlStyle={htmlStyle}
// Two shortcuts, one of each kind:
// - '# ' at the start of a paragraph turns the line into an H1 (paragraph style)
// - '**text**' wraps the delimited text in bold (inline style)
textShortcuts={[
{ trigger: '# ', style: 'h1' },
{ trigger: '**', style: 'bold' },
]}
placeholder="Try '# ' at the line start, or wrap a word in **stars**..."
/>
</View>
);
}
const styles = StyleSheet.create({
container: { gap: 12 },
input: {
fontSize: 18,
color: '#232736',
padding: 12,
borderRadius: 12,
minHeight: 96,
backgroundColor: '#eef0ff',
},
});