我知道react-native库的包装中的native-base,但是有些组件可以从react-native以及从native-base导入,例如View,Text等。这两个导入组件之间的区别。我是新来的反应本地人,只是想知道。
答案 0 :(得分:1)
Native Base使用原始的反应本机视图并将其扩展一点。
以下是本机基础视图中的完整代码:
import React, { Component } from "react";
import PropTypes from "prop-types";
import { View, ViewPropTypes } from "react-native";
import { connectStyle } from "native-base-shoutem-theme";
import mapPropsToStyleNames from "../utils/mapPropsToStyleNames";
class ViewNB extends Component {
render() {
return <View ref={c => (this._root = c)} {...this.props} />;
}
}
ViewNB.propTypes = {
...ViewPropTypes,
style: PropTypes.oneOfType([
PropTypes.object,
PropTypes.number,
PropTypes.array
])
};
const StyledViewNB = connectStyle(
"NativeBase.ViewNB",
{},
mapPropsToStyleNames
)(ViewNB);
export { StyledViewNB as ViewNB };
来源:https://github.com/GeekyAnts/NativeBase/blob/master/src/basic/View.js
答案 1 :(得分:0)
我对此进行了更多诊断,并获得了连锁反应和厨房链接,从而使每个组件的信息更加清晰