Before fixing My Position Marker Display
This commit is contained in:
parent
2d41abca6b
commit
921f8b1a30
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,8 @@
|
|||
"release-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew assembleRelease && cd .. && adb install android/app/build/outputs/apk/release/app-release.apk",
|
||||
"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ && cd android && ./gradlew assembleDebug && cd .. && adb install android/app/build/outputs/apk/debug/app-debug.apk",
|
||||
"start-emulator": "emulator -avd Nexus_6P_API_29 -dns-server 8.8.8.8",
|
||||
"run-android": "cd android && ./gradlew clean && cd .. && react-native run-android"
|
||||
"run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android",
|
||||
"run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/viewpager": "^3.3.0",
|
||||
|
@ -18,7 +19,7 @@
|
|||
"geolib": "^3.0.3",
|
||||
"lottie-ios": "3.1.3",
|
||||
"lottie-react-native": "^3.3.2",
|
||||
"moment-timezone": "^0.5.25",
|
||||
"moment-timezone": "^0.5.28",
|
||||
"react": "16.9.0",
|
||||
"react-native": "0.61.5",
|
||||
"react-native-action-button": "^2.8.5",
|
||||
|
@ -54,7 +55,7 @@
|
|||
"react-native-reanimated": "^1.0.1",
|
||||
"react-native-responsive-dimensions": "^2.0.1",
|
||||
"react-native-screens": "^2.3.0",
|
||||
"react-native-simple-dialogs": "^1.1.0",
|
||||
"react-native-simple-dialogs": "1.2.1",
|
||||
"react-native-snackbar-component": "1.1.8",
|
||||
"react-native-snap-slider": "^0.3.0",
|
||||
"react-native-svg": "^9.5.0",
|
||||
|
|
|
@ -20,7 +20,6 @@ import { IndicatorViewPager, PagerTabIndicator } from 'react-native-best-viewpag
|
|||
import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage } from 'react-native-material-cards'
|
||||
let moment = require('moment-timezone');
|
||||
import 'moment/locale/fr'
|
||||
import 'moment/locale/fr'
|
||||
import 'moment/locale/es-us'
|
||||
import 'moment/locale/en-au'
|
||||
import 'moment/locale/en-ca'
|
||||
|
|
|
@ -16,6 +16,8 @@ import 'moment/locale/en-ie'
|
|||
import 'moment/locale/en-il'
|
||||
import 'moment/locale/en-nz'
|
||||
|
||||
import DeviceInfo from 'react-native-device-info'
|
||||
|
||||
let route = require('./../../route.json');
|
||||
var theme = require('./../../utils/theme.json');
|
||||
|
||||
|
@ -32,7 +34,8 @@ export class HistoryItem extends React.Component {
|
|||
var today = new Date();
|
||||
var l = this.props.selfData.date_creation;
|
||||
let t = this.props.selfData.status;
|
||||
moment.locale(I18n.locale)
|
||||
let currentLocale = (DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : DeviceInfo.getDeviceLocale());
|
||||
moment.locale(currentLocale);
|
||||
var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format();
|
||||
re = moment(re)
|
||||
return {
|
||||
|
|
|
@ -24,11 +24,12 @@ import Button from 'apsl-react-native-button'
|
|||
import { readUser } from "../../webservice/AuthApi";
|
||||
import Calendar from 'react-native-calendario';
|
||||
let route = require('./../../route.json')
|
||||
let moment = require('moment-timezone')
|
||||
import 'moment';
|
||||
import 'moment/locale/fr';
|
||||
import moment from 'moment-timezone';
|
||||
let theme = require('./../../utils/theme.json')
|
||||
import { primary, primaryDark, accent, purpleLight, primaryLight } from './../../utils/theme.json';
|
||||
import { PagerTabIndicator, PagerTitleIndicator, PagerDotIndicator } from 'react-native-best-viewpager'
|
||||
type Props = {};
|
||||
var sortIcons;
|
||||
var sectionIcons;
|
||||
import I18n from 'react-native-i18n'
|
||||
|
@ -286,9 +287,9 @@ class MyHistory extends React.Component {
|
|||
const { routeName } = this.navigation.state
|
||||
this.setState({ position: routeName === "myDemand" ? 0 : 1 })
|
||||
this.refreshData()
|
||||
this.intervaller = setInterval(() => {
|
||||
/* this.intervaller = setInterval(() => {
|
||||
this.refreshData(false)
|
||||
}, 2000)
|
||||
}, 2000) */
|
||||
this.animateSlidingUp(false)
|
||||
this.props.navigation.addListener("didFocus", () => {
|
||||
this.refreshData(false)
|
||||
|
@ -421,6 +422,8 @@ class MyHistory extends React.Component {
|
|||
translucent={false}
|
||||
/>
|
||||
|
||||
{this.renderSliding()}
|
||||
|
||||
<Appbar.Header dark={true} style={{ backgroundColor: theme.primary }}>
|
||||
<Appbar.BackAction
|
||||
onPress={() => { this.props.navigation.pop() }}
|
||||
|
@ -430,7 +433,7 @@ class MyHistory extends React.Component {
|
|||
subtitle={this.state.position === 0 ? I18n.t('MY_DEMAND') : I18n.t('DEMAND_RECEIVE')}
|
||||
/>
|
||||
<Appbar.Action icon="refresh" onPress={() => { this.refreshData() }} />
|
||||
<Appbar.Action icon="more-vert" onPress={() => this._openMenu()} />
|
||||
<Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} />
|
||||
</Appbar.Header>
|
||||
{this.renderOptionsMenu()}
|
||||
|
||||
|
@ -441,7 +444,8 @@ class MyHistory extends React.Component {
|
|||
|
||||
}
|
||||
renderSliding() {
|
||||
return (<Animated.View style={[styles.slidingup, { translateY: this.state.translateAnim }]}>
|
||||
return (
|
||||
<Animated.View style={[styles.slidingup, { translateY: this.state.translateAnim }]}>
|
||||
<Calendar
|
||||
onChange={(range) => console.log(range)}
|
||||
minDate="2018-04-20"
|
||||
|
@ -583,6 +587,7 @@ class MyHistory extends React.Component {
|
|||
)*/
|
||||
}
|
||||
|
||||
/*
|
||||
onfilterPress() {
|
||||
let { datestart, dateend } = this.state;
|
||||
let data = this.state.conserve;
|
||||
|
@ -597,6 +602,7 @@ class MyHistory extends React.Component {
|
|||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
_showDateTimePicker = (type) => {
|
||||
if (type === 1)
|
||||
|
@ -610,6 +616,7 @@ class MyHistory extends React.Component {
|
|||
_showDateEndPicker = () => this.setState({ isDateEndTimePickerVisible: true });
|
||||
|
||||
_hideDateTimePicker = () => this.setState({ isDateTimePickerVisible: false, isDateEndTimePickerVisible: false });
|
||||
/*
|
||||
_handleDatePicked = (fromdate, enddate) => {
|
||||
console.log([fromdate, enddate]);
|
||||
|
||||
|
@ -636,6 +643,7 @@ class MyHistory extends React.Component {
|
|||
|
||||
this._hideDateTimePicker();
|
||||
};
|
||||
*/
|
||||
|
||||
printOptions() {
|
||||
if (this.state.user.category === "hyper") {
|
||||
|
|
|
@ -22,6 +22,8 @@ import BaseScreen from './../BaseScreen'
|
|||
import isEqual from 'lodash/isEqual';
|
||||
import Button from 'apsl-react-native-button'
|
||||
import I18n from 'react-native-i18n'
|
||||
import { IlinkEmitter } from "./../../utils/events"
|
||||
|
||||
|
||||
import Configuration from "../../webservice/persistences/Configuration";
|
||||
import { MaterialDialog } from "react-native-material-dialog";
|
||||
|
@ -594,12 +596,11 @@ class Home extends BaseScreen {
|
|||
//IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
||||
|
||||
};
|
||||
updateLangue() {
|
||||
this.props.navigation.setParams({ name: I18n.t('MAP') })
|
||||
let rand = Math.random()
|
||||
this.setState({ lang: rand })
|
||||
|
||||
}
|
||||
/* updateLangue() {
|
||||
this.props.navigation.setParams({ name: I18n.t('MAP') })
|
||||
this.forceUpdate();
|
||||
} */
|
||||
|
||||
makeCardSearch() {
|
||||
if (!this.state.isPubShow) {
|
||||
|
@ -1087,6 +1088,7 @@ class Home extends BaseScreen {
|
|||
showProgress: false,
|
||||
myNetwork: {},
|
||||
dialogNetworkVisible: false,
|
||||
myPositionMarkerText: I18n.t("YOUR_THERE"),
|
||||
};
|
||||
};
|
||||
onMarkerPress(marker) {
|
||||
|
@ -1201,7 +1203,7 @@ class Home extends BaseScreen {
|
|||
if (Platform.OS === 'android') {
|
||||
this.requestCameraPermission();
|
||||
} else {
|
||||
this.getPosition();
|
||||
//this.getPosition();
|
||||
this.watchLocation();
|
||||
}
|
||||
}
|
||||
|
@ -1424,7 +1426,6 @@ class Home extends BaseScreen {
|
|||
pitch: 0,
|
||||
heading: 0,
|
||||
altitude: 5,
|
||||
|
||||
zoom: 12
|
||||
}, 1000);
|
||||
|
||||
|
@ -1449,7 +1450,7 @@ class Home extends BaseScreen {
|
|||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error.message)
|
||||
console.log("ERROR LOADING USER", error.message);
|
||||
});
|
||||
}
|
||||
renderTutoOldHome() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { PureComponent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import MapView, { Marker, MarkerAnimated } from "react-native-maps"
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
|
@ -6,6 +6,7 @@ import {
|
|||
View,
|
||||
Image,
|
||||
Text,
|
||||
Alert
|
||||
} from 'react-native';
|
||||
const theme = require("../../utils/theme");
|
||||
import { responsiveHeight, responsiveWidth } from "react-native-responsive-dimensions";
|
||||
|
@ -16,8 +17,12 @@ const API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI";
|
|||
const mnetwork = require('./../../datas/img/png/home_network.png');
|
||||
const othernetwork = require('./../../datas/img/png/other_net.png');
|
||||
import { copilot, CopilotStep } from 'react-native-copilot';
|
||||
import { IlinkEmitter } from "./../../utils/events";
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
||||
class IMap extends PureComponent {
|
||||
|
||||
|
||||
class IMap extends Component {
|
||||
static propTypes = {
|
||||
markers: PropTypes.array,
|
||||
map: PropTypes.object,
|
||||
|
@ -45,14 +50,49 @@ class IMap extends PureComponent {
|
|||
markers: [],
|
||||
roadReady: false,
|
||||
isNeedUserFocus: false,
|
||||
positionMarkerText: I18n.t("YOUR_THERE")
|
||||
}
|
||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
|
||||
}
|
||||
|
||||
getPositionMarkerText() {
|
||||
let currentLanguage = I18n.currentLocale();
|
||||
let myPositionMarkerText = null;
|
||||
switch (currentLanguage) {
|
||||
case "fr":
|
||||
myPositionMarkerText = "Vous êtes ici";
|
||||
break;
|
||||
|
||||
case "en":
|
||||
myPositionMarkerText = "Your are here";
|
||||
break;
|
||||
|
||||
default:
|
||||
myPositionMarkerText = I18n.t("YOUR_THERE")
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return myPositionMarkerText;
|
||||
}
|
||||
|
||||
updateLangue() {
|
||||
//Alert.alert("Langue", I18n.currentLocale(), [{ text: "Ok", onPress: () => { } }]);
|
||||
this.setState({ positionMarkerText: this.getPositionMarkerText() })
|
||||
}
|
||||
|
||||
mapRef = (ref) => {
|
||||
this.mapview = ref
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
if (prevState.positionMarkerText !== this.state.positionMarkerText) {
|
||||
this.forceUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
getMapRef = () => this.mapview
|
||||
componentWillReceiveProps(nextProps: Readonly<P>, nextContext: any): void {
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
const markers = this.state.markers
|
||||
const newmarkers = nextProps.markers
|
||||
if (markers.length <= 0)
|
||||
|
@ -136,28 +176,11 @@ class IMap extends PureComponent {
|
|||
renderMyPosition() {
|
||||
const { myPosition, myNetwork } = this.props
|
||||
if (myPosition != null) {
|
||||
if (false) {
|
||||
return (
|
||||
<CopilotStep>
|
||||
<IMarker
|
||||
|
||||
isUser={true}
|
||||
lang={this.props.lang}
|
||||
isNeedFocus={this.state.isNeedUserFocus}
|
||||
title={I18n.t("YOUR_THERE")}
|
||||
data={{
|
||||
longitude: myPosition.longitude,
|
||||
latitude: myPosition.latitude
|
||||
}}
|
||||
/>
|
||||
</CopilotStep>
|
||||
)
|
||||
} else
|
||||
return (<IMarker
|
||||
isUser={true}
|
||||
lang={this.props.lang}
|
||||
isNeedFocus={this.state.isNeedUserFocus}
|
||||
title={I18n.t("YOUR_THERE")}
|
||||
title={this.state.positionMarkerText}
|
||||
data={{
|
||||
longitude: myPosition.longitude,
|
||||
latitude: myPosition.latitude
|
||||
|
@ -167,7 +190,6 @@ class IMap extends PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
export default IMap;
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
|
|
|
@ -77,7 +77,6 @@ class IMarker extends PureComponent {
|
|||
return (
|
||||
<Marker.Animated
|
||||
coordinate={this.state.coordinate.longitude ? this.state.coordinate : { longitude: data.longitude, latitude: data.latitude }}
|
||||
|
||||
id={data.id}
|
||||
title={this.props.title}
|
||||
ref={(re) => {
|
||||
|
@ -106,7 +105,7 @@ class IMarker extends PureComponent {
|
|||
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS): void {
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
if (this.props.isUser)
|
||||
if (this.markerRef && this.props.isNeedFocus) {
|
||||
this.markerRef._component.showCallout()
|
||||
|
|
|
@ -5311,7 +5311,7 @@ mkdirp@^0.5.0, mkdirp@^0.5.1:
|
|||
dependencies:
|
||||
minimist "0.0.8"
|
||||
|
||||
moment-timezone@^0.5.25:
|
||||
moment-timezone@^0.5.28:
|
||||
version "0.5.28"
|
||||
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.28.tgz#f093d789d091ed7b055d82aa81a82467f72e4338"
|
||||
integrity sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==
|
||||
|
@ -6427,7 +6427,7 @@ react-native-screens@^2.3.0:
|
|||
dependencies:
|
||||
debounce "^1.2.0"
|
||||
|
||||
react-native-simple-dialogs@^1.1.0:
|
||||
react-native-simple-dialogs@1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/react-native-simple-dialogs/-/react-native-simple-dialogs-1.2.1.tgz#37f63243b7c91ba303eeb3d8f2ba23eb81fb6926"
|
||||
integrity sha512-oceCB2LCXP0HiIbOvddXIbJr+Cv7xL43U0H3YiySRpMlz/7EWu87mMbTgmfrNbb5uhw+k1tnDuzjqqrArAKy9w==
|
||||
|
|
Loading…
Reference in New Issue