Last active
January 11, 2017 17:30
-
-
Save alaingoldman/93b322a6cfb97788d64720b9471deaf2 to your computer and use it in GitHub Desktop.
Class Notes compendium
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
<Image source={require('./example.png')}> |
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
blah |
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 DrawerLayout from 'react-native-drawer-layout'; | |
export default class Inside extends Component { | |
openSideBar(){ | |
this.refs['DRAWER'].openDrawer(); | |
} | |
render() { | |
var navigationView = | |
<View style={{flex: 1, backgroundColor: '#fff'}}> | |
<Text style={{margin: 10, fontSize: 15, textAlign: 'left'}}>Im in the Drawer!</Text> | |
</View>; | |
return ( | |
<DrawerLayout | |
drawerWidth={300} | |
ref={'DRAWER'} | |
drawerPosition={DrawerLayout.positions.Left} | |
renderNavigationView={() => navigationView}> | |
<View style={styles.drawme}> | |
<TouchableHighlight onPress={this.openSideBar.bind(this)}> | |
<View style={styles.somebutton}></View> | |
</TouchableHighlight> | |
</View> | |
</DrawerLayout> | |
); | |
} | |
} |
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
//how to set a state | |
constructor(props) { | |
super(props); | |
this.state = { | |
exstate: 'value' | |
}; | |
} |
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 { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View, | |
TouchableHighlight, | |
StatusBar, | |
Navigator, | |
} from 'react-native'; | |
import Login from './Login' | |
export default class testcoolapp extends Component { | |
renderScene(route, navigator){ | |
return <route.component navigator={navigator} props={route.passProps} /> | |
} | |
render() { | |
return ( | |
<Navigator | |
initialRoute={{component: Login}} | |
renderScene={this.renderScene}/> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
}, | |
}); | |
AppRegistry.registerComponent('testcoolapp', () => testcoolapp); |
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
renderScene(route, navigator){ | |
return <route.component navigator={navigator} props={route.passProps} /> | |
} | |
render() { | |
return ( | |
<Navigator | |
initialRoute={{component: Login}} | |
renderScene={this.renderScene}/> | |
); | |
} |
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 { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View, | |
Navigator, | |
Image, | |
TouchableHighlight, | |
} from 'react-native'; | |
import Register from './Register'; | |
export default class Login extends Component { | |
linker(comp){ | |
this.props.navigator.push({ | |
component: comp | |
}) | |
} | |
render() { | |
return ( | |
<Image source={require('./lin.png')} style={styles.container}> | |
<Image source={require('./logo.png')} style={styles.logoh} resizeMode={'contain'}/> | |
<TouchableHighlight onPress={this.linker.bind(this, Register)} underlayColor={'transparent'}> | |
<View style={styles.bigbutt}></View> | |
</TouchableHighlight> | |
</Image> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
height: null, | |
width: null, | |
alignItems: "center" | |
}, | |
bigbutt: { | |
backgroundColor: "rgb(0,235,194)", | |
height:60, | |
width:300, | |
}, | |
logoh: { | |
width: 100, | |
} | |
}); |
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 { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View, | |
Navigator, | |
Image, | |
TouchableHighlight, | |
} from 'react-native'; | |
export default class Register extends Component { | |
returner() { | |
this.props.navigator.pop(); | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<TouchableHighlight onPress={this.returner.bind(this)}> | |
<View style={styles.bigbutt}></View> | |
</TouchableHighlight> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: "white" | |
}, | |
bigbutt: { | |
backgroundColor: "rgb(0,235,194)", | |
height:60, | |
width:300, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment