Comments (3)
You are right about subscribing and unaubscribing. But what about If i want to have one global subscriber and firing location request when i need to ?
Subscribing and unsubscribing and again and again for example 10 screens looks very complicated solution.
But have one app/root subscriber connected to Redux and just updating when is need looks more easier.
For example:
- for some screens i need position no older than 10 seconds. Fire request
- for some screens is 1 minúte enought. Do not fire request
- same for accuracy
- speed, dIstance and any other measure
If i need to making new listener for every screen on and off. It ist little bit “scratching with left hand on right ear”. Even when i need just one manual request to update my location
from react-native-location.
Maybe any other use cases.
Request location only once on rendering screen. But have one global listener as saved whole object to Redux or React Context. And based on it, when location is requested, tadaaa, rerender with fresh data.
If people are in move, by walk, bike, in car, in train ,in bus, in any other vehicle. And your list of points if sorted by distance, you want to render it only once. Instead you get very nice flickering effect because rerendering :)
Handling this use cases with every new listener or comparing data in "should render" method is not clean and its bloat code a bit.
from react-native-location.
👋 Thanks for the request!
You should already be able to do this by adding a listener and unsubscribing when you no longer want updates.
The methods mentioned are internal implementation details and should not be used.
from react-native-location.
Related Issues (20)
- location returning null sometimes on ios and android both. HOT 1
- subScribeLocationChanges() HOT 3
- 🔥 Method addObserver must be called on the main thread HOT 2
- Terrible accuracy - physial device Android 10, RN 0.6.4 HOT 3
- Is there any good and well-maintained alternative to this package? HOT 1
- Cant stop updates of RNLocation.subscribeToLocationUpdates HOT 2
- Not return heading HOT 2
- background configuration throwing error
- Failed to build android because of java classes HOT 9
- Wanings about some event emitters, about AddListener and removeListeners HOT 1
- subscribeToSignificantLocationUpdates doesn't work to me
- Undefined symbols for architecture arm64 HOT 1
- Requesting "always" permission when user has previously selected "whenInUse" causes request to hang (promise never resolves) (deprecate this library) HOT 2
- Failed to Build HOT 12
- Is this repo dead?
- RNLocation functions issue HOT 5
- nvert
- Error: package android.support.annotation does not exist HOT 2
- Not working when mobile in sleep mode[Android] HOT 1
- Error - Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-location.