navigation

Flutter - Start app with different routes depending on login state

跟風遠走 提交于 2020-07-04 13:23:09
问题 I'm searching for a way to show a different screens on app startup depending on login state. For example, I have the following routes defined: /home /login /settings Naturally, I would check if the user has already logged in within the main() method and then set the initialRoute of my MaterialApp to either /login or /home. After successful login, I can call Navigator.pushReplacement to navigate to /home and the login screen is removed from the stack. Unfortunately, I always have to either

createDrawerNavigator | undefined is not a function

安稳与你 提交于 2020-06-29 04:44:05
问题 I'm trying using React Native to create a drawer navigator at an Android project, but i'm gettin a "undefined is not a function", like in this print here is the code: import 'react-native-gesture-handler'; import React, { useEffect } from 'react'; import { View, ActivityIndicator } from 'react-native'; import { createDrawerNavigator } from '@react-navigation/drawer'; import AsyncStorage from '@react-native-community/async-storage'; import { NavigationContainer, DefaultTheme as

SwiftUI NavigationLink immediately navigates back

六眼飞鱼酱① 提交于 2020-06-27 17:58:05
问题 I am using SwiftUI to create NavigationLinks from rows to detail views in a NavigationView (similar to what is being done in the tutorial https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation). However, when I test in my app, the NavgiationLink immediately navigates back from the detail view to the previous view after being tapped (the detail view only shows up for only a second). Here's the code: struct ItemsView: View { var body: some View { NavigationView { VStack {

Android Navigation Editor - Finish Activity?

萝らか妹 提交于 2020-06-27 11:59:31
问题 I'm trying out Android's new Navigation Editor for the first time and I'm not sure if this is a missing feature, intentional omission, or if I'm missing something. I have two fragments and I want the first fragment to be able to navigate to the second one, but I want the activity to finish if back is pressed from either fragment. With my current setup, I can navigate from mainFragment to newFragment. If I press back from the mainFragment, the activity finishes. The only piece I can't figure

Setting NavGraph programmatically

时光毁灭记忆、已成空白 提交于 2020-06-25 10:00:43
问题 In my activity layout, I have the following NavHostFragment : <fragment android:id="@+id/my_nav_host_fragment" android:layout_height="match_parent" android:layout_width="match_parent" android:name="androidx.navigation.fragment.NavHostFragment" app:defaultNavHost="true" app:navGraph="@navigation/my_nav_graph" /> My question is how can I set the navGraph programmatically? How can I convert the my_nav_host_fragment view instance in a NavHostFragment instance? 回答1: I found a solution: //Setup the

Implementing Page Based Navigation for SwiftUI Apple Watch App

拥有回忆 提交于 2020-06-23 05:58:07
问题 I'm building an Apple Watch app in SwiftUI and would like to implement page based navigation so when users swipe left on the home screen, they are taken to another view. I understand how to use NavigationLink to let users move from one screen to another, but not how to let users navigate from screen to screen by swiping left or right. Does anyone know how this can be done? 回答1: Here is a guide how to implement page-based navigation for watchOS using SwiftUI. The description is based on

How do I map a non-binary Occupancy Grid with several values to a cost map in ROS?

孤者浪人 提交于 2020-06-15 07:09:01
问题 I'm looking for a way to map a non-binary occupancy grid to a global cost map. The occupancy grid has the values -1 for undefined, 0 for non-collision and 1-100 for collision areas. There is a similar question here for which the given answer doesn't offer a concrete solution: https://answers.ros.org/question/335530/what-range-of-costs-does-ros-navigation-support/ For a better overview: I'm using ROS Melodic. My occupancy grid looks like this: Image of Occupancy grid My global_costmap_params

How do I map a non-binary Occupancy Grid with several values to a cost map in ROS?

前提是你 提交于 2020-06-15 07:08:51
问题 I'm looking for a way to map a non-binary occupancy grid to a global cost map. The occupancy grid has the values -1 for undefined, 0 for non-collision and 1-100 for collision areas. There is a similar question here for which the given answer doesn't offer a concrete solution: https://answers.ros.org/question/335530/what-range-of-costs-does-ros-navigation-support/ For a better overview: I'm using ROS Melodic. My occupancy grid looks like this: Image of Occupancy grid My global_costmap_params

How to navigate using button with condition check in SwiftUI

删除回忆录丶 提交于 2020-06-13 08:45:47
问题 Since NavigationButton isn't available anymore, how do I check conditions in NavigationLink in order to navigate to another view? NavigationLink(destination: Dashboard(userName: self.userId, password: self.password), isActive: $showDashboard) { Button(action: { if self.userId.isEmpty || self.password.isEmpty { self.isAlert = true } else { self.showDashboard = true } }) { Text("Submit") .foregroundColor(.white) .font(.system(size: 22)) Dashboard() } .frame(minWidth: 150, idealWidth: 300,

How to navigate using button with condition check in SwiftUI

会有一股神秘感。 提交于 2020-06-13 08:45:34
问题 Since NavigationButton isn't available anymore, how do I check conditions in NavigationLink in order to navigate to another view? NavigationLink(destination: Dashboard(userName: self.userId, password: self.password), isActive: $showDashboard) { Button(action: { if self.userId.isEmpty || self.password.isEmpty { self.isAlert = true } else { self.showDashboard = true } }) { Text("Submit") .foregroundColor(.white) .font(.system(size: 22)) Dashboard() } .frame(minWidth: 150, idealWidth: 300,