Skip to content

Instantly share code, notes, and snippets.

@zehfernandes
Last active November 14, 2018 21:40
Show Gist options
  • Save zehfernandes/dcd96604d1de04c054b909d86b5a19a9 to your computer and use it in GitHub Desktop.
Save zehfernandes/dcd96604d1de04c054b909d86b5a19a9 to your computer and use it in GitHub Desktop.
Workshop React Native - Part 2
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { createStackNavigator } from "react-navigation";
import HomePage from "./pages/Home";
import CheckinPage from "./pages/Checkin";
export default createStackNavigator(
{
Home: {
screen: HomePage
},
Checkin: {
screen: CheckinPage
}
}
);
import React from "react";
import {
StyleSheet,
Text,
View,
Image,
Dimensions,
TouchableWithoutFeedback
} from "react-native";
const { width, height } = Dimensions.get("window");
export default class Home extends React.Component {
render() {
return (
<View style={styles.container}>
<Image
source={require("../assets/checkin.png")}
style={{
width,
height
}}
/>
<TouchableWithoutFeedback
onPress={() => {
this.props.navigation.navigate("Home");
}}>
<View
style={styles.backLinkContainer}
/>
</TouchableWithoutFeedback>
</View>
);
}
}
const styles = StyleSheet.create({
backLinkContainer: {
width: '30%',
height: '7%',
position: "absolute",
bottom: '4%',
right: '20%'
}
});
import React from "react";
import {
StyleSheet,
ScrollView,
Text,
View,
Image,
Dimensions,
StatusBar,
TouchableWithoutFeedback,
Alert
} from "react-native";
const { width, height } = Dimensions.get("window");
// const width = Dimensions.get().width
// const height = Dimensions.get().height
export default class Home extends React.Component {
handlerSelfieCheckin = () => {
this.props.navigation.navigate("Checkin");
};
render() {
return (
<ScrollView bounces={false}>
<StatusBar hidden={true} />
<Image
source={require("../assets/mainpage.png")}
style={styles.mainImage}
/>
<TouchableWithoutFeedback onPress={this.handlerSelfieCheckin}>
<View
style={{
backgroundColor: "rgba(0,0,0,0.5)",
position: "absolute",
top: "18%",
left: "7%",
width: "40%",
height: "7%"
}}
/>
</TouchableWithoutFeedback>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "white",
alignItems: "center",
justifyContent: "center"
},
mainImage: {
width: width,
height: 2714 / 2,
resizeMode: "contain"
},
text: {
fontFamily: "Helvetica"
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment