Skip to content

Commit 28af2bc

Browse files
committed
add a wrapper view in BottomAccessoryRepresentableView
1 parent 078939b commit 28af2bc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/react-native-bottom-tabs/ios/TabView/NewTabView.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,19 @@ struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
102102
var view: PlatformView
103103

104104
func makeUIView(context: Context) -> PlatformView {
105+
let wrapper = UIView()
106+
wrapper.addSubview(view)
107+
108+
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
109+
105110
emitPlacementChanged(for: view)
106-
return view
111+
return wrapper
107112
}
108113

109114
func updateUIView(_ uiView: PlatformView, context: Context) {
115+
if let subview = uiView.subviews.first {
116+
subview.frame = uiView.bounds
117+
}
110118
emitPlacementChanged(for: view)
111119
}
112120

@@ -117,7 +125,7 @@ struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
117125
var placementValue = "none"
118126
if tabViewBottomAccessoryPlacement == .inline {
119127
placementValue = "inline"
120-
} else if tabViewBottomAccessoryPlacement == .expanded {
128+
} else if (tabViewBottomAccessoryPlacement == .expanded) {
121129
placementValue = "expanded"
122130
}
123131
uiView.perform(selector, with: placementValue)

0 commit comments

Comments
 (0)