Skip to content
Permalink
Browse files

Refactor BookStack and AuthorStack views

  • Loading branch information...
Qaiser Abbas Qaiser Abbas
Qaiser Abbas authored and Qaiser Abbas committed May 12, 2018
1 parent 870eeba commit d0377da1c3797e2dd9a35237533ae5815af1b582
Showing with 40 additions and 38 deletions.
  1. +5 −38 App.js
  2. +16 −0 src/views/author/index.js
  3. +19 −0 src/views/book/index.js
43 App.js
@@ -1,43 +1,10 @@
import React from 'react'
import { View, Button } from 'react-native'
import { createDrawerNavigator, createStackNavigator } from 'react-navigation'

const BooksScreen = ({ navigation }) => (
<View>
<Button
onPress={() => navigation.navigate('Authors')}
title="Go to Authors"
/>
<Button onPress={() => navigation.openDrawer()} title="Open Drawer" />
</View>
)

const AuthorsScreen = ({ navigation }) => (
<Button
onPress={() => navigation.navigate('Books')}
title="Go back to Books"
/>
)

export const BookStack = createStackNavigator({
Books: {
screen: BooksScreen,
},
})

export const AuthorStack = createStackNavigator({
Authors: {
screen: AuthorsScreen,
},
})
import { createDrawerNavigator } from 'react-navigation'
import BookStack from './src/views/book'
import AuthorStack from './src/views/author'

const App = createDrawerNavigator({
Books: {
screen: BookStack,
},
Authors: {
screen: AuthorStack,
},
Books: BookStack,
Authors: AuthorStack,
})

export default App
@@ -0,0 +1,16 @@
import React from 'react'
import { createStackNavigator } from 'react-navigation'
import { Button } from 'react-native'

const AuthorsScreen = ({ navigation }) => (
<Button
onPress={() => navigation.navigate('Books')}
title="Go back to Books"
/>
)

export default createStackNavigator({
Authors: {
screen: AuthorsScreen,
},
})
@@ -0,0 +1,19 @@
import React from 'react'
import { createStackNavigator } from 'react-navigation'
import { View, Button } from 'react-native'

const BooksScreen = ({ navigation }) => (
<View>
<Button
onPress={() => navigation.navigate('Authors')}
title="Go to Authors"
/>
<Button onPress={() => navigation.openDrawer()} title="Open Drawer" />
</View>
)

export default createStackNavigator({
Books: {
screen: BooksScreen,
},
})

0 comments on commit d0377da

Please sign in to comment.
You can’t perform that action at this time.