import React, { PropTypes } from 'react'
import MemoryRouter from 'react-router/MemoryRouter'
import { AsyncStorage, View } from 'react-native'

class StoreHistory extends React.Component {
  static contextTypes = {
    router: PropTypes.object.isRequired
  }

  componentDidMount() {
    this.store()
  }

  componentDidUpdate() {
    this.store()
  }

  store() {
    const { router: { entries, index } } = this.context
    AsyncStorage.setItem('history', JSON.stringify({ entries, index }))
  }

  render() {
    return this.props.children
  }
}

class NativeRouter extends React.Component {
  state = {
    savedHistory: null
  }

  componentDidMount() {
    AsyncStorage.getItem('history', (err, history) => {
      this.setState({
        savedHistory: history ? JSON.parse(history) : {
          entries: [ '/' ],
          index: 0
        }
      })
    })
  }

  render() {
    const { children } = this.props
    const { savedHistory } = this.state

    return savedHistory != null ? (
      <MemoryRouter
        initialEntries={savedHistory.entries}
        initialIndex={savedHistory.index}
      >
        <StoreHistory>
          {React.Children.only(children)}
        </StoreHistory>
      </MemoryRouter>
    ) : null
  }
}

export default NativeRouter

@@ -114,12 +114,13 @@
 ge, 
-View
+Alert
  %7D f
@@ -548,52 +548,565 @@
 %0A%7D%0A%0A
-class NativeRouter extends React.Component %7B
+/**%0A * The public API for a %3CRouter%3E designed for React Native. Stores%0A * locations using AsyncStorage and prompts using Alert.%0A */%0Aclass NativeRouter extends React.Component %7B%0A  static propTypes = %7B%0A    getUserConfirmation: PropTypes.func,%0A    keyLength: PropTypes.number,%0A    children: PropTypes.node%0A  %7D%0A%0A  static defaultProps = %7B%0A    getUserConfirmation: (message, callback) =%3E %7B%0A      Alert.alert('Confirm', message, %5B%0A        %7B text: 'Cancel', onPress: () =%3E callback(false) %7D,%0A        %7B text: 'OK', onPress: () =%3E callback(true) %7D%0A      %5D)%0A    %7D%0A  %7D%0A
 %0A  s
@@ -1402,16 +1402,48 @@
  const %7B
+ getUserConfirmation, keyLength,
  childre
@@ -1644,16 +1644,96 @@
 .index%7D%0A
+        getUserConfirmation=%7BgetUserConfirmation%7D%0A        keyLength=%7BkeyLength%7D%0A
       %3E%0A

Add default for <NativeRouter getUserConfirmation>