10 Implementing iOS-specific components and APIs

 

This chapter covers

  • Strategies for effectively targeting platform-specific code
  • Using the picker components, DatePickerIOS, and PickerIOS
  • Showing loading progress using ProgressViewIOS
  • Choosing views using SegmentedControlIOS and TabBarIOS
  • Calling and choosing items in an action sheet using ActionSheetIOS

One of the end goals of the React Native project is to have a minimal amount of platform-specific logic and code. Most APIs can be built so the platform-specific code is abstracted away by the framework, giving you a single way to interact with them and easily create cross-platform functionality.

Unfortunately, there will always be platform-specific APIs that can’t be completely abstracted away using an approach that makes sense cross-platform. Therefore, you’ll need to use at least a handful of platform-specific APIs and components. In this chapter, we cover iOS-specific APIs and components, discuss their props and methods, and create examples that mimic functionality and logic that will get you up to speed quickly.

10.1 Targeting platform-specific code

10.1.1 iOS and Android file extensions

10.1.2 Detecting the platform using the Platform API

10.2 DatePickerIOS

10.2.1 Example of using DatePickerIOS

10.3 Using PickerIOS to work with lists of values

10.3.1 Example of using PickerIOS

10.4 Using ProgressViewIOS to show loading indicators

10.4.1 Use cases for ProgressViewIOS

10.4.2 Example of using ProgressViewIOS

10.5 Using SegmentedControlIOS to create horizontal tab bars

10.5.1 Use cases for SegmentedControlIOS

10.5.2 Example of using SegmentedControlIOS

10.6 Using TabBarIOS to render tabs at the bottom of the UI

10.6.1 Use cases for TabBarIOS

10.6.2 Example of using TabBarIOS

10.7 Using ActionSheetIOS to show action or share sheets

10.7.1 Use cases for ActionSheetIOS

10.7.2 Example of using ActionSheetIOS

Summary