-
Notifications
You must be signed in to change notification settings - Fork 99
fix: popover not showing when using new architecture #185
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
Conversation
Nice! Will have a look later today |
Actually I just realized this is still not ideal, since having |
Hmm, would it make sense to measure the navigation bar height and include that value in the Rect calculations? I've done so in several projects in similar situations. Example: import { Dimensions } from 'react-native'
const windowSize = Dimensions.get('window')
const screenSize = Dimensions.get('screen')
const navigationBarHeight = screenSize.height - windowSize.height |
@AdamGerthel Is that different from |
Ah, sorry, I wasn't thinking straight. Navigation Bar is the one at the bottom. So if |
Alternatively we could probably adjust verticalOffset instead of changing Rect calculations? (If on Android and statusBarTranslucent is true - add StatusBar.currentHeight to it). |
As a new default value on |
I was thinking something like this (din't test it yet): Change
To
|
I just pushed my updates, just need to re-check them with the test app. |
f75b3b3
to
d0e3182
Compare
I just tested all combinations that I could think of, and looks good to me. Old ArchStatus bar on screen: non-translucent old-arch-non-translucent-both.movStatus bar on screen: non-translucent old-arch-translucent-popover-only.movStatus bar on screen: translucent old-arch-non-translucent-popover-only.movStatus bar on screen: translucent old-arch-translucent-both.movNew ArchStatus bar on screen: non-translucent new-arch-non-translucent-both.movStatus bar on screen: non-translucent new-arch-translucent-popover-only.movStatus bar on screen: translucent new-arch-non-translucent-popover-only.movStatus bar on screen: translucent new-arch-translucent-both.movThe cases where status bar translucency on screen is different from the status bar translucency on the popover used to work correctly only with the use of |
This would be a breaking change for people who were using the |
Nice work! I think we should release this as a new major version since it's breaking. I think we should take the opportunity to remove |
package.json
Outdated
@@ -65,5 +65,6 @@ | |||
"dependencies": { | |||
"prop-types": "^15.8.1", | |||
"deprecated-react-native-prop-types": "^2.3.0" | |||
} | |||
}, | |||
"packageManager": "yarn@1.22.22" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'd like to specify the package manager, I think we can leave this change out from this PR and I'll upgrade to the latest yarn version in another commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll remove it. yarn kept adding it, so I decided to commit it, but I agree it's not related to these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it
@AdamGerthel If we remove |
But there could be users that are using |
True, I was using your assumption that it only exists for that purpose. |
Should I remove the verticalOffset prop in this PR too? |
Ok, might as well 👍 |
`NativeModules.UIManager.measure(...)` does not work when new architecture is enabled. `ref.current.measureInWindow(...)` works on both old and new architecture and returns the same values, except one case: when the status bar is translucent on Android, it substracts the height of the status bar from the "y" value (see SteffeyDev#182 (comment)). This means we need to adjust the verticalOffset on Android when the status bar is translucent. To ensure that we always know whether the status bar is translucent or not, we'll default the value of statusBarTranslucent to true when not passed explicitly (which is more similar to iOS) instead of passing undefined to RN Modal. Since the only intended purpose the `verticalOffset` prop was to correct manually the position on Android and now it's adjusted internally, we don't need that prop anymore and we are removing it.
Done, doing a quick re-check now to ensure everything still works properly. |
Checked, looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 🙌
BTW, the addition of the default value (true) for statusBarTranslucent can be considered a breaking change too for users that don't pass a value explicitly. |
Thank you both for working on this! |
@arpitdalal Thank you too! |
FYI, the 6.0.0 release did not include the change. I hadn't figured out where NPM got the dist files from and made an error. 6.0.1 should be good to go. |
NativeModules.UIManager.measure(...)
does not work when new architecture is enabled.ref.current.measureInWindow(...)
works on both old and new architecture and returns the same values, except one case: when the status bar is translucent on Android, it substracts the height of the status bar from the "y" value (see #182 (comment)). This means we need to adjust the verticalOffset on Android when the status bar is translucent. To ensure that we always know whether the status bar is translucent or not, we'll default the value of statusBarTranslucent to true when not passed explicitly (which is more similar to iOS) instead of passing undefined to RN Modal.Since the only intended purpose the
verticalOffset
prop was to correct manually the position on Android and now it's adjusted internally, we don't need that prop anymore and we are removing it.