resolving issue about focus on map at first loading
This commit is contained in:
parent
483283a574
commit
2d41abca6b
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,10 @@
|
|||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||
"test": "jest",
|
||||
"postinstall": "node ./fix-android/android-release-fix.js",
|
||||
"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 ..",
|
||||
"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 .."
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/viewpager": "^3.3.0",
|
||||
|
|
|
@ -172,13 +172,14 @@ class Home extends BaseScreen {
|
|||
|
||||
}
|
||||
})
|
||||
this.componentDidAppear();
|
||||
|
||||
this.componentDidAppear()
|
||||
});
|
||||
this.blurListener = navigation.addListener("didBlur", (payload) => {
|
||||
this.componentDidDisappear()
|
||||
})
|
||||
this._retrieveData()
|
||||
|
||||
//this.toggleSlidingUp(false)
|
||||
if (this.props.coordinate) return;
|
||||
|
||||
|
@ -196,6 +197,7 @@ class Home extends BaseScreen {
|
|||
)
|
||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||
readUser().then((user) => {
|
||||
console.log("MAP READY");
|
||||
if (user) {
|
||||
if (user.category !== undefined && user.category !== null) {
|
||||
const myPosition = {
|
||||
|
@ -227,7 +229,7 @@ class Home extends BaseScreen {
|
|||
}
|
||||
|
||||
} else {
|
||||
this.getPosition()
|
||||
this.getPosition();
|
||||
this.watchLocation();
|
||||
}
|
||||
}
|
||||
|
@ -417,8 +419,6 @@ class Home extends BaseScreen {
|
|||
if (i.code === shortcountry) {
|
||||
this.setState({ indicatif: i.dial_code })
|
||||
this.getNetworks(i.dial_code)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,6 +524,7 @@ class Home extends BaseScreen {
|
|||
readUser().then((user) => {
|
||||
if (user) {
|
||||
if (user.category) {
|
||||
|
||||
this.setState({ user: user })
|
||||
this.setState({ network: user.network });
|
||||
|
||||
|
@ -538,11 +539,10 @@ class Home extends BaseScreen {
|
|||
latitudeDelta: 0.03,
|
||||
longitudeDelta: 0.01,
|
||||
}
|
||||
|
||||
this.setState({ myPosition: myPosition });
|
||||
this.refocusMap(false);
|
||||
}
|
||||
if (this.state.myPosition)
|
||||
this.refocusMap()
|
||||
|
||||
/*if (Platform.OS === 'android') {
|
||||
// this.requestCameraPermission();
|
||||
} else {
|
||||
|
@ -1182,10 +1182,12 @@ class Home extends BaseScreen {
|
|||
lang={this.state.lang}
|
||||
myPosition={this.state.myPosition}
|
||||
onMapReady={() => {
|
||||
|
||||
readUser().then((user) => {
|
||||
if (user) {
|
||||
this.setState({ user: user })
|
||||
this.setState({ network: user.network });
|
||||
|
||||
if (user.category) {
|
||||
this.setState({ loadingDialog: false })
|
||||
if (user.category !== "geolocated") {
|
||||
|
@ -1376,33 +1378,8 @@ class Home extends BaseScreen {
|
|||
myNetwork={this.state.myNetwork}
|
||||
lang={this.state.lang}
|
||||
myPosition={this.state.myPosition}
|
||||
onMapReady={() => {
|
||||
readUser().then((user) => {
|
||||
if (user) {
|
||||
this.setState({ user: user })
|
||||
this.setState({ network: user.network });
|
||||
if (user.category) {
|
||||
this.setState({ loadingDialog: false })
|
||||
if (user.category !== "geolocated") {
|
||||
this.showMyMembers();
|
||||
} else {
|
||||
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) {
|
||||
this.props.navigation.push(route.updateinfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Platform.OS === 'android') {
|
||||
this.requestCameraPermission();
|
||||
} else {
|
||||
this.getPosition();
|
||||
this.watchLocation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}}
|
||||
onMapReady={Platform.OS === 'android' ? this.onMapReady : null}
|
||||
onLayout={Platform.OS === 'ios' ? this.onMapReady : null}
|
||||
needRoad={this.state.needRoad}
|
||||
onNeedRoadReady={(data) => {
|
||||
this.setState({ showProgress: false })
|
||||
|
@ -1426,6 +1403,55 @@ class Home extends BaseScreen {
|
|||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
onMapReady = () => {
|
||||
|
||||
readUser().then((user) => {
|
||||
if (user) {
|
||||
this.setState({ user: user })
|
||||
this.setState({ network: user.network });
|
||||
|
||||
const myPosition = {
|
||||
latitude: parseFloat(user.latitude),
|
||||
longitude: parseFloat(user.longitude)
|
||||
}
|
||||
|
||||
this.mapRef.animateCamera({
|
||||
center: {
|
||||
latitude: myPosition.latitude,
|
||||
longitude: myPosition.longitude
|
||||
},
|
||||
pitch: 0,
|
||||
heading: 0,
|
||||
altitude: 5,
|
||||
|
||||
zoom: 12
|
||||
}, 1000);
|
||||
|
||||
if (user.category) {
|
||||
this.setState({ loadingDialog: false })
|
||||
if (user.category !== "geolocated") {
|
||||
this.showMyMembers();
|
||||
} else {
|
||||
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) {
|
||||
this.props.navigation.push(route.updateinfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Platform.OS === 'android') {
|
||||
this.requestCameraPermission();
|
||||
} else {
|
||||
this.getPosition();
|
||||
this.watchLocation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error.message)
|
||||
});
|
||||
}
|
||||
renderTutoOldHome() {
|
||||
return (<View style={{ flex: 1 }}>
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ class IMap extends PureComponent {
|
|||
isNeedUserFocus: PropTypes.bool,
|
||||
onNeedRoadReady: PropTypes.func,
|
||||
onNeedRoadError: PropTypes.func,
|
||||
onMapReady: PropTypes.func
|
||||
onMapReady: PropTypes.func,
|
||||
onLayout: PropTypes.func
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -73,6 +74,7 @@ class IMap extends PureComponent {
|
|||
mapType={typeMap}
|
||||
ref={(re) => this.mapview = re}
|
||||
onMapReady={this.props.onMapReady}
|
||||
onLayout={this.props.onLayout}
|
||||
onRegionChangeComplete={(re) => { this.onRegionChangeOver(re) }}>
|
||||
{this.state.markers.map((item, index) => {
|
||||
return (
|
||||
|
|
|
@ -13,8 +13,7 @@ import {
|
|||
const userposi = require('./../../datas/img/png/user_place.png');
|
||||
const mnetwork = require('./../../datas/img/png/home_network.png');
|
||||
const othernetwork = require('./../../datas/img/png/other_net.png');
|
||||
class IMarker extends PureComponent
|
||||
{
|
||||
class IMarker extends PureComponent {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
const data = this.props.data
|
||||
|
@ -37,7 +36,7 @@ class IMarker extends PureComponent
|
|||
longitude: parseFloat(nextProps.data.longitude),
|
||||
latitude: parseFloat(nextProps.data.latitude),
|
||||
}
|
||||
if (oldCoord.longitude!==coord.longitude || oldCoord.latitude!==coord.latitude) {
|
||||
if (oldCoord.longitude !== coord.longitude || oldCoord.latitude !== coord.latitude) {
|
||||
if (Platform.OS === 'android') {
|
||||
if (this.markerRef) {
|
||||
this.markerRef._component.animateMarkerToCoordinate(
|
||||
|
|
|
@ -236,7 +236,8 @@ export class LoginUi extends Component {
|
|||
}
|
||||
for (let i of country) {
|
||||
if (i.code === shortcountry) {
|
||||
this.setState({ indicatif: i.dial_code, enterPhone: i.dial_code })
|
||||
this.setState({ indicatif: i.dial_code, enterPhone: i.dial_code });
|
||||
console.log("DIAL CODE", i.dial_code);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"HELP": "Help",
|
||||
"SIMPLE_USER": "Simple User",
|
||||
"ABOUT": "About us",
|
||||
"ACTION_TREAT_DEMAND": "Treat demand",
|
||||
"ABOUT_TEXT": "iLink is an application that will facilitate your financial transactions near your location, and give you multiservice points near you.",
|
||||
"GEOLOCATED_USER": "Geo located user",
|
||||
"SUPERVISOR": "Supervisor",
|
||||
|
@ -103,7 +104,8 @@
|
|||
"ERROR_FILTER_TEXT": "Problem encountered while filtering.",
|
||||
"YOUR_THERE": "You are here",
|
||||
"FILTER": "Filter",
|
||||
"QUIT": "Quitter",
|
||||
"QUIT": "Quit",
|
||||
"QUIT_": "Quit",
|
||||
"APP_FULLNAME": "Ilink World",
|
||||
"GUIDE_TITLE": "Welcome to the Guide of",
|
||||
"GUIDE_USER_SIMPLE": "Guide for a user",
|
||||
|
@ -187,6 +189,7 @@
|
|||
"SEARCH": "Search",
|
||||
"SEE_VIDEO": "Watch the video",
|
||||
"SEE_TUTO": "See the tutorial",
|
||||
"SELECT_NETWORK": "Select your",
|
||||
"DELETE": "Delete",
|
||||
"FREE": "Available",
|
||||
"SAVED": "Registered",
|
||||
|
@ -246,6 +249,8 @@
|
|||
"TEXT_UPDATE_POSITION_FAILED_2": "Unable to retrieve your location",
|
||||
"TITLE_ERROR_SURVENU": "An error has occurred!",
|
||||
"TITLE_PROBLE_COME": "A problem has been encountered",
|
||||
"TITLE_SUPPRESS_CONFIRM": "Confirm deletion",
|
||||
"TEXT_SUPPRESS_CONFIRM": "Do you really want to delete this user ?",
|
||||
"TEXT_ERROR_START_APPLICATION": "An error occurred while starting iLink World, please restart iLink World",
|
||||
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Unable to retrieve your location, please make sure your GPS is enabled and restart iLink World",
|
||||
"RESTART": "REPEAT",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"HELP": "Aide",
|
||||
"SIMPLE_USER": "Utilisateur simple",
|
||||
"ABOUT": "A Propos",
|
||||
"ACTION_TREAT_DEMAND": "Traiter la demande",
|
||||
"ABOUT_TEXT": "iLink est une application qui facilitera vos transactions financières près de votre position, et vous donne les points multiservices prêt de chez vous.",
|
||||
"GEOLOCATED_USER": "Utilisateur géo-localisé",
|
||||
"SUPERVISOR": "Superviseur",
|
||||
|
@ -104,6 +105,7 @@
|
|||
"YOUR_THERE": "Vous êtes ici",
|
||||
"FILTER": "Filtrer",
|
||||
"QUIT": "Quitter",
|
||||
"QUIT_": "Quitter",
|
||||
"APP_FULLNAME": "Ilink World",
|
||||
"GUIDE_TITLE": "Bienvenue dans le Guide de",
|
||||
"GUIDE_USER_SIMPLE": "Guide pour un utilisateur",
|
||||
|
@ -187,6 +189,7 @@
|
|||
"SEARCH": "Rechercher",
|
||||
"SEE_VIDEO": "Voir la vidéo",
|
||||
"SEE_TUTO": "Voir le tutoriel",
|
||||
"SELECT_NETWORK": "Sélectionner votre réseau",
|
||||
"DELETE": "Supprimer",
|
||||
"FREE": "disponibles",
|
||||
"SAVED": "enregistrés",
|
||||
|
@ -246,6 +249,8 @@
|
|||
"TEXT_UPDATE_POSITION_FAILED_2": "Impossible de recuperer votre position",
|
||||
"TITLE_ERROR_SURVENU": "Une erreur est survenue !",
|
||||
"TITLE_PROBLE_COME": "Un problème a été rencontré",
|
||||
"TITLE_SUPPRESS_CONFIRM": "Confirmation de suppression",
|
||||
"TEXT_SUPPRESS_CONFIRM": "Voulez vous vraiment supprimer cet utilisateur ?",
|
||||
"TEXT_ERROR_START_APPLICATION": "Une erreur est survenue au démarrage de iLink World. Veuillez relancer iLink World",
|
||||
"TEXT_UNABLE_TO_GET_YOUR_POSITION": "Impossible de recupérez votre position. Veuillez verifier que votre GPS est activé et relancez iLink World",
|
||||
"RESTART": "RECOMMENCER",
|
||||
|
|
|
@ -9,7 +9,7 @@ const baseUrl = "https://ilink-app.com/mobilebackend"
|
|||
|
||||
//base url agent test
|
||||
//const baseUrl = "https://ilink-app.com/mobilebackendtest"
|
||||
|
||||
//
|
||||
export const adhesionUrl = baseUrl + '/interacted/LoginAction.php';
|
||||
export const memberActionUrl = baseUrl + '/interacted/MembersAction.php';
|
||||
export const networkActionUrl = baseUrl + '/interacted/NetworkAction.php';
|
||||
|
|
|
@ -26,9 +26,11 @@ export const loadMarkers=(position,reseau,distance,page)=>{
|
|||
return readUser().then((users) => {
|
||||
let user = users;
|
||||
if (user !== undefined) {
|
||||
let tag={tag:'location',type:'around',
|
||||
let tag = {
|
||||
tag: 'location', type: 'around',
|
||||
page: page,
|
||||
id:user.id,position:position,network:reseau,distance:distance}
|
||||
id: user.id, position: position, network: reseau, distance: distance
|
||||
}
|
||||
return queryMap(tag)
|
||||
}
|
||||
})
|
||||
|
@ -45,11 +47,13 @@ export const loadNetwork=(network,userid)=>{
|
|||
}
|
||||
export const getPositionInformation = async (position) => {
|
||||
let url = GEOCODDING_URL.concat('?latlng=' + position.latitude + "," + position.longitude + '&key=' + API_KEY);
|
||||
const data=fetch(url,{ method: 'GET',
|
||||
const data = fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},})
|
||||
},
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) =>
|
||||
responseJson
|
||||
|
@ -74,13 +78,13 @@ const queryMap= async (data)=>{
|
|||
|
||||
});
|
||||
let responseText = await response.text()
|
||||
console.log("response= "+responseText)
|
||||
//console.log("response= " + responseText)
|
||||
try {
|
||||
let responseJson = JSON.parse(responseText)
|
||||
return responseJson;
|
||||
} catch (e) {
|
||||
console.log("erreur="+responseText)
|
||||
console.log(response)
|
||||
//console.log("erreur=" + responseText)
|
||||
//console.log(response)
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
}
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
|
|
|
@ -10,8 +10,6 @@ export default class Configuration{
|
|||
const da = await _getData()
|
||||
if (da) resolve(da)
|
||||
else reject(da)
|
||||
|
||||
|
||||
}
|
||||
|
||||
async getCurrentPasValue() {
|
||||
|
|
Loading…
Reference in New Issue