Skip to content

Commit

Permalink
WIP: more experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed Oct 20, 2017
1 parent 34dd235 commit 19c3bb0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ when(
() => model.connected && model.profile && model.profile.handle,
() => {
setTimeout(() => {
// Actions.botDetails({item: 'a8bde3a6-9eff-11e7-8a33-0a580a020198'});
Actions.botDetails({item: '8bfee86e-9d1a-11e7-bd78-0a580a020377'});
// Actions.subscribers({item: 'd1b08da4-3429-11e7-93e4-0e78520e044a'});
// Actions.botShareSelectFriends({item: '9b2a4590-8e7e-11e7-8720-0eea5386eb69'});
// setTimeout(() => Actions.botPhotoSwiper({item: 'aa567e14-5795-11e7-9926-0e78520e044a', index: 1}), 1000);
Expand Down
27 changes: 25 additions & 2 deletions src/components/BotDetails/BotDetailsHeader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import React from 'react';
import {View, Text, Animated, Alert, TouchableWithoutFeedback, Image, StyleSheet} from 'react-native';
import {View, Text, Animated, Alert, TouchableOpacity, TouchableWithoutFeedback, Image, StyleSheet} from 'react-native';
import {observable} from 'mobx';
import Popover from 'react-native-popover';
import {observer} from 'mobx-react/native';
Expand All @@ -15,6 +15,7 @@ import UserInfoRow from './UserInfoRow';
import Bot from '../../model/Bot';
import {RText} from '../common';
import Map from '../Map';
import MapView from 'react-native-maps';

type Props = {
botId: string,
Expand Down Expand Up @@ -46,6 +47,7 @@ class BotDetailsHeader extends React.Component {
isVisible: false,
fadeAnim: new Animated.Value(0),
buttonRect: {},
fullMap: false,
};
}

Expand Down Expand Up @@ -107,7 +109,28 @@ class BotDetailsHeader extends React.Component {
return (
<View style={{flex: 1}}>
<View style={{height: width, backgroundColor: 'white'}}>
<Map location={bot.location} showOnlyBot />
<Map
location={bot.location}
showOnlyBot
scrollEnabled={this.state.fullMap}
rotateEnabled={this.state.fullMap}
pitchEnabled={this.state.fullMap}
marker={this.state.fullMap ? null :
<TouchableWithoutFeedback onPress={() => this.setState({fullMap: true})}>
<View style={{
height: width,
width,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'transparent',
}}>
<TouchableWithoutFeedback onPress={() => alert('!')}>
<View style={{height: 70, width: 70, backgroundColor: 'red'}}/>
</TouchableWithoutFeedback>
</View>
</TouchableWithoutFeedback>
}
/>
{/*<TouchableWithoutFeedback onPress={this.handleImagePress}>*/}
{/*{bot.image && bot.image.source ? (*/}
{/*<Image style={{height: width, width}} resizeMode='contain' source={bot.image.source} />*/}
Expand Down
10 changes: 6 additions & 4 deletions src/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ export default class Map extends Component {
ref={(map) => {
this._map = map;
}}
provider='google'
style={styles.container}
onRegionChangeComplete={this.onRegionDidChange}
onMarkerPress={this.onOpenAnnotation}
Expand All @@ -212,7 +211,7 @@ export default class Map extends Component {
</View>
</MapView.Marker>
)}
{list
{!this.props.maker && list
.filter(bot => (!this.props.showOnlyBot || this.props.bot.id === bot.id) && bot.location)
.map(bot => (
<MapView.Marker
Expand All @@ -224,8 +223,11 @@ export default class Map extends Component {
/>
))
}
{this.props.marker && <MapView.Marker identifier='marker' anchor={{x: 0.5, y: 0.5}} coordinate={{latitude: this.props.location.latitude, longitude: this.props.location.longitude}}>
{this.props.marker}
</MapView.Marker>}
</MapView>
<TouchableOpacity
{!this.props.marker && <TouchableOpacity
onPress={this.onCurrentLocation}
style={{
position: 'absolute',
Expand All @@ -236,7 +238,7 @@ export default class Map extends Component {
}}
>
<Image source={require('../../images/iconCurrentLocation.png')} />
</TouchableOpacity>
</TouchableOpacity>}
{this.props.children}
<OwnMessageBar ref='alert' />
</View>
Expand Down

0 comments on commit 19c3bb0

Please sign in to comment.