-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ScrollView not scrollable in Overlay (#4561)
Fixes an issue with ScrollView inside an Overlay. While down events were propagated to the view, move events were consumed by the overlay preventing scroll components from functioning correctly.
- Loading branch information
Showing
5 changed files
with
80 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 54 additions & 54 deletions
108
playground/src/screens/complexlayouts/CustomDialogWithScroll.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
const React = require('react'); | ||
const { PureComponent } = require('react'); | ||
|
||
const { Text, Button, View, Alert, Platform ,ScrollView} = require('react-native'); | ||
const { Text, Button, View, Alert, Platform, ScrollView, StyleSheet } = require('react-native'); | ||
const { Navigation } = require('react-native-navigation'); | ||
|
||
const testIDs = require('../../testIDs'); | ||
|
||
class CustomDialogWithScroll extends PureComponent { | ||
static options() { | ||
return { | ||
statusBarBackgroundColor: 'green' | ||
}; | ||
} | ||
static options() { | ||
return { | ||
statusBarBackgroundColor: 'green' | ||
}; | ||
} | ||
|
||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<ScrollView style={styles.root}> | ||
<View style={{height: 60, backgroundColor: 'red'}}/> | ||
<View style={{height: 60, backgroundColor: 'green'}}/> | ||
<View style={{height: 60, backgroundColor: 'red'}}/> | ||
<View style={{height: 60, backgroundColor: 'green'}}/> | ||
<View style={{height: 60, backgroundColor: 'red'}}/> | ||
<View style={{height: 60, backgroundColor: 'green'}}/> | ||
</ScrollView> | ||
</View> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<View style={styles.root}> | ||
<View style={{ height: 200, width: '80%', alignSelf: 'center', flexDirection: 'row' }}> | ||
<ScrollView style={styles.scrollView} contentContainerStyle={styles.content}> | ||
<View style={{ height: 60, backgroundColor: 'red' }} /> | ||
<View style={{ height: 60, backgroundColor: 'green' }} /> | ||
<View style={{ height: 60, backgroundColor: 'red' }} /> | ||
<View style={{ height: 60, backgroundColor: 'green' }} /> | ||
<View style={{ height: 60, backgroundColor: 'red' }} /> | ||
<View style={{ height: 60, backgroundColor: 'green' }} /> | ||
</ScrollView> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
didDisappear() { | ||
if (Platform.OS === 'android') { | ||
Alert.alert('Overlay disappeared'); | ||
} | ||
didDisappear() { | ||
if (Platform.OS === 'android') { | ||
Alert.alert('Overlay disappeared'); | ||
} | ||
} | ||
} | ||
|
||
const styles = { | ||
root: { | ||
width: 400, | ||
height: 200, | ||
}, | ||
container: { | ||
|
||
width: 400, | ||
height: 200, | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
alignSelf: 'center' | ||
}, | ||
h1: { | ||
fontSize: 24, | ||
textAlign: 'center', | ||
margin: 10 | ||
}, | ||
h2: { | ||
fontSize: 12, | ||
textAlign: 'center', | ||
margin: 10 | ||
}, | ||
footer: { | ||
fontSize: 10, | ||
color: '#888', | ||
marginTop: 10 | ||
} | ||
}; | ||
const styles = StyleSheet.create({ | ||
scrollView: { | ||
backgroundColor: 'blue' | ||
}, | ||
root: { | ||
flex: 1, | ||
flexDirection: 'column', | ||
justifyContent: 'flex-end' | ||
}, | ||
content: { | ||
backgroundColor: 'blue' | ||
}, | ||
h1: { | ||
fontSize: 24, | ||
textAlign: 'center', | ||
margin: 10 | ||
}, | ||
h2: { | ||
fontSize: 12, | ||
textAlign: 'center', | ||
margin: 10 | ||
}, | ||
footer: { | ||
fontSize: 10, | ||
color: '#888', | ||
marginTop: 10 | ||
} | ||
}); | ||
|
||
module.exports = CustomDialogWithScroll; |