1

在我的 index.ios.js 文件中使用以下代码时出现错误:

import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import { Actions, Router, Route, Scene } from 'react-native-router-flux';

import {Categories} from './Components/Categories';
import {CarRacing} from './Components/CarRacing';

const scenes = Actions.create(
  <Scene key="root">
      <Scene key="Categories" name="Categories" component={Categories} title="Categories" initial={true}/>
      <Scene key="CarRacing" name="CarRacing" component={CarRacing} title="CarRacing"/>
  </Scene>
);

export default class Motorsport extends Component {
  render() {
    return (
        <Router scenes={scenes}/>
    );
  }
}

AppRegistry.registerComponent('Motorsport', () => Motorsport);

类别是由“react-native-tableview”完成的表格视图中的类别列表。单击 CarRacing TableView 行时,出现以下错误:

route.children.forEach is not a function. (In 'route.children.forEach(function(r,i) {(0,_Util.assert)(scenes[r],'Empty scene for key='+route.key);if*scenes[r].inital) {index=i;}})','route.children.forEach' is undefined)

我不确定我在这里做错了什么。我理解这个错误,但我不太明白我在代码中做了什么来搞砸这个。

有任何想法吗?谢谢!

4

0 回答 0