Navigator会导致不断的违规

问题描述 投票:0回答:1

我试图创建一个新的React-Native项目并包含一个Navigator。但这会导致错误。

enter image description here

import React from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  Text,
  StatusBar, Navigator, TouchableHighlight
} from 'react-native';


const App: () => React$Node = () => {
  return (
    <>
      <Navigator
        initialRoute={{title: 'Awesome Scene', index: 0}}
        renderScene={(route, navigator) => <Text>Hello {route.title}!</Text>}
        style={{padding: 100}}
      />
    </>
  );
};

export default App;

这同时在Android和iOS上发生。

-react-native:“ 0.61.2”,

react-native
1个回答
0
投票

我尝试过您的代码

const App: () => React$Node = () => {

您无法使用:声明类似的const>

将其更改为=这将解决您的问题

const App = () => React$Node = () => {
© www.soinside.com 2019 - 2024. All rights reserved.