Commit f5802acb by Tonk

add share by qrcode

parent 84273d69
......@@ -12,15 +12,18 @@ import { TouchableNativeFeedback, TouchableOpacity } from 'react-native-gesture-
import QRCodeScanner from 'react-native-qrcode-scanner';
class CameraScreen extends Component {
static navigationOptions = ({ navigation }) => ({
title: 'Home',
static navigationOptions = ({ navigation }) => {
const header = navigation.getParam('header');
return {
title: header,
headerLeft: null,
headerRight: (
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
<Item title="close" iconName="ios-close" onPress={() => navigation.pop()} />
</HeaderButtons>
),
});
};
};
state = {
scanned: false,
......
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 { ScrollView, FlatList } from 'react-native-gesture-handler';
import { theme, color } from '../../../constants/Styles';
......@@ -9,7 +9,6 @@ import * as shape from 'd3-shape';
import { format, parse } from 'date-fns';
import { Circle } from 'react-native-svg';
import Tooltip from './Tooltip';
import moment from 'moment';
// mock data
const data = require('./history.json');
......@@ -48,7 +47,7 @@ export default class HistoryScreen extends React.Component {
});
}
render() {
const { graphType, data, data2, tooltipX, tooltipY, tooltipIndex } = this.state;
const { graphType, data, tooltipX, tooltipY, tooltipIndex } = this.state;
const ChartPoints = ({ x, y, color }) =>
data.map((item, index) => (
......
......@@ -183,7 +183,10 @@ class SettingScreen extends React.Component {
underlayColor="transparent"
onHideUnderlay={() => this.setState({ pressQr: false })}
onShowUnderlay={() => this.setState({ pressQr: true })}
onPress={() => console.log('press')}
onPress={() => {
this.props.navigation.navigate('Camera', { header: 'Share' });
this.setState({ isVisible: false, pressQr: false });
}}
>
<View
style={[
......
......@@ -15,7 +15,11 @@ class SmartMeterScreen extends PureComponent {
title: 'Home',
headerRight: (
<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>
),
});
......
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