Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 1.22 KB

File metadata and controls

29 lines (20 loc) · 1.22 KB

Lesson 12: Platform customization with module overrides

There are many fully cross-platform modules in React Native core and the third-party module ecosystem, but sometimes we simply need to support different behaviors on different platforms. A great way to diverge implementations for each platform is using platform overrides for modules.

Remove the app entry point override

The React Native CLI windows command generates a Windows-specific app entry point, App.windows.js. We moved this to src/App.windows.tsx to prevent an error that would have occurred before we linked the react-native-camera dependency. This file can now be deleted, so we use the same code

Add a stub implementation for image classification

In Lesson 5, we abstracted the image recognition for the react-native-tensorflow package logic into a module, ImageRecognizer. Stub out the implementation for Windows in a platform module override (i.e., ImageRecognizer.windows.ts).

export default class ImageRecognizer
{
  constructor(options)
  {

  }

  recognize(data)
  {
    return Promise.reject('not implemented');
  }
}

Exit Criteria

  1. A working camera app that generates the "not implemented" error when taking a photo.