HomePhabricator
Diffusion Comm 33c09efefdcb

[native] [32/40] RN 0.70: Working AndroidLifecycle Expo module

Description

[native] [32/40] RN 0.70: Working AndroidLifecycle Expo module

Summary:
Baby's first Kotlin! Context about this new Expo module in D5932.

Depends on D5932

Test Plan:
I patched the following into native/root.react.js:

import * as AndroidLifecycleModule from './lifecycle/lifecycle-module';

if (Platform.OS === 'android') {
  console.log(`androidLifecycle.ACTIVE: ${AndroidLifecycleModule.ACTIVE ?? 'null or undefined'}`);
  console.log(`androidLifecycle.initialStatus: ${AndroidLifecycleModule.initialStatus ?? 'null or undefined'}`);
  AndroidLifecycleModule.addAndroidLifecycleListener(status => { console.log(`onChange ${status}`) });
}

It resulted in the following output after I started, then backgrounded, and then foregrounded the app:

LOG  androidLifecycle.ACTIVE: active
LOG  androidLifecycle.initialStatus: active
LOG  onChange background
LOG  onChange active

Reviewers: bartek!, tomek

Subscribers: atul

Differential Revision: https://phab.comm.dev/D5933

Details