Wireless Buzzer App (Part 3) (HomeScreen.js)

Wireless Buzzer App

(Part 3)


HomeScreen.js:

import * as React from 'react';
import {View,Text,TouchableOpacity,StyleSheetfrom 'react-native';

import AppHeader from "../components/AppHeader";

export default class HomeScreen extends React.Component{

goToBuzzerScreen=()=>{

  this.props.navigation.navigate('BuzzerScreen',{color:"yellow"})
}

  render(){

    return(
      <View>
      <AppHeader/>
      <TouchableOpacity style={styles.button}
      onPress={this.goToBuzzerScreen}><Text style={styles.text}>Go To Buzzer Screen</Text></TouchableOpacity>
      </View>
    )
  }
}

const styles = StyleSheet.create({

  button:{

    justifyContent:"center",
    alignSelf:"center",
    width:200,
    height:50,
    backgroundColor:"black",
    marginTop:150
  },
  text:{
    textAlign:"center",
    color:"white"
  }
})



0 Comments: