Skip to content

Commit

Permalink
add dummy searched bus screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Ujjal Acharya committed May 22, 2020
1 parent bd2aa29 commit b7b5c25
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
56 changes: 56 additions & 0 deletions app/src/components/SearchedSingleBus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from "react";
import { Avatar, Button, Card, Title, Paragraph } from "react-native-paper";
import { View, Image, StyleSheet, Alert, Text } from "react-native";
import { TouchableNativeFeedback } from "react-native-gesture-handler";
import ConstantColors from "../constants/ConstantColors";

const SearchedSingleBus = ({ bus }) => (
<TouchableNativeFeedback
style={{ marginBottom: 5 }}
onPress={() => Alert.alert("Sup")}
>
<Card>
<Card.Content>
<View>
<Image style={styles.tinyLogo} source={{ uri: bus.image }} />

<Title>{bus.title}</Title>
<Paragraph>{bus.price}</Paragraph>
<View style={styles.rowFlex}>
<View style={{ flex: 1 }}>
<Text>{bus.seats} seats</Text>
</View>
<View style={{ flex: 3 }}>
<Text>Time: {bus.time}</Text>
</View>
</View>
</View>
</Card.Content>
<Card.Actions
style={{ backgroundColor: ConstantColors.initialColor, marginTop: 5 }}
>
<View style={styles.rowFlex}>
<Button>Wifi</Button>
<Button>TV</Button>
<Button>Mobile Charger</Button>
<Button>AC</Button>
</View>
</Card.Actions>
</Card>
</TouchableNativeFeedback>
);

const styles = StyleSheet.create({
rowFlex: {
display: "flex",
flexDirection: "row",
},
tinyLogo: {
width: "100%",
height: 120,
borderTopLeftRadius: 4,
borderTopRightRadius: 4,
},
});

export default SearchedSingleBus;
14 changes: 12 additions & 2 deletions app/src/screens/AfterGo/SearchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Text, View } from "react-native";
import { Appbar } from "react-native-paper";

import { connect } from "react-redux";
import SearchedSingleBus from "../../components/SearchedSingleBus";
import { ScrollView } from "react-native-gesture-handler";
import { busData } from "../../utils/mock";

export class SearchScreen extends Component {
state = {
Expand All @@ -16,15 +19,22 @@ export class SearchScreen extends Component {
};

render() {
console.log(this.props)
return (
<View>
<Appbar.Header>
<Appbar.BackAction onPress={this._goBack} />
<Appbar.Content title="Search" />
</Appbar.Header>
{/* <ActivityIndicator animating={true} color={ConstantColors.tintColor}/> */}
<Text> Search Screen </Text>
<ScrollView
style={{ height: "85%", margin: 15 }}
showsVerticalScrollIndicator={false}
showsHorizontalScrollIndicator={false}
>
{busData.map((bus, i) => (
<SearchedSingleBus bus={bus} key={i}/>
))}
</ScrollView>
</View>
);
}
Expand Down

0 comments on commit b7b5c25

Please sign in to comment.