Skip to content

Commit aad22b6

Browse files
committed
feat: bump
1 parent 90e4e95 commit aad22b6

File tree

6 files changed

+5630
-4791
lines changed

6 files changed

+5630
-4791
lines changed

dist/Lightbox.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface LightboxProps<T = any> extends IGestureProps {
2121
onOpen?: Func<T, void>;
2222
willClose?: Func<T, void>;
2323
onClose?: Func<T, void>;
24+
onPress?: Func<T, void>;
2425
onLongPress?: Func<T, void>;
2526
onLayout?: Func<T, void>;
2627
swipeToDismiss?: boolean;
@@ -32,6 +33,7 @@ export interface LightboxProps<T = any> extends IGestureProps {
3233
useNativeDriver?: boolean;
3334
dragDismissThreshold?: number;
3435
modalProps?: ModalProps;
36+
openOnLongPress?: boolean;
3537
}
3638
declare const Lightbox: React.FC<LightboxProps>;
3739
export default Lightbox;

dist/Lightbox.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Animated, TouchableHighlight, View, } from "react-native";
33
import LightboxOverlay from "./LightboxOverlay";
44
import { useNextTick } from "./hooks";
55
const noop = () => { };
6-
const Lightbox = ({ activeProps, swipeToDismiss = true, useNativeDriver = false, disabled = false, renderContent, renderHeader, renderItem, didOpen = noop, onOpen = noop, willClose = noop, onClose = noop, onLongPress = noop, onLayout = noop, springConfig = { tension: 30, friction: 7 }, backgroundColor = "black", underlayColor, style, dragDismissThreshold = 150, children, modalProps = {}, ...rest }) => {
6+
const Lightbox = ({ activeProps, swipeToDismiss = true, useNativeDriver = false, disabled = false, renderContent, renderHeader, renderItem, didOpen = noop, onOpen = noop, willClose = noop, onClose = noop, onPress = noop, onLongPress = noop, onLayout = noop, springConfig = { tension: 30, friction: 7 }, backgroundColor = "black", underlayColor, style, dragDismissThreshold = 150, children, modalProps = {}, openOnLongPress = false, ...rest }) => {
77
const layoutOpacity = useRef(new Animated.Value(1));
88
const _root = useRef(null);
99
const closeNextTick = useNextTick(onClose);
@@ -64,7 +64,7 @@ const Lightbox = ({ activeProps, swipeToDismiss = true, useNativeDriver = false,
6464
if (renderItem) {
6565
return renderItem(open);
6666
}
67-
return (<TouchableHighlight underlayColor={underlayColor} onPress={open} onLongPress={onLongPress} disabled={disabled}>
67+
return (<TouchableHighlight underlayColor={underlayColor} onPress={openOnLongPress ? onPress : open} onLongPress={openOnLongPress ? open : onLongPress} disabled={disabled}>
6868
{children}
6969
</TouchableHighlight>);
7070
};

dist/LightboxOverlay.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const LightboxOverlay = ({ useNativeDriver = false, dragDismissThreshold, spring
6060
longPressGapTimer,
6161
longPressCallback,
6262
});
63+
const [deviceWidth, setDeviceWidth] = useState(Dimensions.get('window').width);
64+
const [deviceHeight, setDeviceHeight] = useState(Dimensions.get('window').height);
6365
const [{ isAnimating, isPanning, target }, setState] = useState({
6466
isAnimating: false,
6567
isPanning: false,
@@ -156,6 +158,19 @@ const LightboxOverlay = ({ useNativeDriver = false, dragDismissThreshold, spring
156158
},
157159
});
158160
};
161+
useEffect(() => {
162+
const onChange = ({ window }) => {
163+
setDeviceWidth(window.width);
164+
setDeviceHeight(window.height);
165+
};
166+
const removeEventListener = () => {
167+
if (Dimensions.removeEventListener) {
168+
Dimensions.removeEventListener('change', onChange);
169+
}
170+
};
171+
Dimensions.addEventListener('change', onChange);
172+
return removeEventListener;
173+
}, []);
159174
useEffect(() => {
160175
initPanResponder();
161176
}, [useNativeDriver, isAnimating]);
@@ -196,11 +211,11 @@ const LightboxOverlay = ({ useNativeDriver = false, dragDismissThreshold, spring
196211
}),
197212
width: openVal.current.interpolate({
198213
inputRange: [0, 1],
199-
outputRange: [origin.width, WINDOW_WIDTH],
214+
outputRange: [origin.width, deviceWidth],
200215
}),
201216
height: openVal.current.interpolate({
202217
inputRange: [0, 1],
203-
outputRange: [origin.height, WINDOW_HEIGHT],
218+
outputRange: [origin.height, deviceHeight],
204219
}),
205220
},
206221
];

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-lightbox-v2",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Images etc in Full Screen Lightbox Popovers for React Native",
55
"main": "dist/Lightbox.js",
66
"types": "dist/Lightbox.d.ts",
@@ -40,7 +40,7 @@
4040
},
4141
"homepage": "https://github.com/cbbfcd/react-native-lightbox",
4242
"devDependencies": {
43-
"@babel/runtime": "7.7.4",
43+
"@babel/runtime": "7.25.6",
4444
"@types/react": "16.9.13",
4545
"@types/react-native": "0.69.3",
4646
"react": "16.12.0",

0 commit comments

Comments
 (0)