diff --git a/mobile/src/Auth/DefaultRoute.js b/mobile/src/Auth/DefaultRoute.js index 43027b5..6735acf 100644 --- a/mobile/src/Auth/DefaultRoute.js +++ b/mobile/src/Auth/DefaultRoute.js @@ -3,5 +3,5 @@ import { Route, Redirect } from "react-router-native" export const DefaultRoute = () => { // NOTE: When working on the app, change this to the page you are working on - return } /> + return } /> } diff --git a/mobile/src/config.js b/mobile/src/config.js index 60e58c2..4fdad07 100644 --- a/mobile/src/config.js +++ b/mobile/src/config.js @@ -7,25 +7,25 @@ export const config = { googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI", googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json", refererURL: "https://dar.kss.us.com", - //defaultUser: "john@lyon-smith.org", - defaultUser: "", + defaultUser: "john@lyon-smith.org", + // defaultUser: "", minGPSAccuracy: 100, //minGPSAccuracy: 20, minDistanceToItem: 10, geocodeDelayMilliseconds: 500, // This region is downtown Toronto - initialRegion: { - latitude: 43.653908, - longitude: -79.384293, - latitudeDelta: 0.0922, - longitudeDelta: 0.0421, - }, - // This region is Bainbridge Island // initialRegion: { - // latitude: 47.629536, - // longitude: -122.524162, + // latitude: 43.653908, + // longitude: -79.384293, // latitudeDelta: 0.0922, // longitudeDelta: 0.0421, // }, + // This region is Bainbridge Island + initialRegion: { + latitude: 47.629536, + longitude: -122.524162, + latitudeDelta: 0.0922, + longitudeDelta: 0.0421, + }, alwaysShowWorkItemInAR: true, } diff --git a/mobile/src/ui/BoundPhotoPanel.js b/mobile/src/ui/BoundPhotoPanel.js index 93494be..678e303 100644 --- a/mobile/src/ui/BoundPhotoPanel.js +++ b/mobile/src/ui/BoundPhotoPanel.js @@ -23,6 +23,8 @@ const getScreenPortraitDimensions = () => { } } +const photoSpacing = 10 + export class BoundPhotoPanel extends Component { static propTypes = { onUploadStarted: PropTypes.func, @@ -88,15 +90,25 @@ export class BoundPhotoPanel extends Component { ) } - render() { - const { screenWidth, screenHeight } = getScreenPortraitDimensions() - const photoWidth = screenHeight / 4 - const photoHeight = screenWidth / 4 - const rowPadding = 10 - const { value: assetIds } = this.state + @autobind + handleLayout(e) { + if (!this.state.photoSize) { + const { layout } = e.nativeEvent + const { screenWidth, screenHeight } = getScreenPortraitDimensions() + const ratio = screenWidth / screenHeight + const width = (layout.width - photoSpacing) / 2 + const height = width / ratio - const renderPhoto = (index) => { + this.setState({ photoSize: { width, height } }) + } + } + + render() { + const { photoSize, value: assetIds } = this.state + + const renderPhoto = (index, size, paddingRight) => { const assetId = assetIds[index] + const { photoSize } = this.state if (assetId) { console.log(api.makeImageUrl(assetId)) @@ -106,8 +118,9 @@ export class BoundPhotoPanel extends Component { + }} + onLayout={this.handleLayout}> Pictures: - - {renderPhoto(0)} - {renderPhoto(1)} - - - {renderPhoto(2)} - {renderPhoto(3)} - + {photoSize && ( + + {renderPhoto(0, photoSize, photoSpacing)} + {renderPhoto(1, photoSize)} + + )} + {photoSize && ( + + {renderPhoto(2, photoSize, photoSpacing)} + {renderPhoto(3, photoSize)} + + )} ) } @@ -165,5 +177,7 @@ const styles = StyleSheet.create({ flexDirection: "row", justifyContent: "space-between", width: "100%", + paddingTop: 5, + paddingBottom: 5, }, })