从那天起我就找不到任何方法在 React Native 中检测锁定/解锁事件.
Since that day I couldn't find any way to detect Lock/Unlock event in React native.
解决方案:
- 我们在 Android 和 iOS 中创建了示例模块(本机代码以获得锁定/解锁事件)
- 使用Android studio/XCode,我们导出为React 原生模块
- 在React Native
中导入这些模块
- We've created sample modules in Android and iOS separate (Native code to get Lock/Unlock events)
- Using Android studio / XCode we've exported as React native modules
-
Imported these modules in React native
它对我们来说很好.
希望对您有所帮助.