--- Delete everything above this line before submitting your issue ---
After a fresh install of react-360 I bootstrapped a project and tried to load an image. The recommended way to achieve this is in the docs is,
<Image source={asset('wuno.png')} />
I added the image named,
wuno.png
wuno.jpg
to static_assets but I continue to get the error in the console,
ExceptionsManager.js:65 TypeError: asset is not a function
Is this a Bug or a Feature Request?
For a Bug please explain below what you did, what you expected to happen, and what actually happens.
The image should load in the browser
I get a asset is not a function error in the console.
Node version v10.7.0
Npm version 6.2.0
Bootstrap a new react-360 project and try to add an image to the component with the react-360 Image component.
List all the steps required to encounter the issue you're reporting. These steps should be clear and concise.
- npm i -g react-360
- react-360 init blockview
- Add Image to imports in index.js
- Add Image to static_assets
- Add Image component with reference to the new image in the render method.
An example of your code that reliably reproduces the issue is ideal.
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
} from 'react-360';
export default class blockview extends React.Component {
render() {
return (
<View style={styles.panel}>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Welcome to React 360
<Image source={asset('wuno.png')} />
</Text>
</View>
</View>
);
}
}
What needs to be done to address this issue? Ideally, provide a pull request with a fix.
This component should take the asset function as a prop and render the image it references inside of static_assets.
npm list react-360][email protected] /Users/wuno/Dropbox/Hack/Devops/ether/blockview
└── [email protected]
npm list react-360-web][email protected] /Users/wuno/Dropbox/Hack/Devops/ether/blockview
└── [email protected]
MacOs
Chrome Latest
Not running in VR. running locally on MacOS in the latest Chrome browser
This is a JavaScript error, telling you the method "asset" is not defined. You need to import it from react-360
import {
asset,
AppRegistry,
StyleSheet,
Text,
View,
Image,
} from 'react-360';
Sorry about that.
This should be add to Document, since it's not describing where asset can be imported from.
Most helpful comment
This should be add to Document, since it's not describing where asset can be imported from.