@@ -6,26 +6,24 @@ import { Alert } from 'react-native'
6
6
* The public API for a <Router> designed for React Native. Gets
7
7
* user confirmations via Alert by default.
8
8
*/
9
- class NativeRouter extends React . Component {
10
- static propTypes = {
11
- initialEntries : PropTypes . array ,
12
- initialIndex : PropTypes . number ,
13
- getUserConfirmation : PropTypes . func ,
14
- keyLength : PropTypes . number ,
15
- children : PropTypes . node
16
- }
9
+ const NativeRouter = ( props ) => (
10
+ < MemoryRouter { ...props } />
11
+ )
17
12
18
- static defaultProps = {
19
- getUserConfirmation : ( message , callback ) => {
20
- Alert . alert ( 'Confirm' , message , [
21
- { text : 'Cancel' , onPress : ( ) => callback ( false ) } ,
22
- { text : 'OK' , onPress : ( ) => callback ( true ) }
23
- ] )
24
- }
25
- }
13
+ NativeRouter . propTypes = {
14
+ initialEntries : PropTypes . array ,
15
+ initialIndex : PropTypes . number ,
16
+ getUserConfirmation : PropTypes . func ,
17
+ keyLength : PropTypes . number ,
18
+ children : PropTypes . node
19
+ }
26
20
27
- render ( ) {
28
- return < MemoryRouter { ...this . props } />
21
+ NativeRouter . defaultProps = {
22
+ getUserConfirmation : ( message , callback ) => {
23
+ Alert . alert ( 'Confirm' , message , [
24
+ { text : 'Cancel' , onPress : ( ) => callback ( false ) } ,
25
+ { text : 'OK' , onPress : ( ) => callback ( true ) }
26
+ ] )
29
27
}
30
28
}
31
29
0 commit comments