react-native-lightbox
Advanced tools
Comparing version 0.1.1 to 0.2.0
29
index.js
@@ -21,2 +21,5 @@ /** | ||
var cloneWithProps = require('react-tools/src/utils/cloneWithProps'); | ||
var onlyChild = require('react-tools/src/utils/onlyChild'); | ||
var Overlay = require('react-native-overlay'); | ||
@@ -31,2 +34,3 @@ | ||
propTypes: { | ||
activeProps: PropTypes.object, | ||
header: PropTypes.element, | ||
@@ -36,5 +40,7 @@ underlayColor: PropTypes.string, | ||
onClose: PropTypes.func, | ||
swipeToDismiss: PropTypes.bool, | ||
}, | ||
getDefaultProps: function() { | ||
return { | ||
swipeToDismiss: true, | ||
onOpen: () => {}, | ||
@@ -168,4 +174,8 @@ onClose: () => {}, | ||
render: function() { | ||
var { header } = this.props; | ||
var { | ||
header, | ||
swipeToDismiss, | ||
} = this.props; | ||
var { | ||
isOpen, | ||
@@ -190,2 +200,7 @@ isPanning, | ||
var handlers; | ||
if(swipeToDismiss) { | ||
handlers = this._panResponder.panHandlers; | ||
} | ||
var dragStyle; | ||
@@ -214,2 +229,10 @@ if(isPanning) { | ||
var overlayContent = this.props.children; | ||
if(this.props.activeProps) { | ||
overlayContent = cloneWithProps( | ||
onlyChild(overlayContent), | ||
this.props.activeProps | ||
); | ||
} | ||
return ( | ||
@@ -230,4 +253,4 @@ <View | ||
<Animated.View style={[styles.background, lightboxOpacityStyle]}></Animated.View> | ||
<Animated.View style={[openStyle, dragStyle]} {...this._panResponder.panHandlers}> | ||
{this.props.children} | ||
<Animated.View style={[openStyle, dragStyle]} {...handlers}> | ||
{overlayContent} | ||
</Animated.View> | ||
@@ -234,0 +257,0 @@ <Animated.View style={[styles.header, lightboxOpacityStyle]}> |
{ | ||
"name": "react-native-lightbox", | ||
"version": "0.1.1", | ||
"description": "Full screen lightbox popups for React Native", | ||
"version": "0.2.0", | ||
"description": "Images etc in Full Screen Lightbox Popovers for React Native", | ||
"main": "index.js", | ||
@@ -34,4 +34,5 @@ "scripts": { | ||
"dependencies": { | ||
"react-native-overlay": "^0.2.8" | ||
"react-native-overlay": "^0.2.8", | ||
"react-tools": "^0.13.3" | ||
} | ||
} |
@@ -49,2 +49,3 @@ # react-native-lightbox | ||
|---|---|---| | ||
|**`activeProps`**|`object`|Optional set of props applied to the content component when in lightbox mode. Usable for applying custom styles or higher resolution image source.| | ||
|**`header`**|`element`|Custom header instead of default with X button| | ||
@@ -54,2 +55,3 @@ |**`onClose`**|`function`|Triggered when lightbox is closed| | ||
|**`underlayColor`**|`string`|Color of touchable background, defaults to `black`| | ||
|**`swipeToDismiss`**|`bool`|Enables gestures to dismiss the fullscreen mode by swiping up or down, defaults to `true`.| | ||
@@ -56,0 +58,0 @@ ## Demo |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66669
431
68
3
+ Addedreact-tools@^0.13.3
+ Addedacorn@5.7.4(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@0.1.1(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@13001.1001.0-dev-harmony-fb(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjstransform@10.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedq@1.5.1(transitive)
+ Addedreact-tools@0.13.3(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.1.310.5.7(transitive)
+ Addedwrappy@1.0.2(transitive)