resolving issue about focus on map at first loading

This commit is contained in:
Brice Zele 2020-03-29 09:23:08 +01:00
parent 483283a574
commit 2d41abca6b
11 changed files with 426 additions and 384 deletions

File diff suppressed because one or more lines are too long

View File

@ -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",

View File

@ -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 }}>

View File

@ -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 (

View File

@ -1,5 +1,5 @@
import React,{Component,PureComponent} from 'react';
import MapView,{Marker,MarkerAnimated,Callout,AnimatedRegion} from "react-native-maps"
import React, { Component, PureComponent } from 'react';
import MapView, { Marker, MarkerAnimated, Callout, AnimatedRegion } from "react-native-maps"
import PropTypes from 'prop-types';
import {
StyleSheet,
@ -10,34 +10,33 @@ import {
Platform,
Text,
} from 'react-native';
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
{
constructor(props){
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 {
constructor(props) {
super(props)
const data=this.props.data
this.state={
animation:new Animated.Value(0),
subanimation:new Animated.Value(0),
coordinate:{
const data = this.props.data
this.state = {
animation: new Animated.Value(0),
subanimation: new Animated.Value(0),
coordinate: {
longitude: parseFloat(data.longitude),
latitude: parseFloat(data.latitude),
}
}
}
}
componentWillReceiveProps(nextProps) {
const duration = 500
const oldCoord={
const oldCoord = {
longitude: parseFloat(this.props.data.longitude),
latitude: parseFloat(this.props.data.latitude),
}
const coord={
const coord = {
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(
@ -53,31 +52,31 @@ class IMarker extends PureComponent
*/}
}
}
startAnimation(){
const initialValue=0
const finalValue=1
startAnimation() {
const initialValue = 0
const finalValue = 1
this.state.animation.setValue(initialValue); //Step 3
Animated.timing( //Step 4
this.state.animation,
{
toValue: finalValue,
duration:500,
duration: 500,
easing: Easing.linear(),
useNativeDriver:true
useNativeDriver: true
}
).start();
}
handleViewRef = ref => this.view = ref;
render() {
const {data,network,isSelected}=this.props;
const color=isSelected?"#F48FB1A0":"transparent"
const colorSup=isSelected?"#F06292A0":"transparent"
const display=isSelected?"block":"none";
if(data.longitude && data.latitude){
const { data, network, isSelected } = this.props;
const color = isSelected ? "#F48FB1A0" : "transparent"
const colorSup = isSelected ? "#F06292A0" : "transparent"
const display = isSelected ? "block" : "none";
if (data.longitude && data.latitude) {
return (
<Marker.Animated
coordinate={this.state.coordinate.longitude?this.state.coordinate:{longitude:data.longitude,latitude:data.latitude}}
coordinate={this.state.coordinate.longitude ? this.state.coordinate : { longitude: data.longitude, latitude: data.latitude }}
id={data.id}
title={this.props.title}
@ -94,10 +93,10 @@ class IMarker extends PureComponent
);
}
return (<View/>)
return (<View />)
}
error(erro){
error(erro) {
console.log("on error render image");
console.log(erro);
}
@ -108,32 +107,32 @@ class IMarker extends PureComponent
}
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS): void {
if(this.props.isUser)
if(this.markerRef && this.props.isNeedFocus){
if (this.props.isUser)
if (this.markerRef && this.props.isNeedFocus) {
this.markerRef._component.showCallout()
}
}
getImage(data) {
const {isUser,network}=this.props;
if(isUser){
const { isUser, network } = this.props;
if (isUser) {
return userposi
}else if(network && data.network===network.name){
} else if (network && data.network === network.name) {
return mnetwork
}
return othernetwork
}
getIcon(data) {
const {isSelected}=this.props
const { isSelected } = this.props
return isSelected ? (
<Animated.View style={{
width:32,
height:32,
justifyContent:'center',
alignItems:'center',
borderRadius:16,
backgroundColor:isSelected?"#81D4FAA0":"transparent",
width: 32,
height: 32,
justifyContent: 'center',
alignItems: 'center',
borderRadius: 16,
backgroundColor: isSelected ? "#81D4FAA0" : "transparent",
transform: [
{
scaleX: this.animatedValue.interpolate({
@ -144,40 +143,40 @@ class IMarker extends PureComponent
{
scaleY: this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: [1,32]
outputRange: [1, 32]
})
}
]
}}>
<Image style={{alignSelf: 'center'}} source={this.getImage(data)}/>
<Image style={{ alignSelf: 'center' }} source={this.getImage(data)} />
</Animated.View>
) : (<Image style={{alignSelf: 'center'}} source={this.getImage(data)}/>);
) : (<Image style={{ alignSelf: 'center' }} source={this.getImage(data)} />);
}
startLoopSelectedAnimation() {
const initialValue=0
const finalValue=1
const initialValue = 0
const finalValue = 1
this.state.animation.setValue(initialValue); //Step 3
Animated.loop(Animated.timing( //Step 4
this.state.subanimation,
{
toValue: finalValue,
duration:1000,
duration: 1000,
easing: Easing.linear(),
useNativeDriver:true
useNativeDriver: true
}
),{iteration:-1}).start();
), { iteration: -1 }).start();
}
}
const styles = StyleSheet.create({
container: {
flex:1,
width:52,
height:52
flex: 1,
width: 52,
height: 52
},
ring:{
ring: {
}
});

View File

@ -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 {

View File

@ -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",

View File

@ -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",

View File

@ -5,11 +5,11 @@ export const isDebugMode = false
const baseUrl = "https://ilink-app.com/mobilebackend"
//base url agent
//const baseUrl="https://ilink-app.com/mobilebackendtest2"
//const baseUrl = "https://ilink-app.com/mobilebackendtest2"
//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';

View File

@ -1,70 +1,74 @@
import React, { Component } from 'react';
var db=require('./persistences/db.js');
var db = require('./persistences/db.js');
import I18n from 'react-native-i18n'
import {readUser} from './AuthApi'
import {isDebugMode,MARKER_URL} from "./IlinkConstants";
import { readUser } from './AuthApi'
import { isDebugMode, MARKER_URL } from "./IlinkConstants";
let GEOCODDING_URL="https://maps.googleapis.com/maps/api/geocode/json"
let API_KEY="AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI"
export const getLocalMarkers=()=> {
let GEOCODDING_URL = "https://maps.googleapis.com/maps/api/geocode/json"
let API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI"
export const getLocalMarkers = () => {
return db.markers.get_all()
}
export const getMakersFrom=function(country){
let tag={tag:'location',type:'all',country:country}
return timeout(15000,queryMap(tag))
}
export const getMakersFrom = function (country) {
let tag = { tag: 'location', type: 'all', country: country }
return timeout(15000, queryMap(tag))
}
function timeout(ms, promise) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
}, ms)
promise.then(resolve, reject)
})
}
export const loadMarkers=(position,reseau,distance,page)=>{
return readUser().then((users)=>{
let user=users;
if(user!==undefined){
let tag={tag:'location',type:'around',
page:page,
id:user.id,position:position,network:reseau,distance:distance}
export const loadMarkers = (position, reseau, distance, page) => {
return readUser().then((users) => {
let user = users;
if (user !== undefined) {
let tag = {
tag: 'location', type: 'around',
page: page,
id: user.id, position: position, network: reseau, distance: distance
}
return queryMap(tag)
}
})
}
export const loadGroupeAgent=(member_code)=>{
let data={tag:'location',type:'all_network',codeparrain:member_code}
export const loadGroupeAgent = (member_code) => {
let data = { tag: 'location', type: 'all_network', codeparrain: member_code }
return queryMap(data)
}
export const loadNetwork=(network,userid)=>{
let data={tag:'location' ,type:"all_network_point",id:userid,network:network}
export const loadNetwork = (network, userid) => {
let data = { tag: 'location', type: "all_network_point", id: userid, network: network }
return queryMap(data)
}
export const getPositionInformation= async (position)=>{
let url=GEOCODDING_URL.concat('?latlng='+position.latitude+","+position.longitude+'&key='+API_KEY);
const data=fetch(url,{ method: 'GET',
export const getPositionInformation = async (position) => {
let url = GEOCODDING_URL.concat('?latlng=' + position.latitude + "," + position.longitude + '&key=' + API_KEY);
const data = fetch(url, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},})
.then((response)=>response.json())
.then((responseJson)=>
},
})
.then((response) => response.json())
.then((responseJson) =>
responseJson
).catch((error)=>{
).catch((error) => {
console.log("error get position")
console.log(error)
});
console.warn("freud",data);
console.warn("freud", data);
return data;
}
const queryMap= async (data)=>{
data['lang']=I18n.currentLocale()
data["test"]=isDebugMode
let response=await fetch(MARKER_URL,{
const queryMap = async (data) => {
data['lang'] = I18n.currentLocale()
data["test"] = isDebugMode
let response = await fetch(MARKER_URL, {
method: 'POST',
headers: {
Accept: 'application/json',
@ -73,14 +77,14 @@ const queryMap= async (data)=>{
body: JSON.stringify(data),
});
let responseText=await response.text()
console.log("response= "+responseText)
try{
let responseJson=JSON.parse(responseText)
let responseText = await response.text()
//console.log("response= " + responseText)
try {
let responseJson = JSON.parse(responseText)
return responseJson;
}catch(e){
console.log("erreur="+responseText)
console.log(response)
} catch (e) {
//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")

View File

@ -1,39 +1,37 @@
import {db} from './db';
import {AsyncStorage} from 'react-native';
import { db } from './db';
import { AsyncStorage } from 'react-native';
export default class Configuration{
export default class Configuration {
constructor(){
constructor() {
}
async getCurrentLangue(){
const da=await _getData()
if(da)resolve(da)
async getCurrentLangue() {
const da = await _getData()
if (da) resolve(da)
else reject(da)
}
async getCurrentPasValue(){
const pasObject=await this._getPasData()
if(pasObject){
async getCurrentPasValue() {
const pasObject = await this._getPasData()
if (pasObject) {
return pasObject.valeur_int;
}else return pasObject;
} else return pasObject;
}
async getCurrentPubValue(){
const pasObject=await this._getPubData()
async getCurrentPubValue() {
const pasObject = await this._getPubData()
console.warn(pasObject)
if(pasObject){
if (pasObject) {
return pasObject.valeur_bool;
}else return pasObject;
} else return pasObject;
}
async setPubActive(data){
async setPubActive(data) {
try {
if(data.pub){
if (data.pub) {
await AsyncStorage.setItem('pubObject', JSON.stringify(data.pub));
db.update({"configuration.pub":{$exists:true}},{configuration:{pub:data.pub}},{upsert:true},(err,num,upsert)=>{
console.log([err,num,upsert])
db.update({ "configuration.pub": { $exists: true } }, { configuration: { pub: data.pub } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
} catch (error) {
@ -41,48 +39,48 @@ export default class Configuration{
}
}
_getPubData(){
return new Promise(async (resolve,reject)=>{
_getPubData() {
return new Promise(async (resolve, reject) => {
try{
const ty=await AsyncStorage.getItem('pubObject')
try {
const ty = await AsyncStorage.getItem('pubObject')
resolve(JSON.parse(ty))
} catch(err){
} catch (err) {
reject(err)
}
})
}
setCurrentLangue(lang){
setCurrentLangue(lang) {
this._storeData(lang)
db.update({"configuration.lang":{$exists:true}},{configuration:{lang:lang}},{upsert:true},(err,num,upsert)=>{
console.log([err,num,upsert])
db.update({ "configuration.lang": { $exists: true } }, { configuration: { lang: lang } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
setCurrentPas=async (pas)=>{
setCurrentPas = async (pas) => {
try {
await AsyncStorage.setItem('@config:pasObject', JSON.stringify(pas.pas));
} catch (error) {
console.warn(error)
}
db.update({"configuration.pas":{$exists:true}},{configuration:{pas:pas.pas}},{upsert:true},(err,num,upsert)=>{
console.log([err,num,upsert])
db.update({ "configuration.pas": { $exists: true } }, { configuration: { pas: pas.pas } }, { upsert: true }, (err, num, upsert) => {
console.log([err, num, upsert])
})
}
_getPasData= ()=>{
return new Promise(async (resolve,reject)=>{
_getPasData = () => {
return new Promise(async (resolve, reject) => {
try{
const ty=await AsyncStorage.getItem('@config:pasObject')
try {
const ty = await AsyncStorage.getItem('@config:pasObject')
resolve(JSON.parse(ty))
} catch(err){
} catch (err) {
reject(err)
}
})
}
}
_storeData = async (lang) => {
try {
await AsyncStorage.setItem('@config:lang', lang.value);
@ -90,17 +88,17 @@ export default class Configuration{
console.warn(error)
}
};
_getData= ()=>{
return new Promise(async (resolve,reject)=>{
_getData = () => {
return new Promise(async (resolve, reject) => {
try{
const ty=await AsyncStorage.getItem('@config:lang')
try {
const ty = await AsyncStorage.getItem('@config:lang')
resolve(ty)
} catch(err){
} catch (err) {
reject(err)
}
})
}
}
}