mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
move the ReactNativeFeatureFlags outside of sync dir
Reviewed By: bvaughn Differential Revision: D5627037 fbshipit-source-id: 0544b822ba03090a74695911b6951e91262478a0
This commit is contained in:
committed by
Facebook Github Bot
parent
091878a61a
commit
66da0d27da
46
Libraries/ReactNative/ReactNativeFeatureFlags.js
Normal file
46
Libraries/ReactNative/ReactNativeFeatureFlags.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ReactNativeFeatureFlags
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// =============================================================================
|
||||
// IMPORTANT:
|
||||
// When syncing React Renderer, make sure the feature flags are still compatible
|
||||
// =============================================================================
|
||||
|
||||
var useFiber;
|
||||
|
||||
var ReactNativeFeatureFlags = {
|
||||
get useFiber(): boolean {
|
||||
if (useFiber == null) {
|
||||
useFiber = true;
|
||||
if (__DEV__) {
|
||||
require('Systrace').installReactHook(useFiber);
|
||||
}
|
||||
}
|
||||
return useFiber;
|
||||
},
|
||||
set useFiber(enabled: boolean): void {
|
||||
if (useFiber != null) {
|
||||
throw new Error(
|
||||
'Cannot set useFiber feature flag after it has been accessed. ' +
|
||||
'Please override it before requiring React.',
|
||||
);
|
||||
}
|
||||
useFiber = enabled;
|
||||
if (__DEV__) {
|
||||
require('Systrace').installReactHook(useFiber);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = ReactNativeFeatureFlags;
|
||||
Reference in New Issue
Block a user