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 FeedList

The styling for FeedList needs to change conditionally on Android so that its container style does not contain the marginTop property. Modify FeedList so that it does the following functions:

  • Imports the Platform API from React Native.
  • Conditionally checks for the user's platform and serves them either the container style on iOS devices or a new Android-specific style that does not include the marginTop property.

Here are my FeedList modifications for Android:

 // Friends/app/components/FeedList/index.js ... import { Platform, ... } from 'react-native'; ... export default class FeedList extends Component { ... render () { ... return ( <View style={ Platform.OS === 'ios' ? styles.container : styles.androidContainer }> ...

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