0
这是一个普遍的问题,因为我没有在任何地方看到过任何类似的东西。 因此,如果我有一个像下面的例子一样的父组件,并且我要在父项中呈现子项的子项,如果可能(除了在父项中创建getParentComponent(children)方法),我该如何执行此操作。 是不是有一个当孩子渲染被称为子内容自动插入?扩展一个父级并使用父级渲染方法反应原生
import React, {Component} from 'react';
import {View} from 'react--native;
class CustomView extends Component {
render() {
return (
<View style={styels.customStyle}>
// this is where I want to render my child content
</View>
)
}
}
import React, {Component} from 'react';
import {CustomView} from 'somewhere;
class ChildView extends CustomView {
render() {
return (
<View style={styels.childStyle}>
// take this view and all the content with in and render it in the parent render
</View>
)
}
}
非常感谢。我有一个解决方案,我会重新发布我的答案。但我检查了你发送的文件,你是对的。谢谢 – TheMan68