0

我们的 React Native 项目使用 react-navigation Stack navigator。它在 Android 中完美运行,但在 ios 中,当我们尝试在 Page.

在 ios 中仅加载第一页。例如,默认的“主页”是第一页,因此 android 和 ios 模拟器都打开第一页。然后,如果我们尝试在 android 导航工作中在它们之间导航,但在 ios 中我们会得到“原始文本错误”。

如果我们更改堆栈导航器的第一页,ios 也会正确加载第一页,但不能按预期在它们之间导航。

我们认为导航页面可能存在问题,因此我们创建了一个空白页面并导航到那里,但问题在 iOS 中仍然存在。

我真的很高兴听到建议。

这是我们在页面之间导航的方式:

this.props.navigation.navigate('ProfileSayfa');

这是我们的 index.android.js 和 index.android.ios:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import {StackNavigator,DrawerNavigator } from "react-navigation";

import LoginPage from "./src/pages/login-page/login-page";
import MainPage from "./src/pages/main-page/main-page";
import MekanAraSonuc from "./src/pages/MekanAra/MekanAraSonuc";
import MekanAra from "./src/pages/main-page/tabs/mekan_ara";
import NewsTab from "./src/pages/main-page/tabs/news-tab";
import StartPage from "./src/pages/start-page/start-page";
import AllMekan from "./src/pages/AllMekan/AllMekan";
import MekanSayfa from "./src/pages/MekanSayfa/MekanSayfa";
import RezervasyonSayfa from "./src/pages/MekanSayfa/RezervasyonSayfa";
import FirsatSayfa from "./src/pages/MekanSayfa/FirsatSayfa";
import EtkinlikSayfa from "./src/pages/MekanSayfa/EtkinlikSayfa";
import ProfileSayfa from "./src/pages/MekanSayfa/ProfileSayfa";
import EtkinlikSonuc from "./src/pages/AllMekan/EtkinlikSonuc";
import FirsatlarSonuc from "./src/pages/AllMekan/FirsatSonuc";
import IconME from 'react-native-vector-icons/FontAwesome';
import Drawer from "./src/pages/MyComponents/Drawer";
import SearchForm from "./src/pages/MyComponents/SearchForm";
import RezervasyonForm from "./src/pages/Forms/RezervasyonForm";
import FirsatForm from "./src/pages/Forms/FirsatForm";
import CalendarListView from "./src/pages/Forms/CalendarListView";


export default class moreAwesome extends Component {
  render() {

        return (
            <LoginApp

                ref={nav => {
                    this.navigator = nav;

                }}
            />
        );
  }
}

const LoginApp = StackNavigator({


            MainPage: {
              screen: MainPage,

            },
            LoginPage: { screen: LoginPage },
            MekanAraSonuc:{screen:MekanAraSonuc},
            MekanAra:{screen:MekanAra},
            NewsTab:{screen:NewsTab},
            AllMekan:{screen:AllMekan},
            MekanSayfa:{screen:MekanSayfa},
            FirsatSayfa:{screen:FirsatSayfa},
            EtkinlikSayfa:{screen:EtkinlikSayfa},
            EtkinlikSonuc:{screen:EtkinlikSonuc},
            FirsatlarSonuc:{screen:FirsatlarSonuc},
            ProfileSayfa:{screen:ProfileSayfa},
            RezervasyonSayfa:{screen:RezervasyonSayfa},
            SearchForm:{screen:SearchForm},
            RezervasyonForm:{screen:RezervasyonForm},
            FirsatForm:{screen:FirsatForm},
            CalendarListView:{screen:CalendarListView},

        });

AppRegistry.registerComponent('myproje', () => moreAwesome);
4

1 回答 1

0

显然,当您为页面创建静态导航选项时,“标题”在 Android 中可以是空字符串,但在 iOS 中则不能。当我们改变这一点时,

  static navigationOptions = ({ navigation }) => {
            return {
                title: '',
                };
            };

对此:

当我们改变这一点时,

 static navigationOptions = ({ navigation }) => {
        return {
            title: ' ',
            };
        };

并且还要小​​心初始页面给出这个错误而不是目标页面!

于 2018-02-08T11:10:32.150 回答