This repository was archived by the owner on Aug 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
executable file
·65 lines (57 loc) · 1.52 KB
/
App.js
File metadata and controls
executable file
·65 lines (57 loc) · 1.52 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import React from 'react';
import { StyleSheet, Text, View, WebView } from 'react-native';
import { Container, Header, Content, Tab, Tabs, Textarea } from 'native-base';
import { Font } from 'expo';
import Settings from './components/Settings';
import showdown from 'showdown';
export default class App extends React.Component {
state = {
markdown: '# hello, markdown!',
fontLoaded: false
}
constructor(props) {
super(props);
this.converter = new showdown.Converter();
}
async componentDidMount() {
await Font.loadAsync({
'Ionicons': require('./node_modules/native-base/Fonts/Ionicons.ttf')
});
this.setState({fontLoaded: true});
}
render() {
return (
<Container>
<Header hasTabs />
<Tabs>
<Tab heading="Editor">
<Textarea
rowSpan={20} bordered
onChangeText={(markdown) => this.setState({markdown})}
value={this.state.markdown}
style={styles.textarea}
/>
</Tab>
<Tab heading="Preview">
<WebView
style={styles.preview}
originWhitelist={['*']}
source={{ html: this.converter.makeHtml(this.state.markdown) }}
/>
</Tab>
<Tab heading="Settings">
<Settings />
</Tab>
</Tabs>
</Container>
);
}
}
const styles = StyleSheet.create({
textarea: {},
preview: {
margin: 10,
height: 200,
backgroundColor: '#e3e53f'
}
});