How it works...
In this recipe we've seen an example of having to use two separate approaches for accomplishing the same task. For iOS, we handled displaying the image mask exclusively in the native layer, without any need for the React Native layer. For Android, we used React Native to handle the image masking.
In step 3 we extended two Objective-C methods: applicationWillResignActive, which fires when an app changes from being foregrounded, and applicationDidBecomeActive, which fires when the app is foregrounded. For each event, we simply toggle an imageView that displays the hidden.jpg image store in the Images.xcassettes folder in the Xcode project.
In step 5 we used the React class RCTDeviceEventEmitter from the DeviceEventManagerModule ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access