O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

EnterBudget component example

Building and linking this component involved changing the App.js file. Let's take a look at that one first since it passes props down to the EnterBudget component:

// Expenses/app/App.js... import EnterBudget from './components/EnterBudget';  export default class App extends Component {   ...

Set the month and year in state, then call _updateBudget:

  componentWillMount () {     this.setState({       month: dateMethods.getMonth(),       year: dateMethods.getYear()     });      this._updateBudget();   }

Push EnterBudget to the navigator and pass it two props. Hide the navigation bar so that the user cannot leave without entering a budget for the month:

  ...   _renderEnterBudgetComponent () {     this.props.navigator.push({  component: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required