-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug with UnistylesRuntime.insets on iPhone models with old home button design #336
Comments
should such devices have bottom insets ? |
I don't think they usually have bottom insets, no. But certainly top insets, as there's still the StatusBar |
This also happens on iPhone 15 Pro iOS 18.1 but with a twist |
I'm trying to repro, but it's not easy. console.log(UnistylesRuntime.insets)
export const App: React.FunctionComponent = () => {...} Output:
Insets on iOS platform are synchronous, I've never encountered any issues with them. |
@nthnism I would need a repro to help, tried multiple things, even first breakpoint shows: |
@jpudysz Thanks for the feedback. I see you're running with "fabric":true. A minimal app with our current configuration looks like this (real app not mounted; removed all context providers such as SafeAreaProvider from 'react-native-safe-area-context' used for navigation):
leads to output on iPhone SE - iOS 17.4:
Could you give it a try with those initial settings? EDIT: |
Thanks @nthnism for more details and sorry for the long response. I will take a look tomorrow! |
Hey @nthnism I've created exact same repro with RN 0.75.4 and old arch: import React from 'react';
import { StatusBar, View } from 'react-native';
import { UnistylesRuntime } from 'react-native-unistyles';
console.log('App UnistylesRuntime.insets', UnistylesRuntime.insets);
console.log('App UnistylesRuntime.statusBar.height', UnistylesRuntime.statusBar.height);
const App = () => (
<View>
<StatusBar />
<View />
</View>
);
export default App There is no additional code. I runned it on iPhone SE 3rd gen 17.5:
So I guess something must interfere with Unistyles? IDK I need a repro to help, otherwise it's only guessing. |
Description
Hi there!
First of all, thanks for the awesome library! We really enjoy working with it so far :)
Unfortunately we discovered a bug with older iPhone models. Namely all the ones with the old home button design / without a top notch or dynamic island (e.g. the iPhone SE):
UnistylesRuntime.insets.top reports 0 on development and final builds for those models, while
{top} = useSafeAreaInsets() reports the correct number of 20.
This results in our Scrollview being displayed behind the StatusBar of iOS and is solely depending on the model, not the iOS version.
On dev builds UnistylesRuntime.insets.top will update correctly to 20 only after hot-reloading the app. Please let me know if you need more details to reproduce the issue.
Steps to reproduce
const insets = useSafeAreaInsets();
console.log('insets top UnistylesRuntime', UnistylesRuntime.insets.top);
console.log('insets top useSafeAreaInsets', insets.top);
LOG insets top UnistylesRuntime 0
LOG insets top useSafeAreaInsets 20
Snack or a link to a repository (optional)
No response
Unistyles version
2.10.0
React Native version
0.75.4
Platforms
iOS
Engine
Hermes
Architecture
Paper (old)
The text was updated successfully, but these errors were encountered: