react-native NavigatorIOS 使用方法

import React, {Component} from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    View,
    NavigatorIOS,
    TouchableOpacity
} from 'react-native';

export default class App extends Component {
    render() {
        return (
            
        );
    }
}
class Home extends Component {
    _onPressView(nextRoute) {
        this.props.navigator.push(nextRoute)
    }

    render() {
        const nextRoute = {
            component: Detail,//目的地视图
            title: '详情',//目的地标题
            titleTextColor: 'blue',//标题颜色
            shadowHidden: true,//决定是否要隐藏1像素的阴影
            barTintColor: 'white',//导航条的背景颜色
            tintColor: 'orange',  // 按钮的颜色
            leftButtonTitle: '返回',//导航条的左按钮
            onLeftButtonPress: () => {
                this.props.navigator.pop()
            },
            rightButtonTitle: '相册',//导航条的右按钮
            onRightButtonPress: () => {//导航条右按钮触发事件
                alert('没有该照片');
            },
            passProps: {myProp: 'bar'}
        };
        return (
            
                 {
                        this._onPressView(nextRoute)
                    }}
                >
                    {"详情!"}
                
            
        )
    }
}
class Detail extends Component {

    render() {
        return (
            
                 {
                        this.props.navigator.pop()
                    }}
                >
                    {"首页!"}
                
            
        )
    }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: 'red',
    }
});

你可能感兴趣的:(react-native NavigatorIOS 使用方法)