Add screenshot of increasing precision to tips page

This commit is contained in:
Tanner Collin 2017-02-07 00:46:19 -07:00
parent ab9af756a4
commit 04bd63b273
5 changed files with 4613 additions and 62 deletions

4530
imagesrc/tips4.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 334 KiB

View File

@ -1,5 +1,5 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {Dimensions, Image, ScrollView, StyleSheet, View, TouchableOpacity} from 'react-native'; import {ScrollView, StyleSheet, View, TouchableOpacity} from 'react-native';
import MyText from './mytext.js'; import MyText from './mytext.js';
import MyImage from './myimage.js'; import MyImage from './myimage.js';
@ -55,10 +55,11 @@ export default class Example extends Component {
const {viewInfo} = this.state; const {viewInfo} = this.state;
return ( return (
<ScrollView>
<View onLayout={(event) => this.setState({ <View onLayout={(event) => this.setState({
viewInfo: event.nativeEvent, viewInfo: event.nativeEvent,
})} style={{padding: 20}}> })}>
<ScrollView>
<View style={{padding: 20}}>
<Section> <Section>
<MyText>Suppose our design calls for an 863 resistance. First, we enter 863 into the top field:</MyText> <MyText>Suppose our design calls for an 863 resistance. First, we enter 863 into the top field:</MyText>
<MyImage view={viewInfo} data={images.img1} /> <MyImage view={viewInfo} data={images.img1} />
@ -89,6 +90,7 @@ export default class Example extends Component {
</Section> </Section>
</View> </View>
</ScrollView> </ScrollView>
</View>
); );
} }
} }

View File

@ -1,5 +1,5 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {Dimensions, Image, Text, View} from 'react-native'; import {Image, Text, View} from 'react-native';
export default class MyImage extends Component { export default class MyImage extends Component {
constructor(props) { constructor(props) {
@ -10,17 +10,20 @@ export default class MyImage extends Component {
const {view, data} = this.props; const {view, data} = this.props;
if (view.layout) { if (view.layout) {
const maxHeight = view.layout.height * 0.8; const maxHeight = view.layout.height * 0.4;
const maxWidth = view.layout.width * 0.9; const maxWidth = view.layout.width * 0.9;
// What the width will be if the responsive limit kicks in
const widthResp = view.layout.width * 0.6;
const aspectRatio = data.width / data.height; const aspectRatio = data.width / data.height;
let setWidth = maxWidth; let setWidth = maxWidth;
let setHeight = maxWidth / aspectRatio; let setHeight = maxWidth / aspectRatio;
if (setHeight > maxHeight) { if (setHeight > maxHeight) {
setHeight = maxHeight; setWidth = widthResp;
setWidth = setHeight * aspectRatio; setHeight = setWidth / aspectRatio;
} }
return ( return (
@ -44,6 +47,3 @@ export default class MyImage extends Component {
} }
} }
} }

View File

@ -2,15 +2,32 @@ import React, {Component} from 'react';
import {ScrollView, View} from 'react-native'; import {ScrollView, View} from 'react-native';
import MyText from './mytext.js'; import MyText from './mytext.js';
import MyImage from './myimage.js';
import Section from './section.js'; import Section from './section.js';
const images = {
img4: {
source: require('../images/tips4.png'),
width: 1857,
height: 1016,
},
};
export default class Tips extends Component { export default class Tips extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {
viewInfo: {},
};
} }
render() { render() {
const {viewInfo} = this.state;
return ( return (
<View onLayout={(event) => this.setState({
viewInfo: event.nativeEvent,
})}>
<ScrollView> <ScrollView>
<View style={{padding: 20}}> <View style={{padding: 20}}>
<Section> <Section>
@ -28,9 +45,11 @@ export default class Tips extends Component {
<Section> <Section>
<MyText style={{fontWeight: 'bold'}}>Increase precision by adding significant figures</MyText> <MyText style={{fontWeight: 'bold'}}>Increase precision by adding significant figures</MyText>
<MyText>You can increase the precision of the calculations shown by the app by adding more significant figures to your target resistance. This way you can make your solution as precise as you need.</MyText> <MyText>You can increase the precision of the calculations shown by the app by adding more significant figures to your target resistance. This way you can make your solution as precise as you need.</MyText>
<MyImage view={viewInfo} data={images.img4} />
</Section> </Section>
</View> </View>
</ScrollView> </ScrollView>
</View>
); );
} }
} }

BIN
src/images/tips4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB