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

Modifying Navigation for PreviousMonthsList

The next thing to do is modify the push method of navigator for Android:

// Expenses/app/components/PreviousMonthsList/index.js 

... 
import { 
  Platform, 
  ... 
} from 'react-native'; 
... 
export default class PreviousMonthsList extends Component { 
  ... 
  render () { 
   <View style={ Platform.OS === 'ios' ? styles.previousMonthsListContainer : {}    }>
...
   </View> 
  } 
  ... 

I made a styling adjustment for the View container that wraps around the rest of PreviousMonthsList for Android devices to keep the ListView just below the navigation bar on Android.

There have been no changes to the original rendering method if on iOS:

  _renderSelectedMonth (rowData, sectionID, rowID) { 
    if (Platform.OS === 'ios') { 
      ... 
    } 

The ...

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