11import React , { Component } from 'react' ;
2- import { ScrollView , StyleSheet } from 'react-native' ;
2+ import { ScrollView , StyleSheet , Share } from 'react-native' ;
33import { observer } from 'mobx-react' ;
44import PropTypes from 'prop-types' ;
55import { SplitBackground } from '../component/background' ;
66import { Header , Title } from '../component/header' ;
77import Text from '../component/text' ;
8- import { Button , BackButton } from '../component/button' ;
8+ import { BackButton , ShareButton } from '../component/button' ;
99import { createStyles , maxWidth } from '../component/media-query' ;
1010import { color , font , breakWidth } from '../component/style' ;
1111
@@ -19,16 +19,31 @@ const styles = StyleSheet.create({
1919 } ,
2020} ) ;
2121
22- const CLIView = ( { store, nav } ) => (
23- < SplitBackground color = { color . blackDark } bottom = { color . cliBackground } >
24- < Header separator style = { styles . header } >
25- < BackButton onPress = { ( ) => nav . goSettings ( ) } />
26- < Title title = "Logs" />
27- < Button disabled onPress = { ( ) => { } } />
28- </ Header >
29- < LogOutput logs = { store . logs } />
30- </ SplitBackground >
31- ) ;
22+ class CLIView extends Component {
23+ render ( ) {
24+ const { store, nav } = this . props ;
25+ return (
26+ < SplitBackground color = { color . blackDark } bottom = { color . cliBackground } >
27+ < Header separator style = { styles . header } >
28+ < BackButton onPress = { ( ) => nav . goSettings ( ) } />
29+ < Title title = "Logs" />
30+ < ShareButton onPress = { ( ) => this . shareLogs ( ) } />
31+ </ Header >
32+ < LogOutput logs = { store . logs } />
33+ </ SplitBackground >
34+ ) ;
35+ }
36+
37+ shareLogs ( ) {
38+ try {
39+ Share . share ( {
40+ message : this . props . store . logs ,
41+ } ) ;
42+ } catch ( err ) {
43+ console . error ( err ) ;
44+ }
45+ }
46+ }
3247
3348CLIView . propTypes = {
3449 store : PropTypes . object . isRequired ,
0 commit comments