Reputation: 31
I am learning react native, so when the program crash it only shows 15:31:42: Failed building JavaScript bundle
that's all it says. So is there any file or tools i can use to look for more detail error like Eclipse or dotCMS log file or which line of my code have syntax error ?
Upvotes: 1
Views: 5117
Reputation: 37
Hope This example will help you..
import React, { Component } from 'react';
import { StyleSheet, View, Text } from 'react-native';
export default class App extends Component {
state = {
items: [],
errorMessage : 'Server Error!'//You have to set this message depends on your server response
}
render() {
return (
<View style={styles.MainContainer}>
<Text style={{ fontSize: 23 }}> { this.state.errorMessage } </Text>
</View>
);
}
}
const styles = StyleSheet.create({
MainContainer: {
flex: 1,
paddingTop: 20,
alignItems: 'center',
marginTop: 50,
justifyContent: 'center'
}
});
Upvotes: 1
Reputation: 827
You can use Chrome Developer Tools.
First open Developer Tools in Simulator. Then press Command+D keyboard shortcut. It will open the developer tools.
To debug the JavaScript code in Chrome, select "Debug JS Remotely" from the Developer Menu. This will open a new tab at http://localhost:8081/debugger-ui.
Then you can use "Inspect Element" on chrome browser. Then you can select console.
When ever there is some issue in the app, you can track it from the console in google chrome.
http://facebook.github.io/react-native/releases/0.49/docs/debugging.html#chrome-developer-tools
Upvotes: 0
Reputation: 4141
For development simply use console.log and debug while remote debugging is enabled. For production you can use Fabric, i love it. For more information about debugging follow the docs
Upvotes: 0