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

Supporting Navigator in FeedListRow

Next, we have to update FeedListRow to do the following:

  • Import the Platform API
  • Modify the navigateToPostView to check for the user's operating system and use the appropriate syntax to push the PostView for each one

I created the propsObject to store the object assigned to passProps so that I did not have to rewrite it for a second time:

// Friends/app/components/FeedListRow/index.js 

... 
import { 
  Platform, 
  ... 
} from 'react-native'; 
... 
export default class FeedListRow extends Component { 
  ... 
  _navigateToPostView () { 
    const propsObject = { 
      createdTime: this.props.createdTime, 
      message: this.props.message, 
      postID: this.props.postID, 
      story: this.props.story 
    }; 

Here we look at conditional logic for iOS: ...

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