mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix lint warns (#36748)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36748 EZ refactor fixing some lint warnings changelog: [internal] internal Reviewed By: sshic Differential Revision: D44465379 fbshipit-source-id: c02f1c8c2bb48c630a71362781c4c5c1093961ed
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb920217a9
commit
d2e591cb2b
+2
-5
@@ -510,7 +510,7 @@ public class ReactContext extends ContextWrapper {
|
||||
* JavaScriptContextHolder jsContext = reactContext.getJavaScriptContextHolder()
|
||||
* synchronized(jsContext) { nativeThingNeedingJsContext(jsContext.get()); }
|
||||
*/
|
||||
public JavaScriptContextHolder getJavaScriptContextHolder() {
|
||||
public @Nullable JavaScriptContextHolder getJavaScriptContextHolder() {
|
||||
if (mCatalystInstance != null) {
|
||||
return mCatalystInstance.getJavaScriptContextHolder();
|
||||
}
|
||||
@@ -532,15 +532,12 @@ public class ReactContext extends ContextWrapper {
|
||||
* @return The JS bundle URL set when the bundle was loaded
|
||||
*/
|
||||
public @Nullable String getSourceURL() {
|
||||
return mCatalystInstance.getSourceURL();
|
||||
return mCatalystInstance == null ? null : mCatalystInstance.getSourceURL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a JS segment after loading it from cache or server, make sure mCatalystInstance is
|
||||
* properly initialised and not null before calling.
|
||||
*
|
||||
* @param segmentId
|
||||
* @param path
|
||||
*/
|
||||
public void registerSegment(int segmentId, String path, Callback callback) {
|
||||
Assertions.assertNotNull(mCatalystInstance).registerSegment(segmentId, path);
|
||||
|
||||
+4
-4
@@ -35,16 +35,18 @@ public class StateWrapperImpl implements StateWrapper {
|
||||
@DoNotStrip private final HybridData mHybridData;
|
||||
private volatile boolean mDestroyed = false;
|
||||
|
||||
private static native HybridData initHybrid();
|
||||
|
||||
private StateWrapperImpl() {
|
||||
mHybridData = initHybrid();
|
||||
}
|
||||
|
||||
private static native HybridData initHybrid();
|
||||
|
||||
private native ReadableNativeMap getStateDataImpl();
|
||||
|
||||
private native ReadableMapBuffer getStateMapBufferDataImpl();
|
||||
|
||||
public native void updateStateImpl(@NonNull NativeMap map);
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ReadableMapBuffer getStateDataMapBuffer() {
|
||||
@@ -65,8 +67,6 @@ public class StateWrapperImpl implements StateWrapper {
|
||||
return getStateDataImpl();
|
||||
}
|
||||
|
||||
public native void updateStateImpl(@NonNull NativeMap map);
|
||||
|
||||
@Override
|
||||
public void updateState(@NonNull WritableMap map) {
|
||||
if (mDestroyed) {
|
||||
|
||||
+4
-4
@@ -15,14 +15,14 @@ import com.facebook.yoga.YogaMeasureMode;
|
||||
|
||||
public interface LayoutMetricsConversions {
|
||||
|
||||
public static float getMinSize(int viewMeasureSpec) {
|
||||
static float getMinSize(int viewMeasureSpec) {
|
||||
int mode = View.MeasureSpec.getMode(viewMeasureSpec);
|
||||
int size = View.MeasureSpec.getSize(viewMeasureSpec);
|
||||
|
||||
return mode == EXACTLY ? size : 0f;
|
||||
}
|
||||
|
||||
public static float getMaxSize(int viewMeasureSpec) {
|
||||
static float getMaxSize(int viewMeasureSpec) {
|
||||
int mode = View.MeasureSpec.getMode(viewMeasureSpec);
|
||||
int size = View.MeasureSpec.getSize(viewMeasureSpec);
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface LayoutMetricsConversions {
|
||||
return mode == View.MeasureSpec.UNSPECIFIED ? Float.POSITIVE_INFINITY : size;
|
||||
}
|
||||
|
||||
public static float getYogaSize(float minSize, float maxSize) {
|
||||
static float getYogaSize(float minSize, float maxSize) {
|
||||
if (minSize == maxSize) {
|
||||
return PixelUtil.toPixelFromDIP(maxSize);
|
||||
} else if (Float.isInfinite(maxSize)) {
|
||||
@@ -40,7 +40,7 @@ public interface LayoutMetricsConversions {
|
||||
}
|
||||
}
|
||||
|
||||
public static YogaMeasureMode getYogaMeasureMode(float minSize, float maxSize) {
|
||||
static YogaMeasureMode getYogaMeasureMode(float minSize, float maxSize) {
|
||||
if (minSize == maxSize) {
|
||||
return YogaMeasureMode.EXACTLY;
|
||||
} else if (Float.isInfinite(maxSize)) {
|
||||
|
||||
Reference in New Issue
Block a user