-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
Is this a bug report?
yes
Have you read the Contributing Guidelines?
yes
Environment
OS: macOS Sierra 10.12.6
Node: 7.7.1
Yarn: Not Found
npm: 4.1.2
Watchman: 4.7.0
Xcode: Xcode 9.0.1 Build version 9A1004
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3
Steps to Reproduce
On a iOS IPAD :
- Create a ScrollView with following props :
scrollEnabled centerContent maximumZoomScale={15} minimumZoomScale={0.01}
- Render inside the ScrollView a view that is as large as the screen and twice the device screen height.
<View style={{ width: '100%', height: Dimensions.get('window').height * 2, backgroundColor: 'green' }} />
Expected Behavior
The scrollview renders the green view with no offset on top. So what we see is a screen entirely green.
Actual Behavior
The scrollview renders is content with a top offset that is half of the height of the screen. It's refreshed correctly as soon as you touch the screen. If we don't set the centerContent props, we don't get this bug. This occurs only on IPAD-IOS. On iPhone, we don't get this bug
Reproducible Demo
Start with basic App and render this code under iPAD.
Tested both on simulator and device : https://screencast.com/t/agiYJw1Ws
Red is the root view and green is the view rendered within the scrollview, that would as no scroll off set at all.
import {
View,
ScrollView,
Dimensions
} from 'react-native';
export default class App extends Component<{}> {
render() {
return (
<View style={{flex: 1, backgroundColor: '#FF0000'}}>
<ScrollView scrollEnabled zoomScale={0.01} centerContent maximumZoomScale={15} minimumZoomScale={0.01}>
<View style={{ width: '100%', height: Dimensions.get('window').height * 2, backgroundColor: 'green' }} />
</ScrollView>
</View>
);
}
}`