Skip to content

Instantly share code, notes, and snippets.

View ridgeO's full-sized avatar

Ridge ridgeO

View GitHub Profile
@ridgeO
ridgeO / addTouchableHighlightToGreen.js
Created May 30, 2017 03:57
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
import {
...
TouchableHighlight
} from 'react-native';
...
class GreenScreen extends Component {
@ridgeO
ridgeO / addButtonToStyles.js
Created May 30, 2017 03:58
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# Styles.js
...
button: {
backgroundColor: '#1E90FF',
padding: 20,
borderRadius: 8,
marginTop: 20
}
...
@ridgeO
ridgeO / addBackButtonToRed.js
Created May 30, 2017 04:15
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
class RedScreen extends Component {
render() {
return(
<View style={styles.red}>
<Text style={styles.text}>This is the Red Screen</Text>
<TouchableHighlight
style={styles.button}
@ridgeO
ridgeO / redScreenNavOptions.js
Last active May 30, 2017 05:35
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
RedScreen.navigationOptions = props => {
const { navigation } = props;
return {
headerTitle: 'Red',
headerRight: (<Button title='Purple' onPress={() => navigation.navigate('Purple')}/>),
headerLeft: (<Button title='Blue' onPress={() => navigation.navigate('Blue')}/>)
}
@ridgeO
ridgeO / importButton.js
Created May 30, 2017 04:22
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
import {
...
Button
} from 'react-native';
...
@ridgeO
ridgeO / importTabNavigator.js
Created May 30, 2017 04:30
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
import { StackNavigator, TabNavigator } from 'react-navigation';
...
@ridgeO
ridgeO / createTabNav.js
Created May 30, 2017 04:32
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
const TabNav = TabNavigator(
{
Green: { screen: GreenScreen },
Red: { screen: RedScreen },
Blue: { screen: BlueScreen },
Purple: { screen: PurpleScreen }
},
@ridgeO
ridgeO / addTabNavToApp.js
Created May 30, 2017 04:35
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
class ReactNav extends Component {
render() {
return (
<TabNav/>
);
}
}
@ridgeO
ridgeO / importDrawerNavigator.js
Created May 30, 2017 04:42
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
import { StackNavigator, TabNavigator, DrawerNavigator } from 'react-navigation';
...
@ridgeO
ridgeO / createDrawerNav.js
Created May 30, 2017 04:43
Code snippet from ReactNav application as featured in http://platypus.is/posts/4
# App.js
...
const DrawerNav = DrawerNavigator({
Green: { screen: GreenScreen },
Red: { screen: RedScreen },
Blue: { screen: BlueScreen },
Purple: { screen: PurpleScreen }
})
...