我正在使用react-native和typescript,我正在尝试使用这个模块:https://github.com/GeekyAnts/react-native-easy-grid
我的问题是,我想采用 <Row>
组件,将其放入我自己的类中,并通过以下方式扩展其功能:
Definition of ProfileRow:
class ProfileRow extends React.Component<any, any> {
static defaultProps: Partial<IProfilesRow> = {
id: 0,
cells: []
};
render() {
return (
<Row>
<Text>test</Text>
{this.props.children}
</Row>
);
}
}
export default ProfileRow;
ProfileRow usage:
render(){
return (
<Grid>
<ProfileRow/>
<ProfileRow/>
<ProfileRow/>
</Grid>
)}
当我在Android设备上运行此代码时,行变成一行 . 有人可以解释一下这种扩展的正确方法是什么,以保持 <Row>
的原始属性,使其按预期进入下一行?
I expect this (when <Row> is used as is without subclassing):
but I recieve this: