gpt4 book ai didi

react-native - react native : UIkitten Icons typeerror: undefined is not an object (evaluating 'iconsPack.name' )

转载 作者:行者123 更新时间:2023-12-05 08:20:08 25 4
gpt4 key购买 nike

我试图在 UI Kitten 中使用 Eva 图标,但最终遇到了这个错误,我在这个问题上花了一段时间,React 和 Reavt-Native 的新手,如果有人能帮助我,我会很高兴 (:

render()
const FacebookIcon = (props) => (
<Icon name='facebook' {...props} />
);
return(
<Input
value={this.state.id}
label="FB ID"
size="medium"
placeholder="Enter your fb_id"
onChangeText={(enteredText) => this.setState({ fbId: enteredText })}
accessoryLeft={FacebookIcon}
/>


)

最佳答案

首先,运行这个命令:

npm i @ui-kitten/eva-icons react-native-svg

然后用IconRegistry注册一个图标包。

正如 docs 中提到的那样

import React from 'react';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, IconRegistry, Layout, Text } from '@ui-kitten/components';
import { EvaIconsPack } from '@ui-kitten/eva-icons';

const HomeScreen = () => (
<Layout style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text category='h1'>HOME</Text>
</Layout>
);

export default () => (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider {...eva} theme={eva.light}>
<HomeScreen />
</ApplicationProvider>
</>
);

关于react-native - react native : UIkitten Icons typeerror: undefined is not an object (evaluating 'iconsPack.name' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61540905/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com