Skip to content

Commit 1de4b87

Browse files
Merge pull request #64 from sandeepsengupta/scrollfix
Improved sizing for ConfirmDialogs that contain ScrollViews
2 parents 9136d5d + 6b2faed commit 1de4b87

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

src/Dialog.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
TouchableWithoutFeedback,
3131
Text,
3232
Platform,
33+
SafeAreaView,
3334
ScrollView
3435
} from 'react-native'
3536
const { OS } = Platform;
@@ -44,6 +45,7 @@ class Dialog extends Component {
4445
return (
4546
<View style={[{
4647
width: '100%',
48+
flexShrink: 1,
4749
padding: 24,
4850
paddingTop: 20
4951
}, contentStyle]}>
@@ -141,29 +143,32 @@ class Dialog extends Component {
141143
backgroundColor: "#000000AA",
142144
padding: 24
143145
}, overlayStyle]}>
144-
{this._renderOutsideTouchable(onTouchOutside)}
146+
<SafeAreaView style={{flex: 1}}>
147+
{this._renderOutsideTouchable(onTouchOutside)}
145148

146-
<View style={[{
147-
backgroundColor: dialogBackgroundColor,
148-
width: '100%',
149-
shadowOpacity: 0.24,
150-
borderRadius: dialogBorderRadius,
151-
elevation: 4,
152-
shadowOffset: {
153-
height: 4,
154-
width: 2
155-
}
156-
}, dialogStyle]}>
149+
<View style={[{
150+
backgroundColor: dialogBackgroundColor,
151+
width: '100%',
152+
maxHeight: '100%',
153+
shadowOpacity: 0.24,
154+
borderRadius: dialogBorderRadius,
155+
elevation: 4,
156+
shadowOffset: {
157+
height: 4,
158+
width: 2
159+
}
160+
}, dialogStyle]}>
157161

158-
{this.renderTitle()}
162+
{this.renderTitle()}
159163

160-
{this.renderContent()}
164+
{this.renderContent()}
161165

162-
{this.renderButtons()}
166+
{this.renderButtons()}
163167

164-
</View>
168+
</View>
165169

166-
{this._renderOutsideTouchable(onTouchOutside)}
170+
{this._renderOutsideTouchable(onTouchOutside)}
171+
</SafeAreaView>
167172
</View>
168173
</ScrollView>
169174
</Modal>

0 commit comments

Comments
 (0)