ReactNative调用原生组件报错

276 阅读1分钟

原生封装组件导出给NeactNative使用步骤,官方文档有说明 在NeactNative文件中原生导出组件直接使用,不能在用NeactNative的标签包裹,直接报错

错误代码

return (
            <View>
                <RNImageView
                	{...this.props}
            	/>
            </View>
        );

正确代码

render() {
        return (
            <RNImageView
                {...this.props}
            />
        );
    }