從 '../../Components/TopNavigation' 導(dǎo)入 TopNavigation;
<p><代碼> 我認(rèn)為在TopNavigation元件的程式碼中存在問題。
我在codesandbox中嘗試了相同的程式碼,問題似乎與Entypo元件有關(guān)。
嘗試刪除Entypo元件的使用,並使用另一種解決方法取代Entypo。
嘗試下面的解決方案,希望對(duì)你有用。
例如:
import { StyleSheet, View, Image } from 'react-native' import React from 'react' import logo from '../../assets/Logo.png'; import { icons1, logo2 } from '../Styles/styles'; import { Ionicons } from 'react-native-vector-icons'; import { Entypo } from 'react-native-vector-icons'; export default TopNavigation = ({ navigation, page }) => { return ( <View style={page === 'home' ? styles.container : { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%', paddingVertical: 10, position: 'absolute', top: 0, zIndex: 100, backgroundColor: 'black', }}> { page === 'home' ? <Image source={logo} style={logo2} /> : <Image /> } { page === 'profile' && <Ionicons name="settings-sharp" size={24} color="black" style={styles.icons11} onPress={() => navigation.navigate('settings')} /> } </View> ) }