Skip to content

Commit 8673832

Browse files
committed
Simplify <NativeRouter> impl
1 parent 7160fb0 commit 8673832

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

packages/react-router-native/NativeRouter.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import React, { PropTypes, Component } from 'react'
1+
import React, { PropTypes } from 'react'
22
import MemoryRouter from 'react-router/MemoryRouter'
33
import { Alert } from 'react-native'
44

55
/**
6-
* The public API for a <Router> designed for React Native. Stores
7-
* locations using AsyncStorage and prompts using Alert.
6+
* The public API for a <Router> designed for React Native. Gets
7+
* user confirmations via Alert by default.
88
*/
9-
class NativeRouter extends Component {
9+
class NativeRouter extends React.Component {
1010
static propTypes = {
11+
initialEntries: PropTypes.array,
12+
initialIndex: PropTypes.number,
1113
getUserConfirmation: PropTypes.func,
1214
keyLength: PropTypes.number,
1315
children: PropTypes.node
@@ -23,18 +25,7 @@ class NativeRouter extends Component {
2325
}
2426

2527
render() {
26-
const { initialEntries, initialIndex, getUserConfirmation, keyLength, children } = this.props
27-
28-
return (
29-
<MemoryRouter
30-
initialEntries={initialEntries}
31-
initialIndex={initialIndex}
32-
getUserConfirmation={getUserConfirmation}
33-
keyLength={keyLength}
34-
>
35-
{React.Children.only(children)}
36-
</MemoryRouter>
37-
)
28+
return <MemoryRouter {...this.props}/>
3829
}
3930
}
4031

0 commit comments

Comments
 (0)