mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add @DoNotStrip to exported methods in NativeModule specs
Summary: NativeModule methods are meant to be called from JavaScript. As such, they may not necessarily have call-sites in Java. This means that they're succeptible to being stripped by proguard. This diff annotates all exported NativeModule methods with DoNotStrip, so that proguard doesn't strip them. We already do this in the legacy codegen. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D25723801 fbshipit-source-id: a7c8701e0a5d03a970f5f19cc6ae6b320a2e99a1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c776f09e5f
commit
6740b22ab0
+2
-1
@@ -395,6 +395,7 @@ module.exports = {
|
||||
'com.facebook.react.bridge.ReactMethod',
|
||||
'com.facebook.react.bridge.ReactModuleWithSpec',
|
||||
'com.facebook.react.turbomodule.core.interfaces.TurboModule',
|
||||
'com.facebook.proguard.annotations.DoNotStrip',
|
||||
]);
|
||||
|
||||
const methods = properties.map(method => {
|
||||
@@ -443,7 +444,7 @@ module.exports = {
|
||||
|
||||
const methodJavaAnnotation = `@ReactMethod${
|
||||
isSyncMethod ? '(isBlockingSynchronousMethod = true)' : ''
|
||||
}`;
|
||||
}\n @DoNotStrip`;
|
||||
const methodBody = method.optional
|
||||
? getFalsyReturnStatementFromReturnType(
|
||||
methodTypeAnnotation.returnTypeAnnotation,
|
||||
|
||||
Reference in New Issue
Block a user