Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

NavigationContainer: initialRouteName: Issue with TypeScript #1285

Open
@acarlstein

Description

@acarlstein

Summary

Following thedocumentation provided, I see that there is an issue when setting the propertyinitialRouteName to theNavigationContainer tag.

Computer: Mac OS 14.1 (23B74)
Editor: VSCode using React Native Tools by Microsoft.

Description

package.json dependencies:

"dependencies": {"@react-navigation/native":"^6.1.9","@react-navigation/native-stack":"^6.9.17","@react-navigation/stack":"^6.3.20","react":"18.2.0","react-native":"0.72.6","react-native-gesture-handler":"^2.13.4","react-native-safe-area-context":"^4.7.4","react-native-screens":"^3.27.0",  },

App.js:

/** * Sample React Native App * https://github.com/facebook/react-native * *@format */import*asReactfrom'react';import{NavigationContainer}from'@react-navigation/native';import{createNativeStackNavigator}from'@react-navigation/native-stack';importHomefrom'./views/Home'constStack=createNativeStackNavigator();functionApp():JSX.Element{return(<NavigationContainerinitialRouteName="Home"><Stack.Navigator><Stack.Screenname="Home"component={Home}/></Stack.Navigator></NavigationContainer>);}exportdefaultApp;

VSCode Error Popup:

Type '{ children:Element; initialRouteName:string;}' is not assignable to type 'IntrinsicAttributes&NavigationContainerProps&{theme?:Theme|undefined; linking?:LinkingOptions<RootParamList>|undefined; fallback?:ReactNode; documentTitle?:DocumentTitleOptions|undefined; onReady?:(()=>void)|undefined;}&{ ...;}'.Property 'initialRouteName' does not exist on type 'IntrinsicAttributes&NavigationContainerProps&{theme?:Theme|undefined; linking?:LinkingOptions<RootParamList>|undefined; fallback?:ReactNode; documentTitle?:DocumentTitleOptions|undefined; onReady?:(()=>void)|undefined;}&{ ...;}'.ts(2322)

Screenshot:

image

Acceptance Criteria

I was expecting no error would show up

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp