Picker's popup has a parallax effect
Environment
react-native -v: react-native-cli: 2.0.1 react-native: 0.60.6npm ls rnpm-plugin-windows: [email protected]npm ls react-native-windows: [email protected]node -v: v10.15.0npm -v: 6.13.1
Then, specify:
- Target Platform Version(s): 10.0.18362.0
- Target Device(s): Desktop
- Visual Studio Version: 2017
- Build Configuration: Debug
Steps to Reproduce
- Create a Picker
- Observe that the picker's popup changes based on its position in the window:
- If the Picker is in the top-left corner of the app window, the popup will be up and to the left
- If the Picker is in the top-right corner of the app window, the popup will be up and to the right
- If the Picker is in the bottom-left corner of the app window, the popup will be down and to the left
- If the Picker is in the bottom-right corner of the app window, the popup will be down and to the right
Example code:
import * as RN from "react-native";
render() {
return (
<RN.Picker>
<Picker.Item label="Any" value="Any" />
</RN.Picker>
);
}
Expected Behavior
I expected the popup to appear directly on top of the Picker regardless of the Picker's position in the app window.
Actual Behavior
The popup does not appear directly on top of the Picker depending on the Picker's position in the app window:
- If the Picker is in the top-left corner of the app window, the popup will be up and to the left
- If the Picker is in the top-right corner of the app window, the popup will be up and to the right
- If the Picker is in the bottom-left corner of the app window, the popup will be down and to the left
- If the Picker is in the bottom-right corner of the app window, the popup will be down and to the right
Screenshots
Top left:
Top right:
Bottom left:
Bottom right:
If this parallax effect is expected behavior, is there a way to disable it?
This is by design behavior for XAML, and would be difficult to change.
I am implementing a custom native ViewManager for AutoSuggestBox. I am experiencing the same behavior there that I saw when working with Picker previously, as noted in this Issue.
Here are two screenshots. The first is of an AutoSuggestBox in the top-right corner of the application which has its results moved up and to the right, and the second is of an AutoSuggestBox in the top-left corner of the application which has its results moved up and to the left.
Compare this with the XAML Controls Gallery (which can be installed from the Microsoft Store here or by downloading the source here), where the results display directly underneath the box as expected:
If the XAML Controls Gallery can display it correctly, I believe it should display the same in RNW.
@kmelmon @acoates-ms
Reactivating as this sounds like a layout bug for Flyout. The only case I can think of where this would be expected is if the app window is too small to display the Flyout without repositioning.
I believe we have pages in RNTester with Picker. @jagorrin can you confirm the issue for Picker repro's in a small standalone app?
Getting a minimum repo of this is going to be important. Also determining if this is true just for the wrapped AutoSuggestBox or also true for Picker. Keith thinks this may be an issue with how the Yoga layout from RN is interacting with XAML layout.
@kmelmon @chrisglein Here is a minimum repro for Picker: https://github.com/jagorrin/PickerFlyoutRepro/tree/master/PickerFlyoutRepro. Examples are in the readme.md
Didn't get a chance to look into this, but this looks like a general issue for all flyout based controls.
Another thing worth mentioning is we have a different version of Picker as community module, https://github.com/react-native-community/react-native-picker, make sure to test that as well when applying a fix.