XebiaStudio / react-native-google-vr-panorama

GNU General Public License v2.0
26 stars 8 forks source link

Blank screen #1

Closed KevinHu2014 closed 7 years ago

KevinHu2014 commented 7 years ago

I got an blank screen. Is it possible to provide an example code. Thanks~

below is my code

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';
import GoogleVRPanorama, { PanoramaView } from 'react-native-google-r-panorama'

export default class testRN extends Component {
  render() {
    const imageUrl = 'http://i0.wp.com/ivrpa.org/wp-content/uploads/2015/02/Jerusalem-1600.jpg'
    const inputType = GoogleVRPanorama.inputType.mono

    return (
        <View style={styles.container}>
          <PanoramaView imageUrl={imageUrl} inputType={inputType} onImageLoaded={console.log('success')} 
          dimensions={{width: 100, height: 100}} onImageLoadingFailed={console.log('failed')}/>
        </View>

    )
}
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('testRN', () => testRN);
capdilla commented 7 years ago

I have the same problem, and i do this.

Try it!

render() {
    const imageUrl = 'http://blog.dsky.co/wp-content/uploads/2015/09/06-VikingVillage_stereo_thumb.jpg'
    const inputType = GoogleVRPanorama.inputType.stereo

    return (
      <View style={{borderWidth:1}}>
          <PanoramaView style={{borderWidth:1,height:500}} inputType={inputType} imageUrl={imageUrl} dimensions={{width:424,height:424}}
            onImageLoaded={console.log('success')} />
      </View>

    );
  }
mrooding commented 7 years ago

Hi guys, thanks for submitting this issue. It seems like both cases were due to the View and PanoramaView not having specific dimensions set. I added an example here. If you have any other questions please let me know! :-)