Fix prepack warning in RN bridge code
Reviewed By: yungsters Differential Revision: D7903364 fbshipit-source-id: 4ef888f4e7f773f9fbc5183db2470b0f7b368d8a
This commit is contained in:
parent
b5a780608e
commit
7e97ed00bc
|
@ -40,7 +40,18 @@ const FrameRateLogger = {
|
|||
'Trying to debug FrameRateLogger without the native module!',
|
||||
);
|
||||
}
|
||||
NativeModules.FrameRateLogger && NativeModules.FrameRateLogger.setGlobalOptions(options);
|
||||
if (NativeModules.FrameRateLogger) {
|
||||
// Freeze the object to avoid the prepack warning (PP0017) about leaking
|
||||
// unfrozen objects.
|
||||
// Needs to clone the object first to avoid modifying the argument.
|
||||
const optionsClone = {
|
||||
debug: !!options.debug,
|
||||
reportStackTraces: !!options.reportStackTraces,
|
||||
};
|
||||
Object.freeze(optionsClone);
|
||||
Object.seal(optionsClone);
|
||||
NativeModules.FrameRateLogger.setGlobalOptions(optionsClone);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue