Open In App

Create Tour and Travels website template using React-Native

Last Updated : 05 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

The tour and travel app template with React Native offers a user-friendly interface with various options required in any travel app. In this article, we will create a basic Tour and Travels website template using React Native.

Preview of final output: Let us have a look at how the final output will look like.

tour
Preview

Prerequisite:

Approach to create Tour and Travels website template:

  • The Tour and Travels website template app is a simple application that is a collection of destinations, famous places, etc.
  • In this app, we created a beautiful home page with attractive user interface.
  • we added a poster to the top of the app and added a search destination button by which users can search destinations.
  • we also added a featured destination horizontal flatlist at the last of the app where we can add all popular places.

Steps to Create React Native Application:

Step 1: Create a react native application by using this command in the command prompt

React-native init TourApp

Step: 2 We have to download some dependencies which requires for our app. We use navigation in our app to go for one screen to another screen. so, firstly we install the navigation dependencies.

npm install @react-navigation/native
npm install react-native-screens react-native-safe-area-context
npm install @react-navigation/native-stack

Step 3: We will use some Icons in our app . so, we will install dependency for icon

npm i react-native-vector-icons

Project Structure:

tour-struc
Structure of project

The updated dependencies in package.json file will look like:

"dependencies": {
"expo-constants": "~13.2.4",
"@expo/vector-icons": "^13.0.0",
"react-native-paper": "4.9.2",
"react-native-screens": "~3.15.0",
"@react-navigation/native": "*",
"@react-navigation/native-stack": "*",
"react-native-safe-area-context": "4.3.1"
}

Example: Write the below source code into the App.js file.

JavaScript
//App.js

import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import HomeScreen from './screens/HomeScreen';
import DestinationScreen from './screens/DestinationScreen';

const Stack = createStackNavigator();

function App() {
	return (
		<NavigationContainer>
			<Stack.Navigator
				initialRouteName="Home"
				screenOptions={{
					headerStyle: {
						backgroundColor: '#3498db',
					},
					headerTintColor: '#fff',
					headerTitleStyle: {
						fontWeight: 'bold',
					},
				}}
			>
				<Stack.Screen name="Home" component={HomeScreen} />
				<Stack.Screen name="Destination" component={DestinationScreen} />
			</Stack.Navigator>
		</NavigationContainer>
	);
}

export default App;
JavaScript JavaScript

Step to run the Project:

Step 1: Depending on your operating system, type the following command

  • For android:
React-native run-android
  • For IOS:
React-native run-ios

Output:


Next Article

Similar Reads

three90RightbarBannerImg