Skip to content

Commit e5467b3

Browse files
authored
Merge pull request #43 from revdapp/master
support manually overriding the overlay styles
2 parents 3e4e44e + 245b676 commit e5467b3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Modal from 'react-native-simple-modal';
1616
<Modal
1717
open={false}
1818
offset={0}
19-
overlayBackground="rgba(0, 0, 0, 0.75)"
2019
animationDuration={200}
2120
animationTension={40}
2221
modalDidOpen={() => undefined}
@@ -25,6 +24,10 @@ import Modal from 'react-native-simple-modal';
2524
containerStyle={{
2625
justifyContent: 'center'
2726
}}
27+
overlayStyle={{
28+
backgroundColor: 'rgba(0, 0, 0, 0.75)',
29+
flex: 1
30+
}}
2831
modalStyle={{
2932
borderRadius: 2,
3033
margin: 20,

index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Modal extends Component {
2727
static defaultProps = {
2828
open: false,
2929
offset: 0,
30-
overlayBackground: 'rgba(0, 0, 0, 0.75)',
3130
animationDuration: 200,
3231
animationTension: 40,
3332
modalDidOpen: () => undefined,
@@ -149,7 +148,11 @@ class Modal extends Component {
149148
disabled={!this.props.closeOnTouchOutside}
150149
onPress={this.close.bind(this)}
151150
activeOpacity={0.75}>
152-
<Animated.View style={{flex: 1, opacity, backgroundColor: this.props.overlayBackground}} />
151+
<Animated.View style={[
152+
styles.defaultOverlayStyle,
153+
{opacity},
154+
this.props.overlayStyle
155+
]} />
153156
</TouchableOpacity>
154157
<Animated.View
155158
style={[
@@ -199,6 +202,10 @@ const styles = StyleSheet.create({
199202
padding: 10,
200203
backgroundColor: '#F5F5F5'
201204
},
205+
defaultOverlayStyle: {
206+
flex: 1,
207+
backgroundColor: 'rgba(0, 0, 0, 0.75)'
208+
},
202209
hidden: {
203210
top: -10000,
204211
left: 0,

0 commit comments

Comments
 (0)