小编El *_*rio的帖子

React router v6 没有路由匹配位置

我想使用参数将用户导航到特定的网址,并将其视为带有查看项目按钮的列表项目。当我单击查看按钮项目时,收到以下警告消息

No routes matched location "/explore/0xD78Fb56DB0b68F9766975FEEbf7bFd0CF65C9F11" 
Run Code Online (Sandbox Code Playgroud)

在我的 App.js 中我有这个

<BrowserRouter>
      <Header style={styles.header}>
        <Navbar />
        <Account />
      </Header>
      <div style={styles.content}>
        <Wrapper>
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="create" element={<Creation user={account} />} />
            <Route path="/explore" element={<Explore />} />
            <Route path='/dashboard' element={<Dashboard />} />
            <Route path='test' element={<Test />} />
          </Routes>
        </Wrapper>
      </div>
      </BrowserRouter>
Run Code Online (Sandbox Code Playgroud)

所有这些路线现在在 /explore 路线中工作正常我有我的项目列表

我做了类似的事情(我遵循了反应路由器文档)


return (
      <div style={{marginTop:'5em'}}>
        {isInitialized ?
        <div className='wrapper'>
          {eventArray.map(infoItem => (
            <div key={infoItem.id}>
            <CardEvent img={infoItem.pathImg ? infoItem.pathImg : lpass} 
            title={infoItem.idName} 
            date={infoItem.eventDate.toString()}
            />
            <Link to={`/explore/${infoItem.id}`}>View event …
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

6
推荐指数
1
解决办法
2万
查看次数

无法使用带有 Linking.openURL('app-settings') 的 expo 打开设置

您好,我尝试遵循 YouTube 上的教程,了解如何在用户未启用位置服务的情况下使应用程序打开位置设置。然而在他的电脑上它可以工作(尽管他使用的是android模拟器),而我的Iphone XS(我相信它可以在最新的IOS版本上工作)却没有做任何事情。

我尝试仅打开设置,甚至打开互联网上的链接,但它不起作用

openSetting = () => {
    if(Platform.OS=='ios'){
      Linking.openURL('app-settings:')
    }
    else{
      IntentLauncherAndroid.startActivityAsync(
        IntentLauncherAndroid.ACTION_LOCATION_SOURCE_SETTINGS
      );
    }
    this.setState({openSetting:false});

  }
Run Code Online (Sandbox Code Playgroud)
<Button onPress={() => this.setState({isLocationModalVisible:false, openSetting:true})}
          title ="Enable Location Services"/>
Run Code Online (Sandbox Code Playgroud)

javascript settings react-native

5
推荐指数
1
解决办法
6252
查看次数