Created
September 13, 2018 18:59
-
-
Save mjonesjr90/2aea4504c5b8bcd6a7c5c127a718a223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {Platform, StyleSheet, Text, View, Image, Button} from 'react-native'; | |
import ToastModule from 'react-native-toast-library'; | |
import RNAdCall from 'react-native-ad-call'; | |
type Props = {}; | |
var pic = {uri: 'https://developer.android.com/images/brand/Android_Robot_200.png'}; | |
var osName = 'Android'; | |
class OS extends Component { | |
render() { | |
return ( | |
<Text style={{fontSize: 30}}>{this.props.name}</Text> | |
); | |
} | |
} | |
export default class App extends Component<Props> { | |
constructor(props) { | |
super(props); | |
//setup state | |
this.state = { | |
displayOS: 'android' | |
}; | |
} | |
renderPage = () => { | |
if(osName === "Android") { | |
pic = {uri: 'https://www.apple.com/ios/images/og.png?201805211344'} | |
osName = 'iOS'; | |
console.log('changing to ios'); | |
ToastModule.show('Android'); | |
return this.setState({displayOS: 'ios'}); | |
} | |
else{ | |
pic = {uri: 'https://developer.android.com/images/brand/Android_Robot_200.png'}; | |
osName = 'Android'; | |
console.log('changing to android'); | |
ToastModule.show('iOS'); | |
return this.setState({displayOS: 'android'}); | |
} | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Image source={pic} style={{width:200, height:237}}/> | |
<OS name={osName}/> | |
<Button | |
onPress={() => RNAdCall.callBannerActivity()} | |
title="Ad Request" | |
color="#000000" | |
accessibilityLabel="Ad Request" | |
/> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#FFFFFF', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment