Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created December 9, 2016 03:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanflorence/a6c0a4fe054c87ba5cd28b267dacec1a to your computer and use it in GitHub Desktop.
Save ryanflorence/a6c0a4fe054c87ba5cd28b267dacec1a to your computer and use it in GitHub Desktop.
import React, { Component, PropTypes } from 'react'
import { TouchableHighlight } from 'react-native'
const Nav = ({ to, children, replace=false, ...rest }, { router }) => (
<TouchableHighlight
onPress={() => {
(replace ? router.replaceWith : router.transitionTo)(to)
}}
{...rest}
>{children}</TouchableHighlight>
)
Nav.contextTypes = { router: React.PropTypes.object }
export default Nav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment