【问题标题】:Problems with RCTImage in React NativeReact Native 中的 RCTImage 问题
【发布时间】:2018-09-15 08:55:27
【问题描述】:

我在尝试运行我的 IOS 项目时遇到两个错误。 第一个位于模拟器屏幕上,上面写着: 不变违规:“RCTImageView”的本机组件不存在

这是我在控制台中的错误:ExceptionsManager.js:65 Invariant Violation: View config not found for name RCTImageView

问题是我的 RCTImage 位于 Podfile 中,但是 我在我的节点模块中找不到 RCTImageView,因此我可以将其移动到 Xcode 并手动链接该库。

有人对此有某种解决方案吗?

它说它位于下面的组件内部:

/**
 * A single button as displayed on the main menu
 */
export default class ClockComponent extends Component {
    handlePress() {
        this.props.onPress();
    }

    render() {
        return (
            <NavigationTouch
                onPress={() => this.handlePress()}
                style={Style.mainMenuElementContainer}
            >
                <View style={[Style.mainMenuElement, this.props.colorStyle]}>
                    <Image source={this.props.icon} style={Style.mainMenuElementIcon} resizeMode="contain" />
                    <Text
                        style={Style.text}
                        minimumFontScale={0.9}
                        numberOfLines={3}
                    >
                        {this.props.title}
                    </Text>
                </View>
            </NavigationTouch>
        );
    }
}

【问题讨论】:

    标签: xcode react-native cocoapods


    【解决方案1】:

    RCTImage 将在node_modules/react-native/Libraries/Image 中可用。

    RCTImage.xcodeproj 复制到您的Libraries 文件夹并链接。

    【讨论】:

    • 我在 node_modules/react-native/Libraries/Image 文件夹中找到了 RCTImage.xcodeproj 文件夹。我应该在哪里复制它,xcode 左侧的库已经有那个文件,我怎么能确定我链接了?运行“react-native link”就足够了吗?谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 1970-01-01
    • 1970-01-01
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多