0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

React Native 遷移ができない

Posted at

React Nativeのバージョンはreact@18.2.0です。

npm install react-router-native

を実行後、以下のソースコードを書いたのですが何も表示されません。

プロジェクト作成後の初期画面は表示されていました。

ボタンを表示し遷移をする方法を教えてください。

App.tsx
import * as React from "react";
import { NativeRouter, Route, Link } from "react-router-native";
import Home from "./src/Home";

function App() {
  return (
    <NativeRouter>
      <Route path="/" Component={Home} />
    </NativeRouter>
  );
}

export default App;
sec/Home/index.tsx
import React from "react";
import { View, Text, Button } from "react-native";
import { Link } from "react-router-native";

const Home = () => {
  return (
    <View>
      <Text>Home Screen</Text>
      <Link to="/">
        <Button title="Index" />
      </Link>
    </View>
  );
};

export default Home;

よろしくお願いします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?