Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with function based React Native #22

Open
SArrueLorca opened this issue Dec 29, 2021 · 1 comment
Open

Problems with function based React Native #22

SArrueLorca opened this issue Dec 29, 2021 · 1 comment

Comments

@SArrueLorca
Copy link

Hi. I want to make an app that uses Turn by Turn navigation exclusively. However my code is function based instead of using classes as the provided example, due to limitations with React Navigation. That's the code that i used:

                          <MapView
                              ref={ref => this.refMap = ref}
                              provider={PROVIDER_GOOGLE}
                              style={{  flex: 1}}

                              initialRegion={{
                                  latitude: 37.78825,
                                  longitude: -122.4324,
                                  latitudeDelta: 0.0922,
                                  longitudeDelta: 0.0421,
                              }}
                          >
                              <MapViewNavigation
                                  origin={coordenada}
                                  destination='132 Wilmot St, San Francisco, CA 94115'
                                  navigationMode= {NavigationModes.IDLE}
                                  travelMode= {TravelModes.DRIVING}
                                  ref={ref => this.refNavigation = ref}
                                  map={() => this.refMap}
                                  apiKey={GOOGLE_API_KEY}
                                  simulate={true}
                                  onRouteChange={route => console.log(route)}
                                  onStepChange={(step, nextStep) => console.log(step)}
                                  displayDebugMarkers={true}
                                  onNavigationStarted={route => console.log("Navigation Started")}
                                  onNavigationCompleted={console.log("Pendiente")}
                              />
                          </MapView>

And i receive an error related to this.refMap, this.refNavigation and navigator.geolocation.watchposition. So i want to know: Is there an alternative to repair/avoid this ref dependent code without using classes?. Thanks in advance.
Cierto

@meerbex
Copy link

meerbex commented Jun 28, 2022

Could you solve the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants