DuDigital / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
241 stars 112 forks source link

Trying to use ReactNativeZoomableView and getting an error #1

Closed clytras closed 6 years ago

clytras commented 6 years ago

I'm trying with this code and I'm getting an error ONLY when I try to zoom or any other interaction:

import React from 'react';
import { Image, View } from 'react-native';
import {ReactNativeZoomableView} from '@duagentur/react-native-zoomable-view';

export class FloorPlan extends React.Component {
    render() {
        return (
            <View style={{ flex: 1 }}>
            <ReactNativeZoomableView>
                <Image style={{flex: 1, width: null, height: '100%'}} 
                    source={require('../assets/floorPlans/FloorPlan_1.png')} 
                    resizeMode="contain" />
            </ReactNativeZoomableView>
            </View>
        );
    }
}

export default FloorPlan;

The error I'm getting:

TypeError: TypeError: Cannot read property 'getValue' of null

This error is located at:
    in RCTView (at View.js:60)
    in View (at ReactNativeZoomableView.js:538)
    in RCTView (at View.js:60)
    in View (at ReactNativeZoomableView.js:533)
    in ReactNativeZoomableView (at FloorPlan.js:13)
    in RCTView (at View.js:60)
    in View (at FloorPlan.js:12)
    ...

Am I doing something wrong? Is there any documentation or example on how to use ReactNativeZoomableView?

SimonErich commented 6 years ago

@clytras sorry, that was a mistake on our part. We never used it without maxzoom and minzoom props. We patched it though and it should work now.

Also we improved the docs and added examples on how to use it.

Please be aware that we also changed the namespace, so the correct package is now: @dudigital/react-native-zoomable-view (as described in the current readme)

We moved the git page over to the right namespace, so there is nothing to do here. Just in your package.json