Commit f5802acb by Tonk

add share by qrcode

parent 84273d69
...@@ -12,15 +12,18 @@ import { TouchableNativeFeedback, TouchableOpacity } from 'react-native-gesture- ...@@ -12,15 +12,18 @@ import { TouchableNativeFeedback, TouchableOpacity } from 'react-native-gesture-
import QRCodeScanner from 'react-native-qrcode-scanner'; import QRCodeScanner from 'react-native-qrcode-scanner';
class CameraScreen extends Component { class CameraScreen extends Component {
static navigationOptions = ({ navigation }) => ({ static navigationOptions = ({ navigation }) => {
title: 'Home', const header = navigation.getParam('header');
headerLeft: null, return {
headerRight: ( title: header,
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}> headerLeft: null,
<Item title="close" iconName="ios-close" onPress={() => navigation.pop()} /> headerRight: (
</HeaderButtons> <HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
), <Item title="close" iconName="ios-close" onPress={() => navigation.pop()} />
}); </HeaderButtons>
),
};
};
state = { state = {
scanned: false, scanned: false,
......
import React from 'react'; import React from 'react';
import { Text, Icon, Footer } from 'native-base'; import { Text, Icon } from 'native-base';
import { TouchableOpacity, View, StyleSheet } from 'react-native'; import { TouchableOpacity, View, StyleSheet } from 'react-native';
import { ScrollView, FlatList } from 'react-native-gesture-handler'; import { ScrollView, FlatList } from 'react-native-gesture-handler';
import { theme, color } from '../../../constants/Styles'; import { theme, color } from '../../../constants/Styles';
...@@ -9,7 +9,6 @@ import * as shape from 'd3-shape'; ...@@ -9,7 +9,6 @@ import * as shape from 'd3-shape';
import { format, parse } from 'date-fns'; import { format, parse } from 'date-fns';
import { Circle } from 'react-native-svg'; import { Circle } from 'react-native-svg';
import Tooltip from './Tooltip'; import Tooltip from './Tooltip';
import moment from 'moment';
// mock data // mock data
const data = require('./history.json'); const data = require('./history.json');
...@@ -48,7 +47,7 @@ export default class HistoryScreen extends React.Component { ...@@ -48,7 +47,7 @@ export default class HistoryScreen extends React.Component {
}); });
} }
render() { render() {
const { graphType, data, data2, tooltipX, tooltipY, tooltipIndex } = this.state; const { graphType, data, tooltipX, tooltipY, tooltipIndex } = this.state;
const ChartPoints = ({ x, y, color }) => const ChartPoints = ({ x, y, color }) =>
data.map((item, index) => ( data.map((item, index) => (
......
...@@ -183,7 +183,10 @@ class SettingScreen extends React.Component { ...@@ -183,7 +183,10 @@ class SettingScreen extends React.Component {
underlayColor="transparent" underlayColor="transparent"
onHideUnderlay={() => this.setState({ pressQr: false })} onHideUnderlay={() => this.setState({ pressQr: false })}
onShowUnderlay={() => this.setState({ pressQr: true })} onShowUnderlay={() => this.setState({ pressQr: true })}
onPress={() => console.log('press')} onPress={() => {
this.props.navigation.navigate('Camera', { header: 'Share' });
this.setState({ isVisible: false, pressQr: false });
}}
> >
<View <View
style={[ style={[
......
...@@ -15,7 +15,11 @@ class SmartMeterScreen extends PureComponent { ...@@ -15,7 +15,11 @@ class SmartMeterScreen extends PureComponent {
title: 'Home', title: 'Home',
headerRight: ( headerRight: (
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}> <HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
<Item title="menu" iconName="ios-add" onPress={() => navigation.navigate('Camera')} /> <Item
title="menu"
iconName="ios-add"
onPress={() => navigation.navigate('Camera', { header: 'Home' })}
/>
</HeaderButtons> </HeaderButtons>
), ),
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment