File tree Expand file tree Collapse file tree 2 files changed +30
-7
lines changed
packages/react-native-bottom-tabs/common/cpp/react/renderer/components/RNCTabView Expand file tree Collapse file tree 2 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,33 @@ namespace facebook::react {
5
5
extern const char RNCTabViewComponentName[] = " RNCTabView" ;
6
6
7
7
void RNCTabViewShadowNode::updateStateIfNeeded () {
8
- ensureUnsealed ();
8
+ // ensureUnsealed();
9
+ // const auto &stateData = getStateData();
10
+ // auto frameSize = stateData.frameSize;
11
+ //
12
+ // for (auto &child : getLayoutableChildNodes()) {
13
+ // auto yogaChild = dynamic_cast<YogaLayoutableShadowNode*>(child);
14
+ // yogaChild->getState();
15
+ // if (!yogaChild->getSealed() && yogaChild->getLayoutMetrics().frame.size != frameSize) {
16
+ // yogaChild->setSize(frameSize);
17
+ // }
18
+ // }
19
+
20
+ };
21
+
22
+ void RNCTabViewShadowNode::layout (facebook::react::LayoutContext layoutContext) {
23
+ YogaLayoutableShadowNode::layout (layoutContext);
24
+
25
+ // Now adjust children as needed
9
26
const auto &stateData = getStateData ();
10
27
auto frameSize = stateData.frameSize ;
11
28
12
- for (auto &child : getLayoutableChildNodes ()) {
13
- auto yogaChild = dynamic_cast <YogaLayoutableShadowNode*>(child );
14
- if (! yogaChild-> getSealed () && yogaChild-> getLayoutMetrics (). frame . size != frameSize) {
15
- yogaChild->setSize (frameSize);
16
- }
29
+ for (auto childNode : getLayoutableChildNodes ()) {
30
+ childNode-> ensureUnsealed ( );
31
+ auto yogaChild = dynamic_cast <YogaLayoutableShadowNode*>(childNode);
32
+ yogaChild->setSize (frameSize);
33
+
17
34
}
18
- };
35
+ }
19
36
20
37
}
Original file line number Diff line number Diff line change 7
7
#include < react/renderer/components/RNCTabView/Props.h>
8
8
#include < react/renderer/components/RNCTabView/EventEmitters.h>
9
9
#include < react/renderer/components/view/ConcreteViewShadowNode.h>
10
+ #include < react/renderer/core/LayoutContext.h>
11
+ #include < react/renderer/core/LayoutConstraints.h>
10
12
11
13
namespace facebook ::react {
12
14
@@ -26,6 +28,10 @@ RNCTabViewState>
26
28
using ConcreteViewShadowNode::ConcreteViewShadowNode;
27
29
28
30
void updateStateIfNeeded ();
31
+
32
+ #pragma mark - ShadowNode overrides
33
+
34
+ void layout (LayoutContext layoutContext) override ;
29
35
};
30
36
}
31
37
You can’t perform that action at this time.
0 commit comments