feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,3 @@
{
"presets": ["babel-preset-expo"]
}

View File

@@ -0,0 +1,2 @@
// @generated by expo-module-scripts
module.exports = require('expo-module-scripts/eslintrc.base.js');

View File

@@ -0,0 +1,219 @@
# Changelog
## Unpublished
### 🛠 Breaking changes
### 🎉 New features
### 🐛 Bug fixes
### 💡 Others
## 13.0.2 — 2024-05-15
### 🐛 Bug fixes
- Stop useKeepAwake calls deactivating each other by default. ([#28884](https://github.com/expo/expo/pull/28884) by [@macksal](https://github.com/macksal))
## 13.0.1 — 2024-04-23
_This version does not introduce any user-facing changes._
## 13.0.0 — 2024-04-18
### 💡 Others
- Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
## 12.8.2 - 2024-01-18
_This version does not introduce any user-facing changes._
## 12.8.1 - 2024-01-10
### 🎉 New features
- Added support for macOS platform. ([#26221](https://github.com/expo/expo/pull/26221) by [@tsapeta](https://github.com/tsapeta))
## 12.8.0 — 2023-11-14
### 🛠 Breaking changes
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
## 12.7.0 — 2023-10-17
### 🛠 Breaking changes
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
## 12.6.0 — 2023-09-15
### 🎉 New features
- Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
## 12.5.0 — 2023-09-04
### 🎉 New features
- Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
### 💡 Others
- On Android, migrate to Expo Modules Api. ([#24012](https://github.com/expo/expo/pull/24012) by [@alanjhughes](https://github.com/alanjhughes))
## 12.4.1 — 2023-08-02
_This version does not introduce any user-facing changes._
## 12.4.0 — 2023-07-28
_This version does not introduce any user-facing changes._
## 12.3.0 — 2023-06-21
_This version does not introduce any user-facing changes._
## 12.2.0 — 2023-06-13
### 🐛 Bug fixes
- Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
## 12.1.0 — 2023-05-08
_This version does not introduce any user-facing changes._
## 12.0.1 — 2023-02-09
_This version does not introduce any user-facing changes._
## 12.0.0 — 2023-02-03
### 🛠 Breaking changes
- `KeepAwake.activateKeepAwake` has been deprecated in favor of `KeepAwake.activateKeepAwakeAsync`. ([#15826](https://github.com/expo/expo/pull/15826) by [@EvanBacon](https://github.com/EvanBacon))
### 🎉 New features
- Added web support. ([#15826](https://github.com/expo/expo/pull/15826) by [@EvanBacon](https://github.com/EvanBacon))
- Added `KeepAwake.isAvailableAsync` which returns false on certain web browsers. ([#15826](https://github.com/expo/expo/pull/15826) by [@EvanBacon](https://github.com/EvanBacon))
- Added `KeepAwake.addListener` to observe state changes on web. ([#15826](https://github.com/expo/expo/pull/15826) by [@EvanBacon](https://github.com/EvanBacon))
### 💡 Others
- Define `KeepAwakeOptions` type, update the doc comments. ([#20489](https://github.com/expo/expo/pull/20489) by [@Simek](https://github.com/Simek))
- On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
## 11.0.1 — 2022-10-28
_This version does not introduce any user-facing changes._
## 11.0.0 — 2022-10-06
### 🛠 Breaking changes
- Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
## 10.2.1 — 2022-08-08
### 🐛 Bug fixes
- Attempt to fix `EXC_BAD_ACCESS` and `NSInvalidArgumentException` crashes by not referencing to the class instance function. ([#18553](https://github.com/expo/expo/pull/18553) by [@tsapeta](https://github.com/tsapeta))
## 10.2.0 — 2022-07-07
### 🐛 Bug fixes
- Fixed `Unable to deactivate keep awake. However, it probably is deactivated already` unhandled promise rejection warning when resuming apps on Android. ([#17319](https://github.com/expo/expo/pull/17319) by [@kudo](https://github.com/kudo))
### 💡 Others
- Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
## 10.1.0 — 2022-04-18
### 🎉 New features
- Native module on iOS is now written in Swift using the new API. ([#15705](https://github.com/expo/expo/pull/15705) by [@tsapeta](https://github.com/tsapeta))
### ⚠️ Notices
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
## 10.0.2 - 2022-02-01
### 🐛 Bug fixes
- Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
## 10.0.1 — 2021-11-17
_This version does not introduce any user-facing changes._
## 10.0.0 — 2021-09-28
### 🛠 Breaking changes
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
### 🐛 Bug fixes
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
## 9.3.0 — 2021-09-08
### 💡 Others
- Rewrite android code to Kotlin. ([#13996](https://github.com/expo/expo/pull/13996) by [@kkafar](https://github.com/kkafar))
## 9.2.0 — 2021-06-16
### 🐛 Bug fixes
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
## 9.1.2 — 2021-04-13
_This version does not introduce any user-facing changes._
## 9.1.1 — 2021-04-01
_This version does not introduce any user-facing changes._
## 9.1.0 — 2021-03-10
### 🎉 New features
- Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
### 🐛 Bug fixes
- Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
## 9.0.0 — 2021-01-15
### 🛠 Breaking changes
- Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
## 8.4.0 — 2020-11-17
_This version does not introduce any user-facing changes._
## 8.3.0 — 2020-08-18
_This version does not introduce any user-facing changes._
## 8.2.1 — 2020-05-29
_This version does not introduce any user-facing changes._
## 8.2.0 — 2020-05-27
### 🐛 Bug fixes
- Fixed `KeepAwake.activateKeepAwake` not working with multiple tags on Android. ([#7197](https://github.com/expo/expo/pull/7197) by [@lukmccall](https://github.com/lukmccall))

View File

@@ -0,0 +1,41 @@
<p>
<a href="https://docs.expo.dev/versions/latest/sdk/keep-awake/">
<img
src="../../.github/resources/expo-keep-awake.svg"
alt="expo-keep-awake"
height="64" />
</a>
</p>
Provides a React component that prevents the screen sleeping when rendered. It also exposes static methods to control the behavior imperatively.
# API documentation
- [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/keep-awake.mdx)
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/keep-awake/)
# Installation in managed Expo projects
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/keep-awake/).
# Installation in bare React Native projects
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
### Add the package to your npm dependencies
```
npx expo install expo-keep-awake
```
### Configure for iOS
Run `npx pod-install` after installing the npm package.
### Configure for Android
No additional set up necessary.
# Contributing
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).

View File

@@ -0,0 +1,19 @@
apply plugin: 'com.android.library'
group = 'host.exp.exponent'
version = '13.0.2'
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
apply from: expoModulesCorePlugin
applyKotlinExpoModulesCorePlugin()
useCoreDependencies()
useDefaultAndroidSdkVersions()
useExpoPublishing()
android {
namespace "expo.modules.keepawake"
defaultConfig {
versionCode 16
versionName "13.0.2"
}
}

View File

@@ -0,0 +1,3 @@
<manifest>
</manifest>

View File

@@ -0,0 +1,59 @@
package expo.modules.keepawake
import android.app.Activity
import android.view.WindowManager
import expo.modules.core.ModuleRegistry
import expo.modules.core.errors.CurrentActivityNotFoundException
import expo.modules.core.interfaces.ActivityProvider
import expo.modules.core.interfaces.InternalModule
import expo.modules.core.interfaces.services.KeepAwakeManager
class ExpoKeepAwakeManager : KeepAwakeManager, InternalModule {
private val tags: MutableSet<String> = HashSet()
private lateinit var moduleRegistry: ModuleRegistry
override fun onCreate(moduleRegistry: ModuleRegistry) {
this.moduleRegistry = moduleRegistry
}
@get:Throws(CurrentActivityNotFoundException::class)
private val currentActivity: Activity
get() {
val activityProvider = moduleRegistry.getModule(ActivityProvider::class.java)
?: throw CurrentActivityNotFoundException()
return if (activityProvider.currentActivity != null) {
activityProvider.currentActivity
} else {
throw CurrentActivityNotFoundException()
}
}
@Throws(CurrentActivityNotFoundException::class)
override fun activate(tag: String, done: Runnable) {
val activity = currentActivity
if (!isActivated) {
activity.runOnUiThread { activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) }
}
tags.add(tag)
done.run()
}
@Throws(CurrentActivityNotFoundException::class)
override fun deactivate(tag: String, done: Runnable) {
val activity = currentActivity
if (tags.size == 1 && tags.contains(tag)) {
activity.runOnUiThread { activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) }
}
tags.remove(tag)
done.run()
}
override fun isActivated(): Boolean {
return tags.isNotEmpty()
}
override fun getExportedInterfaces(): List<Class<*>?> {
return listOf(KeepAwakeManager::class.java)
}
}

View File

@@ -0,0 +1,12 @@
package expo.modules.keepawake
import expo.modules.kotlin.exception.CodedException
internal class ActivateKeepAwakeException :
CodedException("Unable to activate keep awake")
internal class DeactivateKeepAwakeException :
CodedException("Unable to deactivate keep awake. However, it probably is deactivated already")
internal class MissingModuleException(moduleName: String) :
CodedException("Module '$moduleName' not found. Are you sure all modules are linked correctly?")

View File

@@ -0,0 +1,37 @@
// Copyright 2015-present 650 Industries. All rights reserved.
package expo.modules.keepawake
import expo.modules.core.errors.CurrentActivityNotFoundException
import expo.modules.core.interfaces.services.KeepAwakeManager
import expo.modules.kotlin.Promise
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
class KeepAwakeModule : Module() {
private val keepAwakeManager: KeepAwakeManager
get() = appContext.legacyModule() ?: throw MissingModuleException("KeepAwakeManager")
override fun definition() = ModuleDefinition {
Name("ExpoKeepAwake")
AsyncFunction("activate") { tag: String, promise: Promise ->
try {
keepAwakeManager.activate(tag) { promise.resolve(true) }
} catch (ex: CurrentActivityNotFoundException) {
promise.reject(ActivateKeepAwakeException())
}
}
AsyncFunction("deactivate") { tag: String, promise: Promise ->
try {
keepAwakeManager.deactivate(tag) { promise.resolve(true) }
} catch (ex: CurrentActivityNotFoundException) {
promise.reject(DeactivateKeepAwakeException())
}
}
AsyncFunction<Boolean>("isActivated") {
return@AsyncFunction keepAwakeManager.isActivated
}
}
}

View File

@@ -0,0 +1,12 @@
package expo.modules.keepawake
import android.content.Context
import expo.modules.core.interfaces.InternalModule
import expo.modules.core.interfaces.Package
class KeepAwakePackage : Package {
override fun createInternalModules(context: Context): List<InternalModule> {
return listOf(ExpoKeepAwakeManager())
}
}

View File

@@ -0,0 +1,3 @@
declare const _default: any;
export default _default;
//# sourceMappingURL=ExpoKeepAwake.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.d.ts","sourceRoot":"","sources":["../src/ExpoKeepAwake.ts"],"names":[],"mappings":";AACA,wBAAoD"}

View File

@@ -0,0 +1,3 @@
import { requireNativeModule } from 'expo-modules-core';
export default requireNativeModule('ExpoKeepAwake');
//# sourceMappingURL=ExpoKeepAwake.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.js","sourceRoot":"","sources":["../src/ExpoKeepAwake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoKeepAwake');\n"]}

View File

@@ -0,0 +1,11 @@
import { Subscription } from 'expo-modules-core';
import { KeepAwakeListener } from './KeepAwake.types';
/** Wraps the webWakeLock API https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API */
declare const _default: {
isAvailableAsync(): Promise<boolean>;
activate(tag: string): Promise<void>;
deactivate(tag: string): Promise<void>;
addListenerForTag(tag: string, listener: KeepAwakeListener): Subscription;
};
export default _default;
//# sourceMappingURL=ExpoKeepAwake.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.web.d.ts","sourceRoot":"","sources":["../src/ExpoKeepAwake.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAuB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAoB3E,sGAAsG;;;kBAQhF,MAAM;oBAOJ,MAAM;2BAcL,MAAM,YAAY,iBAAiB,GAAG,YAAY;;AA5B3E,wBAqDE"}

View File

@@ -0,0 +1,59 @@
import { CodedError, Platform } from 'expo-modules-core';
import { KeepAwakeEventState } from './KeepAwake.types';
const wakeLockMap = {};
/** Wraps the webWakeLock API https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API */
export default {
async isAvailableAsync() {
if (Platform.isDOMAvailable) {
return 'wakeLock' in navigator;
}
return false;
},
async activate(tag) {
if (!Platform.isDOMAvailable) {
return;
}
const wakeLock = await navigator.wakeLock.request('screen');
wakeLockMap[tag] = wakeLock;
},
async deactivate(tag) {
if (!Platform.isDOMAvailable) {
return;
}
if (wakeLockMap[tag]) {
wakeLockMap[tag].release?.();
delete wakeLockMap[tag];
}
else {
throw new CodedError('ERR_KEEP_AWAKE_TAG_INVALID', `The wake lock with tag ${tag} has not activated yet`);
}
},
addListenerForTag(tag, listener) {
const eventListener = () => {
listener({ state: KeepAwakeEventState.RELEASE });
};
const sentinel = wakeLockMap[tag];
if (sentinel) {
if ('addEventListener' in sentinel) {
sentinel.addEventListener?.('release', eventListener);
}
else {
sentinel.onrelease = eventListener;
}
}
return {
remove: () => {
const sentinel = wakeLockMap[tag];
if (sentinel) {
if (sentinel.removeEventListener) {
sentinel.removeEventListener('release', eventListener);
}
else {
sentinel.onrelease = null;
}
}
},
};
},
};
//# sourceMappingURL=ExpoKeepAwake.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ExpoKeepAwake.web.js","sourceRoot":"","sources":["../src/ExpoKeepAwake.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,GAAqC,EAAE,CAAC;AAkBzD,sGAAsG;AACtG,eAAe;IACb,KAAK,CAAC,gBAAgB;QACpB,IAAI,QAAQ,CAAC,cAAc,EAAE;YAC3B,OAAO,UAAU,IAAI,SAAS,CAAC;SAChC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,GAAW;QACxB,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC5B,OAAO;SACR;QACD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5D,WAAW,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,GAAW;QAC1B,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC5B,OAAO;SACR;QACD,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;YACpB,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;SACzB;aAAM;YACL,MAAM,IAAI,UAAU,CAClB,4BAA4B,EAC5B,0BAA0B,GAAG,wBAAwB,CACtD,CAAC;SACH;IACH,CAAC;IACD,iBAAiB,CAAC,GAAW,EAAE,QAA2B;QACxD,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,QAAQ,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC;QACF,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,QAAQ,EAAE;YACZ,IAAI,kBAAkB,IAAI,QAAQ,EAAE;gBAClC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;aACvD;iBAAM;gBACL,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;aACpC;SACF;QACD,OAAO;YACL,MAAM,EAAE,GAAG,EAAE;gBACX,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;gBAClC,IAAI,QAAQ,EAAE;oBACZ,IAAI,QAAQ,CAAC,mBAAmB,EAAE;wBAChC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;qBACxD;yBAAM;wBACL,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;qBAC3B;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { CodedError, Platform, Subscription } from 'expo-modules-core';\n\nimport { KeepAwakeEventState, KeepAwakeListener } from './KeepAwake.types';\n\nconst wakeLockMap: Record<string, WakeLockSentinel> = {};\n\ntype WakeLockSentinel = {\n onrelease: null | ((event: any) => void);\n released: boolean;\n type: 'screen';\n release?: Function;\n\n addEventListener?: (event: string, listener: (event: any) => void) => void;\n removeEventListener?: (event: string, listener: (event: any) => void) => void;\n};\n\ndeclare const navigator: {\n wakeLock: {\n request(type: 'screen'): Promise<WakeLockSentinel>;\n };\n};\n\n/** Wraps the webWakeLock API https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API */\nexport default {\n async isAvailableAsync() {\n if (Platform.isDOMAvailable) {\n return 'wakeLock' in navigator;\n }\n return false;\n },\n async activate(tag: string) {\n if (!Platform.isDOMAvailable) {\n return;\n }\n const wakeLock = await navigator.wakeLock.request('screen');\n wakeLockMap[tag] = wakeLock;\n },\n async deactivate(tag: string) {\n if (!Platform.isDOMAvailable) {\n return;\n }\n if (wakeLockMap[tag]) {\n wakeLockMap[tag].release?.();\n delete wakeLockMap[tag];\n } else {\n throw new CodedError(\n 'ERR_KEEP_AWAKE_TAG_INVALID',\n `The wake lock with tag ${tag} has not activated yet`\n );\n }\n },\n addListenerForTag(tag: string, listener: KeepAwakeListener): Subscription {\n const eventListener = () => {\n listener({ state: KeepAwakeEventState.RELEASE });\n };\n const sentinel = wakeLockMap[tag];\n if (sentinel) {\n if ('addEventListener' in sentinel) {\n sentinel.addEventListener?.('release', eventListener);\n } else {\n sentinel.onrelease = eventListener;\n }\n }\n return {\n remove: () => {\n const sentinel = wakeLockMap[tag];\n if (sentinel) {\n if (sentinel.removeEventListener) {\n sentinel.removeEventListener('release', eventListener);\n } else {\n sentinel.onrelease = null;\n }\n }\n },\n };\n },\n};\n"]}

View File

@@ -0,0 +1,21 @@
export type KeepAwakeEvent = {
/** Keep awake state. */
state: KeepAwakeEventState;
};
export declare enum KeepAwakeEventState {
RELEASE = "release"
}
export type KeepAwakeListener = (event: KeepAwakeEvent) => void;
export type KeepAwakeOptions = {
/**
* The call will throw an unhandled promise rejection on Android when the original Activity is dead or deactivated.
* Set the value to `true` for suppressing the uncaught exception.
*/
suppressDeactivateWarnings?: boolean;
/**
* A callback that is invoked when the keep-awake state changes.
* @platform web
*/
listener?: KeepAwakeListener;
};
//# sourceMappingURL=KeepAwake.types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"KeepAwake.types.d.ts","sourceRoot":"","sources":["../src/KeepAwake.types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,GAAG;IAC3B,wBAAwB;IACxB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAGF,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;CACpB;AAGD,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC"}

View File

@@ -0,0 +1,6 @@
// @needsAudit
export var KeepAwakeEventState;
(function (KeepAwakeEventState) {
KeepAwakeEventState["RELEASE"] = "release";
})(KeepAwakeEventState || (KeepAwakeEventState = {}));
//# sourceMappingURL=KeepAwake.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"KeepAwake.types.js","sourceRoot":"","sources":["../src/KeepAwake.types.ts"],"names":[],"mappings":"AAMA,cAAc;AACd,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;AACrB,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B","sourcesContent":["// @needsAudit\nexport type KeepAwakeEvent = {\n /** Keep awake state. */\n state: KeepAwakeEventState;\n};\n\n// @needsAudit\nexport enum KeepAwakeEventState {\n RELEASE = 'release',\n}\n\n// @needsAudit\nexport type KeepAwakeListener = (event: KeepAwakeEvent) => void;\n\nexport type KeepAwakeOptions = {\n /**\n * The call will throw an unhandled promise rejection on Android when the original Activity is dead or deactivated.\n * Set the value to `true` for suppressing the uncaught exception.\n */\n suppressDeactivateWarnings?: boolean;\n\n /**\n * A callback that is invoked when the keep-awake state changes.\n * @platform web\n */\n listener?: KeepAwakeListener;\n};\n"]}

View File

@@ -0,0 +1,64 @@
import { Subscription } from 'expo-modules-core';
import { KeepAwakeListener, KeepAwakeOptions } from './KeepAwake.types';
/** Default tag, used when no tag has been specified in keep awake method calls. */
export declare const ExpoKeepAwakeTag = "ExpoKeepAwakeDefaultTag";
/** @returns `true` on all platforms except [unsupported web browsers](https://caniuse.com/wake-lock). */
export declare function isAvailableAsync(): Promise<boolean>;
/**
* A React hook to keep the screen awake for as long as the owner component is mounted.
* The optionally provided `tag` argument is used when activating and deactivating the keep-awake
* feature. If unspecified, an ID unique to the owner component is used. See the documentation for
* `activateKeepAwakeAsync` below to learn more about the `tag` argument.
*
* @param tag Tag to lock screen sleep prevention. If not provided, an ID unique to the owner component is used.
* @param options Additional options for the keep awake hook.
*/
export declare function useKeepAwake(tag?: string, options?: KeepAwakeOptions): void;
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
* @deprecated use `activateKeepAwakeAsync` instead.
*/
export declare function activateKeepAwake(tag?: string): Promise<void>;
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
*/
export declare function activateKeepAwakeAsync(tag?: string): Promise<void>;
/**
* Releases the lock on screen-sleep prevention associated with the given `tag` value. If `tag`
* is unspecified, it defaults to the same default tag that `activateKeepAwake` uses.
*
* @param tag Tag to release the lock on screen sleep prevention. If not provided,
* the default tag is used.
*/
export declare function deactivateKeepAwake(tag?: string): Promise<void>;
/**
* Observe changes to the keep awake timer.
* On web, this changes when navigating away from the active window/tab. No-op on native.
* @platform web
*
* @example
* ```ts
* KeepAwake.addListener(({ state }) => {
* // ...
* });
* ```
*/
export declare function addListener(tagOrListener: string | KeepAwakeListener, listener?: KeepAwakeListener): Subscription;
export * from './KeepAwake.types';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAItE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,yGAAyG;AACzG,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAKzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAoB3E;AAGD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/E;AAGD;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,GAAE,MAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1F;AAGD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,GAAE,MAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,MAAM,GAAG,iBAAiB,EACzC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,YAAY,CAUd;AAED,cAAc,mBAAmB,CAAC"}

View File

@@ -0,0 +1,108 @@
import { UnavailabilityError } from 'expo-modules-core';
import { useEffect, useId } from 'react';
import ExpoKeepAwake from './ExpoKeepAwake';
/** Default tag, used when no tag has been specified in keep awake method calls. */
export const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';
/** @returns `true` on all platforms except [unsupported web browsers](https://caniuse.com/wake-lock). */
export async function isAvailableAsync() {
if (ExpoKeepAwake.isAvailableAsync) {
return await ExpoKeepAwake.isAvailableAsync();
}
return true;
}
/**
* A React hook to keep the screen awake for as long as the owner component is mounted.
* The optionally provided `tag` argument is used when activating and deactivating the keep-awake
* feature. If unspecified, an ID unique to the owner component is used. See the documentation for
* `activateKeepAwakeAsync` below to learn more about the `tag` argument.
*
* @param tag Tag to lock screen sleep prevention. If not provided, an ID unique to the owner component is used.
* @param options Additional options for the keep awake hook.
*/
export function useKeepAwake(tag, options) {
const defaultTag = useId();
const tagOrDefault = tag ?? defaultTag;
useEffect(() => {
let isMounted = true;
activateKeepAwakeAsync(tagOrDefault).then(() => {
if (isMounted && ExpoKeepAwake.addListenerForTag && options?.listener) {
addListener(tagOrDefault, options.listener);
}
});
return () => {
isMounted = false;
if (options?.suppressDeactivateWarnings) {
deactivateKeepAwake(tagOrDefault).catch(() => { });
}
else {
deactivateKeepAwake(tagOrDefault);
}
};
}, [tagOrDefault]);
}
// @needsAudit
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
* @deprecated use `activateKeepAwakeAsync` instead.
*/
export function activateKeepAwake(tag = ExpoKeepAwakeTag) {
console.warn('`activateKeepAwake` is deprecated. Use `activateKeepAwakeAsync` instead.');
return activateKeepAwakeAsync(tag);
}
// @needsAudit
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
*/
export async function activateKeepAwakeAsync(tag = ExpoKeepAwakeTag) {
await ExpoKeepAwake.activate?.(tag);
}
// @needsAudit
/**
* Releases the lock on screen-sleep prevention associated with the given `tag` value. If `tag`
* is unspecified, it defaults to the same default tag that `activateKeepAwake` uses.
*
* @param tag Tag to release the lock on screen sleep prevention. If not provided,
* the default tag is used.
*/
export async function deactivateKeepAwake(tag = ExpoKeepAwakeTag) {
await ExpoKeepAwake.deactivate?.(tag);
}
/**
* Observe changes to the keep awake timer.
* On web, this changes when navigating away from the active window/tab. No-op on native.
* @platform web
*
* @example
* ```ts
* KeepAwake.addListener(({ state }) => {
* // ...
* });
* ```
*/
export function addListener(tagOrListener, listener) {
// Assert so the type is non-nullable.
if (!ExpoKeepAwake.addListenerForTag) {
throw new UnavailabilityError('ExpoKeepAwake', 'addListenerForTag');
}
const tag = typeof tagOrListener === 'string' ? tagOrListener : ExpoKeepAwakeTag;
const _listener = typeof tagOrListener === 'function' ? tagOrListener : listener;
return ExpoKeepAwake.addListenerForTag(tag, _listener);
}
export * from './KeepAwake.types';
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
{
"platforms": ["apple", "android"],
"apple": {
"modules": ["KeepAwakeModule"]
},
"android": {
"modules": ["expo.modules.keepawake.KeepAwakeModule"]
}
}

View File

@@ -0,0 +1,36 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'ExpoKeepAwake'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platforms = {
:ios => '13.4',
:osx => '10.15',
:tvos => '13.4'
}
s.swift_version = '5.4'
s.source = { git: 'https://github.com/expo/expo.git' }
s.static_framework = true
s.dependency 'ExpoModulesCore'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'SWIFT_COMPILATION_MODE' => 'wholemodule'
}
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
s.source_files = "**/*.h"
s.vendored_frameworks = "#{s.name}.xcframework"
else
s.source_files = "**/*.{h,m,swift}"
end
end

View File

@@ -0,0 +1,57 @@
// Copyright 2021-present 650 Industries. All rights reserved.
import ExpoModulesCore
public final class KeepAwakeModule: Module {
private var activeTags = Set<String>()
public func definition() -> ModuleDefinition {
Name("ExpoKeepAwake")
AsyncFunction("activate") { (tag: String) -> Bool in
if self.activeTags.isEmpty {
setActivated(true)
}
self.activeTags.insert(tag)
return true
}
AsyncFunction("deactivate") { (tag: String) -> Bool in
self.activeTags.remove(tag)
if self.activeTags.isEmpty {
setActivated(false)
}
return true
}
AsyncFunction("isActivated") { () -> Bool in
#if os(iOS) || os(tvOS)
return DispatchQueue.main.sync {
return UIApplication.shared.isIdleTimerDisabled
}
#elseif os(macOS)
return false
#endif
}
OnAppEntersForeground {
if !self.activeTags.isEmpty {
setActivated(true)
}
}
OnAppEntersBackground {
if !self.activeTags.isEmpty {
setActivated(false)
}
}
}
}
private func setActivated(_ activated: Bool) {
#if os(iOS) || os(tvOS)
DispatchQueue.main.async {
UIApplication.shared.isIdleTimerDisabled = activated
}
#endif
}

View File

@@ -0,0 +1,46 @@
{
"name": "expo-keep-awake",
"version": "13.0.2",
"description": "Provides a React component that prevents the screen sleeping when rendered. It also exposes static methods to control the behavior imperatively.",
"main": "build/index.js",
"types": "build/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "expo-module build",
"clean": "expo-module clean",
"lint": "expo-module lint",
"test": "expo-module test",
"prepare": "expo-module prepare",
"prepublishOnly": "expo-module prepublishOnly",
"expo-module": "expo-module"
},
"keywords": [
"react-native",
"expo",
"awake",
"keep-awake"
],
"repository": {
"type": "git",
"url": "https://github.com/expo/expo.git",
"directory": "packages/expo-keep-awake"
},
"bugs": {
"url": "https://github.com/expo/expo/issues"
},
"author": "650 Industries, Inc.",
"license": "MIT",
"homepage": "https://docs.expo.dev/versions/latest/sdk/keep-awake/",
"dependencies": {},
"devDependencies": {
"@testing-library/react-hooks": "^7.0.1",
"expo-module-scripts": "^3.0.0"
},
"peerDependencies": {
"expo": "*"
},
"jest": {
"preset": "expo-module-scripts"
},
"gitHead": "82b5a4a7ada98ca26cd99d097400b01240cbcf99"
}

View File

@@ -0,0 +1,2 @@
import { requireNativeModule } from 'expo-modules-core';
export default requireNativeModule('ExpoKeepAwake');

View File

@@ -0,0 +1,77 @@
import { CodedError, Platform, Subscription } from 'expo-modules-core';
import { KeepAwakeEventState, KeepAwakeListener } from './KeepAwake.types';
const wakeLockMap: Record<string, WakeLockSentinel> = {};
type WakeLockSentinel = {
onrelease: null | ((event: any) => void);
released: boolean;
type: 'screen';
release?: Function;
addEventListener?: (event: string, listener: (event: any) => void) => void;
removeEventListener?: (event: string, listener: (event: any) => void) => void;
};
declare const navigator: {
wakeLock: {
request(type: 'screen'): Promise<WakeLockSentinel>;
};
};
/** Wraps the webWakeLock API https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API */
export default {
async isAvailableAsync() {
if (Platform.isDOMAvailable) {
return 'wakeLock' in navigator;
}
return false;
},
async activate(tag: string) {
if (!Platform.isDOMAvailable) {
return;
}
const wakeLock = await navigator.wakeLock.request('screen');
wakeLockMap[tag] = wakeLock;
},
async deactivate(tag: string) {
if (!Platform.isDOMAvailable) {
return;
}
if (wakeLockMap[tag]) {
wakeLockMap[tag].release?.();
delete wakeLockMap[tag];
} else {
throw new CodedError(
'ERR_KEEP_AWAKE_TAG_INVALID',
`The wake lock with tag ${tag} has not activated yet`
);
}
},
addListenerForTag(tag: string, listener: KeepAwakeListener): Subscription {
const eventListener = () => {
listener({ state: KeepAwakeEventState.RELEASE });
};
const sentinel = wakeLockMap[tag];
if (sentinel) {
if ('addEventListener' in sentinel) {
sentinel.addEventListener?.('release', eventListener);
} else {
sentinel.onrelease = eventListener;
}
}
return {
remove: () => {
const sentinel = wakeLockMap[tag];
if (sentinel) {
if (sentinel.removeEventListener) {
sentinel.removeEventListener('release', eventListener);
} else {
sentinel.onrelease = null;
}
}
},
};
},
};

View File

@@ -0,0 +1,27 @@
// @needsAudit
export type KeepAwakeEvent = {
/** Keep awake state. */
state: KeepAwakeEventState;
};
// @needsAudit
export enum KeepAwakeEventState {
RELEASE = 'release',
}
// @needsAudit
export type KeepAwakeListener = (event: KeepAwakeEvent) => void;
export type KeepAwakeOptions = {
/**
* The call will throw an unhandled promise rejection on Android when the original Activity is dead or deactivated.
* Set the value to `true` for suppressing the uncaught exception.
*/
suppressDeactivateWarnings?: boolean;
/**
* A callback that is invoked when the keep-awake state changes.
* @platform web
*/
listener?: KeepAwakeListener;
};

View File

@@ -0,0 +1,122 @@
import { Subscription, UnavailabilityError } from 'expo-modules-core';
import { useEffect, useId } from 'react';
import ExpoKeepAwake from './ExpoKeepAwake';
import { KeepAwakeListener, KeepAwakeOptions } from './KeepAwake.types';
/** Default tag, used when no tag has been specified in keep awake method calls. */
export const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';
/** @returns `true` on all platforms except [unsupported web browsers](https://caniuse.com/wake-lock). */
export async function isAvailableAsync(): Promise<boolean> {
if (ExpoKeepAwake.isAvailableAsync) {
return await ExpoKeepAwake.isAvailableAsync();
}
return true;
}
/**
* A React hook to keep the screen awake for as long as the owner component is mounted.
* The optionally provided `tag` argument is used when activating and deactivating the keep-awake
* feature. If unspecified, an ID unique to the owner component is used. See the documentation for
* `activateKeepAwakeAsync` below to learn more about the `tag` argument.
*
* @param tag Tag to lock screen sleep prevention. If not provided, an ID unique to the owner component is used.
* @param options Additional options for the keep awake hook.
*/
export function useKeepAwake(tag?: string, options?: KeepAwakeOptions): void {
const defaultTag = useId();
const tagOrDefault = tag ?? defaultTag;
useEffect(() => {
let isMounted = true;
activateKeepAwakeAsync(tagOrDefault).then(() => {
if (isMounted && ExpoKeepAwake.addListenerForTag && options?.listener) {
addListener(tagOrDefault, options.listener);
}
});
return () => {
isMounted = false;
if (options?.suppressDeactivateWarnings) {
deactivateKeepAwake(tagOrDefault).catch(() => {});
} else {
deactivateKeepAwake(tagOrDefault);
}
};
}, [tagOrDefault]);
}
// @needsAudit
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
* @deprecated use `activateKeepAwakeAsync` instead.
*/
export function activateKeepAwake(tag: string = ExpoKeepAwakeTag): Promise<void> {
console.warn('`activateKeepAwake` is deprecated. Use `activateKeepAwakeAsync` instead.');
return activateKeepAwakeAsync(tag);
}
// @needsAudit
/**
* Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.
*
* If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`
* with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate
* each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.
*
* Web support [is limited](https://caniuse.com/wake-lock).
*
* @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.
*/
export async function activateKeepAwakeAsync(tag: string = ExpoKeepAwakeTag): Promise<void> {
await ExpoKeepAwake.activate?.(tag);
}
// @needsAudit
/**
* Releases the lock on screen-sleep prevention associated with the given `tag` value. If `tag`
* is unspecified, it defaults to the same default tag that `activateKeepAwake` uses.
*
* @param tag Tag to release the lock on screen sleep prevention. If not provided,
* the default tag is used.
*/
export async function deactivateKeepAwake(tag: string = ExpoKeepAwakeTag): Promise<void> {
await ExpoKeepAwake.deactivate?.(tag);
}
/**
* Observe changes to the keep awake timer.
* On web, this changes when navigating away from the active window/tab. No-op on native.
* @platform web
*
* @example
* ```ts
* KeepAwake.addListener(({ state }) => {
* // ...
* });
* ```
*/
export function addListener(
tagOrListener: string | KeepAwakeListener,
listener?: KeepAwakeListener
): Subscription {
// Assert so the type is non-nullable.
if (!ExpoKeepAwake.addListenerForTag) {
throw new UnavailabilityError('ExpoKeepAwake', 'addListenerForTag');
}
const tag = typeof tagOrListener === 'string' ? tagOrListener : ExpoKeepAwakeTag;
const _listener = typeof tagOrListener === 'function' ? tagOrListener : listener;
return ExpoKeepAwake.addListenerForTag(tag, _listener);
}
export * from './KeepAwake.types';

View File

@@ -0,0 +1,9 @@
// @generated by expo-module-scripts
{
"extends": "expo-module-scripts/tsconfig.base",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./src"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
}