您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Proximity.m 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright @ 2017-present Atlassian Pty Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <UIKit/UIKit.h>
  17. #import <React/RCTBridgeModule.h>
  18. @interface Proximity : NSObject<RCTBridgeModule>
  19. @end
  20. @implementation Proximity
  21. RCT_EXPORT_MODULE();
  22. - (dispatch_queue_t)methodQueue {
  23. return dispatch_get_main_queue();
  24. }
  25. /**
  26. * Enables / disables the proximity sensor monitoring. On iOS enabling the
  27. * proximity sensor automatically dims the screen and disables touch controls,
  28. * so there is nothing else to do (unlike on Android)!
  29. *
  30. * @param enabled `YES` to enable proximity (sensor) monitoring; `NO`,
  31. * otherwise.
  32. */
  33. RCT_EXPORT_METHOD(setEnabled:(BOOL)enabled) {
  34. [[UIDevice currentDevice] setProximityMonitoringEnabled:enabled];
  35. }
  36. @end