在“ App.tsx”中描述了反应导航的设置,“ home.tsx”已导入并显示。 此时,我想在家里显示图标,但是会显示错误消息。
如果运行Expo文档中的示例,图标将正确显示。 https://docs.expo.io/versions/latest/guides/icons/
我认为原因是由于离子子的负载不足以吸引家庭。 如何解决?
App.tsx
import React from 'react'
import { AppRegistry } from 'react-native'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import { Root } from 'native-base'
import { StoreContainer } from './container/store'
import Home from './views/components/screens/Home'
const Stack = createStackNavigator()
export default function App () {
return (
<Root>
<StoreContainer.Provider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name='Home' component={Home} />
</Stack.Navigator>
</NavigationContainer>
</StoreContainer.Provider>
</Root>
)
}
AppRegistry.registerComponent('Sample', () => App)
home.tsx (NOT working)
import React from 'react'
import { View } from 'react-native'
import { Container } from 'native-base'
import { StoreContainer } from '../../../container/store'
import { Ionicons } from '@expo/vector-icons';
export default function Home ({ navigation }) {
const form = StoreContainer.useContainer()
return (
<Container>
<View>
<Ionicons name='md-checkmark-circle' size={32} color='green' />
</View>
</Container>
)
}