Skip to content

Commit

Permalink
implement search stack screen independent of tabbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ujjal Acharya committed May 5, 2020
1 parent b1ed829 commit 8575656
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
18 changes: 15 additions & 3 deletions app/src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import React, { Component } from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";

const Stack = createStackNavigator();

import TabNavigators from "./TabNavigators";
import SearchScreen from "../screens/AfterGo/SearchScreen";

export default function App() {
return (
<NavigationContainer>
<TabNavigators/>
<NavigationContainer headerMode="none">
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="Root" component={TabNavigators} />
<Stack.Screen name="Search" component={SearchScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
}
22 changes: 22 additions & 0 deletions app/src/screens/AfterGo/SearchScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { Component } from "react";
import { Text, View } from "react-native";
import { Appbar } from "react-native-paper";

export class SearchScreen extends Component {
_goBack = () => {
this.props.navigation.pop();
};
render() {
return (
<View>
<Appbar.Header>
<Appbar.BackAction onPress={this._goBack} />
<Appbar.Content title="Search" />
</Appbar.Header>
<Text> Search Screen </Text>
</View>
);
}
}

export default SearchScreen;
2 changes: 1 addition & 1 deletion app/src/screens/HomeScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class HomeScreen extends Component {
<View style={styles.submitButtonContainer}>
<Button
mode="contained"
onPress={() => Alert.alert("Something will happen soon!")}
onPress={() => this.props.navigation.navigate("Search")}
style={styles.submitButton}
disabled={!buttonEnabled}
>
Expand Down

0 comments on commit 8575656

Please sign in to comment.