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