I am unable to use geolocation in react-native with redux

I am unable to use geolocation in react-native with redux

I am using geolocation in react-native with redux, but I am getting 2 problems..

I am using geolocation in react-native with redux, but I am getting 2 problems..

  1. It's showing wrong latitude and longitude in my android studio emulator, my location is lahore, pakistan but It's showing USA location.
  2. When i signed it apk file and installed that apk file in my mobile then It's not showing any location, empty.

Can anyone help me?

Here is my code..!

Reducer.js

let initialState = {
    lng: null,
    lat: null,
}

export default function prayerTimes(state = initialState, action) { switch (action.type) {

     case GET_LOCATION:
         return {
            ...state,
            lat: action.lat,
            lng: action.lng
     }

}

}

Action.js

export function getLocation() {
    return dispatch => {
        navigator.geolocation.getCurrentPosition((position) => {
            dispatch({
                type: GET_LOCATION,
                lat: position.coords.latitude,
                lng: position.coords.longitude
            });
        });
    };
}

App.js

componentDidMount() {
    const { getLocation } = this.props;
    getLocation();
}

render() { const { lng, lat } = this.props; return ( <View style={{justifyContent: 'center'}}> <Text style={{color: 'white'}}>Latitude: {lat}</Text> <Text style={{color: 'white'}}>Latitude: {lng}</Text> </View> ); }


api react-native redux

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Hire Dedicated React Native Developer

Have you ever thought of having your own app that runs smoothly over multiple platforms? React Native is an open-source cross-platform mobile application framework which is a great option to create mobile apps for both Android and iOS. **[Hire...

Accessing Redux from Components In React & React Native

How to set up a basic version of Redux in your React or React Native application. To make things clearer, I based my setup on my event application, where users create events that other users attend. We generated the action creators, reducers, and Redux store, and wrapped the application in a provider.

A Basic Redux Setup in React/React Native

Redux is a powerful state management tool that can be very useful as your React or React Native application grows and requires you to keep track of more state.

Build a simple React Native Pokemon app with React-Navigation

As we start learning new technologies we want to start building something or work on a simple project to get a better understanding of the technology.

Top React Native Mobile App Development Companies in USA

Looking for top React Native mobile app development company in USA for Startups & Enterprise? Find out the top list of React Native mobile app development company in USA.