reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
216 stars 328 forks source link

安装完react-native-navigation库设置自定义启动页之后iOS app启动之后挂起无反应 #583

Closed yubei198601 closed 2 years ago

yubei198601 commented 2 years ago

请按以下格式提供问题的相关信息。 1.react-native版本为最新的0.68; 2.按照官网的步骤https://wix.github.io/react-native-navigation/docs/installing安装了react-native-navigation; 3.执行react-native run-ios编译正常通过,一直停留在一个挂起的界面。

package.json内容如下: { "name": "helloHello", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "react": "17.0.2", "react-native": "0.68.0", "react-native-navigation": "^7.26.0", "react-native-vector-icons": "^9.1.0" }, "devDependencies": { "@babel/core": "^7.17.8", "@babel/runtime": "^7.17.8", "@react-native-community/eslint-config": "^3.0.1", "babel-jest": "^27.5.1", "eslint": "^8.12.0", "jest": "^27.5.1", "metro-react-native-babel-preset": "^0.70.0", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } }

App.js的代码如下: import { StyleSheet, Text, View,SafeAreaView } from 'react-native' import React from 'react' //https://reactnative.directory/?search=react-native-vector-icons //npm install --save react-native-vector-icons //npx react-native link react-native-vector-icons import Icon from 'react-native-vector-icons/Fonts/FontAwesome.ttf' const App = () => { return ( <>

Android iOS React Native {/* */}
</>

) }

export default App

const styles = StyleSheet.create({ container:{ backgroundColor: 'green',

}, headerTitle:{ marginLeft: 16, marginRight: 16, height: 45, display: 'flex', flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center' } })

index.js代码如下: import { Navigation } from 'react-native-navigation'; import App from './App'; Navigation.registerComponent('App', () => App); // import {MainRoot} from './src/navigation' Navigation.events().registerAppLaunchedListener(() => { Navigation.setRoot({ root: { stack: { children: [ { component: { name: 'App' } } ] } } }); // Navigation.setRoot(App); }); 各位大神,帮忙看看问题出在哪里呢?