mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-10 09:29:39 +08:00
Summary: This is the first diff in an effort to remove Geolocation from React Native. This diff removes the globally injected navigator.geolocation feature and instead requires explicit importing of `Geolocation`. When using Web APIs, people will need to patch `navigator.geolocation` on their own from now on. Reviewed By: sahrens Differential Revision: D14692386 fbshipit-source-id: c57b290b49728101250d726d67b1956ff23a9a92
21 lines
537 B
JavaScript
21 lines
537 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
'use strict';
|
|
|
|
const {polyfillObjectProperty} = require('PolyfillFunctions');
|
|
|
|
let navigator = global.navigator;
|
|
if (navigator === undefined) {
|
|
global.navigator = navigator = {};
|
|
}
|
|
|
|
// see https://github.com/facebook/react-native/issues/10881
|
|
polyfillObjectProperty(navigator, 'product', () => 'ReactNative');
|