2017-04-24 63 views
1

我在嘗試使用pepperoni-app-kit使用react-navigation來創建移動應用的原型。但是我發現自己無法爲應用程序添加新的屏幕;就好像屏幕不存在一樣。如何使用react-native-navigation(使用pepperoni-starter-pack)添加新屏幕?

以下是它的使用方法react-navigation。我添加了Pizza屏幕。

import {TabNavigator, StackNavigator} from 'react-navigation' 

export const MainScreenNavigator = TabNavigator({ 
    Pizza: {screen: PizzaLocator}, 
    Counter: {screen: CounterViewContainer}, 
    Color: {screen: ColorViewContainer}, 
}, { 
    tabBarOptions: { 
    ...Platform.select({ 
     android: { 
     activeTintColor: activeColor, 
     indicatorStyle: {backgroundColor: activeColor}, 
     style: {backgroundColor: headerColor} 
     } 
    }) 
    } 
}) 

對於這個新的屏幕,我模仿其他屏幕在入門包:

class PizzaLocator extends Component { 
    static displayName = "PizzaLocator" 

    static navigationOptions = { 
    title: 'Pizza', 
    tabBarLabel: "Pizza", 
    tabBar:() => ({ 
     icon: (props) => (
     <Icon name='pizza' size={24} color="Yellow" /> 
    ) 
    }), 
    // TODO: move this into global config? 
    header: { 
     tintColor: 'white', 
     style: { backgroundColor: '#39babd' } 
    } 
    } 

    render() { 
    return (
     <View style={styles.container}> 
     <Text>{"It's dangerous to go alone; take this map."}</Text> 
     </View> 
    ) 
    } 
} 

我也試過在一個平凡的PizzaLocatorContainer(他們做的最多的是connect(Thing))包裝紙PizzaLocator他們在其他屏幕上做,但它並沒有改變一件事。

我錯過了什麼?辣椒醬使用react-navigation非標準嗎?謝謝!

回答

0

在終端工具,cd到香腸的項目,輸入命令:紗加反應導航,然後執行:反應本地運行IOS