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

Creating an Android version of App.js

Now, we should create an Android-specific App component for Friends. Start by renaming the existing App.js file found at Friends/app/App.js as App.ios.js and create a new file titled App.android.js.

This file should contain similar logic to App.ios.js, but any references to iOS-specific components, such as TabBarIOS, should be removed. Additionally, any navigation events should be updated to support Navigator logic.

Here's how I did it:

// Friends/app/App.android.js 

... 

The following three items were removed from the import statements: NavigatorIOS, TabBarIOS, and LoginPage:

export default class App extends Component { 
  constructor (props) { 
    ... 
  } 

The selectedTab property in state was removed from ...

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