Skip to content

Commit 8831626

Browse files
committed
feat: add insets to windows
1 parent 46e6f1b commit 8831626

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

windows/ReactNativeUnistyles/ReactNativeUnistyles.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Unistyles {
3939
auto bounds = Window::Current().Bounds();
4040

4141
if (this->unistylesRuntime != nullptr) {
42-
((UnistylesRuntime*)this->unistylesRuntime)->handleScreenSizeChange((int)bounds.Width, (int)bounds.Height);
42+
((UnistylesRuntime*)this->unistylesRuntime)->handleScreenSizeChange((int)bounds.Width, (int)bounds.Height, this.getInsets(), this.getStatusBarDimensions());
4343
}
4444
}));
4545

@@ -94,7 +94,9 @@ struct Unistyles {
9494
uiInfo.screenWidth,
9595
uiInfo.screenHeight,
9696
uiInfo.colorScheme,
97-
uiInfo.contentSizeCategory
97+
uiInfo.contentSizeCategory,
98+
this->getInsets(),
99+
this->getStatusBarDimensions()
98100
);
99101

100102
unistylesRuntime->onThemeChange([this](std::string theme) {
@@ -192,6 +194,26 @@ struct Unistyles {
192194

193195
return UnistylesUnspecifiedScheme;
194196
}
197+
198+
std::map<std::string, int>getInsets() {
199+
std::map<std::string, int> insets;
200+
201+
insets.insert({ "top", 0 });
202+
insets.insert({ "bottom", 0 });
203+
insets.insert({ "left", 0 });
204+
insets.insert({ "right", 0 });
205+
206+
return insets;
207+
}
208+
209+
std::map<std::string, int>getStatusBarDimensions() {
210+
std::map<std::string, int> statusBar;
211+
212+
statusBar.insert({ "height", 0 });
213+
statusBar.insert({ "width", 0 });
214+
215+
return statusBar;
216+
}
195217
};
196218

197219
} // namespace winrt::ReactNativeUnistyles

0 commit comments

Comments
 (0)