Giter Site home page Giter Site logo

Comments (9)

davidLeonardi avatar davidLeonardi commented on May 13, 2024

Can you please show us your index.ios.js ?

On Tue, Feb 2, 2016 at 12:49 AM Sam [email protected] wrote:

Red screen of death:

[image: screenshot_2_1_16__3_49_pm]
https://cloud.githubusercontent.com/assets/12532733/12735285/61300d56-c8fb-11e5-9479-33b96d4f9b07.png


Reply to this email directly or view it on GitHub
#18
.

from react-native-simple-router.

davidLeonardi avatar davidLeonardi commented on May 13, 2024

Compare to this:
https://github.com/react-native-simple-router-community/react-native-simple-router/blob/master/twitter-example/index.js

note that firstRoute is defined here, as a local variable.

from react-native-simple-router.

ffxsam avatar ffxsam commented on May 13, 2024
import React, {
  AppRegistry,
  StyleSheet,
  Text,
  TouchableHighlight,
  View
} from 'react-native';
import Router, {Component} from 'react-native-simple-router';

class HelloPage extends Component {
  render() {
    return <View>
      <Text>Hello</Text>
    </View>
  }
}

let firstRoute = {
  name: 'Welcome!',
  component: HelloPage
};

class RouterTest extends Component {
  render() {
    return <Router firstRoute={firstRoute} />
  }
}

AppRegistry.registerComponent('RouterTest', () => RouterTest);

from react-native-simple-router.

ffxsam avatar ffxsam commented on May 13, 2024

I don't get it. Isn't my code (besides naming things a little differently) the exact same as the example code in the README?

from react-native-simple-router.

ffxsam avatar ffxsam commented on May 13, 2024

Isn't this the problem? (namely, Component)

import Router, {Component} from 'react-native-simple-router';

from react-native-simple-router.

davidLeonardi avatar davidLeonardi commented on May 13, 2024

Extend your classes from React.Component, not Component.
So for example,
class HelloPage extends React.Component {

from react-native-simple-router.

ffxsam avatar ffxsam commented on May 13, 2024

Ok. I still get the white screen with just "Hello". There's no nav bar. Updated code below:

import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  TouchableHighlight,
  View
} from 'react-native';
import Router from 'react-native-simple-router';

class HelloPage extends Component {
  render() {
    return <View>
      <Text>Hello</Text>
    </View>
  }
}

let firstRoute = {
  name: 'Welcome!',
  component: HelloPage
};

class RouterTest extends Component {
  render() {
    return <Router firstRoute={firstRoute} />
  }
}

AppRegistry.registerComponent('RouterTest', () => RouterTest);

from react-native-simple-router.

davidLeonardi avatar davidLeonardi commented on May 13, 2024

Yep, that seems to be the problem.

Will fix the docs accordingly.
Sorry for the inconvenience!

from react-native-simple-router.

ffxsam avatar ffxsam commented on May 13, 2024

Will open a separate issue for the above

from react-native-simple-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.