Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useRef, useState } from 'react';
import { View, Text, Image, Animated, Button } from 'react-native';
// @ts-ignore

import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
import { styles } from './style';
import { debounce } from 'lodash';
Expand Down Expand Up @@ -33,16 +33,18 @@ export default function App() {
[]
)();

const staticPinPosition = size
? { x: size.width / 2, y: size.height / 2 }
: undefined;

const staticPinPosition = { x: size.width / 2, y: size.height / 2 };
const { size: contentSize } = applyContainResizeMode(imageSize, size);

return (
<View style={styles.container}>
<Text>ReactNativeZoomableView</Text>
<View style={styles.box} onLayout={(e) => setSize(e.nativeEvent.layout)}>
<View
style={styles.box}
onLayout={(e) => {
setSize(e.nativeEvent.layout);
}}
>
<ReactNativeZoomableView
disableMomentum
// Where to put the pin in the content view
Expand Down Expand Up @@ -84,7 +86,9 @@ export default function App() {
<Text>onStaticPinPositionMove: {stringifyPoint(movePin)}</Text>
<Button
title={`${showMarkers ? 'Hide' : 'Show'} markers`}
onPress={() => setShowMarkers((value) => !value)}
onPress={() => {
setShowMarkers((value) => !value);
}}
/>
</View>
);
Expand Down
32 changes: 16 additions & 16 deletions example/style.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { StyleSheet } from 'react-native';

export const styles = StyleSheet.create({
box: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these styles are auto-sorted by RN eslint

borderWidth: 5,
flexShrink: 1,
height: 600,
width: 480,
},
container: {
flex: 1,
alignItems: 'center',
flex: 1,
justifyContent: 'center',
padding: 20,
},
contents: {
flex: 1,
alignSelf: 'stretch',
},
box: {
borderWidth: 5,
flexShrink: 1,
height: 600,
width: 480,
flex: 1,
},
img: {
width: '100%',
height: '100%',
resizeMode: 'contain',
width: '100%',
},
marker: {
position: 'absolute',
top: '50%',
left: '50%',
width: 20,
backgroundColor: 'white',
borderRadius: 10,
borderWidth: 2,
height: 20,
left: '50%',
marginLeft: -10,
marginTop: -10,
borderRadius: 10,
backgroundColor: 'white',
borderWidth: 2,
position: 'absolute',
top: '50%',
width: 20,
},
});
217 changes: 120 additions & 97 deletions lib/commonjs/ReactNativeZoomableView.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/commonjs/ReactNativeZoomableView.js.map

Large diffs are not rendered by default.

293 changes: 0 additions & 293 deletions lib/commonjs/ReactNativeZoomableViewWithGestures.js

This file was deleted.

Loading
Loading