mapbox / mapbox/mapbox-navigation-android

NavigationView doesn't show all instructions and crash in React Native

Open
#3,050 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

I'm trying to build a navigation component to use in a React Native project. In this project, I need to show the **navigation inside a View**, so I can't use the NavigationLauncher because it wraps the navigation on the entire screen. I've been trying to create a View that extends the Mapbox's NavigationView and it almost worked well. The problem is that the text in summaryView does not appear. But if I change the orientation of the phone (and only if I change it) it appears. If I click in the instructionsView the app crashes. I'm using the last stable version on **Navigation SDK 0.42.6**.
Here is the code with some comments:

https://gist.github.com/andfs/dc833e70b6d9cfcb1fd3b85865c704c0

Here is a gif that shows the problem. As you can see the time remaining text doesn't appear:

![navigationProblem](https://user-images.githubusercontent.com/16955808/83150988-581b9380-a0d2-11ea-8ce9-6f4efd32f7d3.gif)

When the app crashes, Android Studio show me this error:

```
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.navdemo, PID: 1346
java.lang.RuntimeException: All children of ConstraintLayout must have ids to use ConstraintSet
at androidx.constraintlayout.widget.ConstraintSet.applyToInternal(ConstraintSet.java:804)
at androidx.constraintlayout.widget.ConstraintSet.applyTo(ConstraintSet.java:789)
at com.mapbox.services.android.navigation.ui.v5.instruction.InstructionView.updateLandscapeConstraintsTo(InstructionView.java:833)
at com.mapbox.services.android.navigation.ui.v5.instruction.InstructionView.showInstructionList(InstructionView.java:360)
at com.mapbox.services.android.navigation.ui.v5.instruction.InstructionView$6.onClick(InstructionView.java:573)
at android.view.View.performClick(View.java:7869)
at android.view.View.performClickInternal(View.java:7838)
at android.view.View.access$3600(View.java:886)
at android.view.View$PerformClick.run(View.java:29362)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with InstructionView.updateLandscapeConstraintsTo and showInstructionList, which appear in the crash trace, then review the reproduction code in the linked gist using Navigation SDK 0.42.6. Reproduce the missing summary text and the crash when tapping instructions; done means the instructions render without rotation and the tap no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.