Enable ANDROIDLINT in React Native (#42675)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42675

`ANDROIDLINT` config now has a base setup for RN. This enables it in arc linter, and fixes automatically fixable issues.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D53115471

fbshipit-source-id: 2556c21770f7c7ca54d1bccfff527d39df20101e
This commit is contained in:
Nick Gerleman
2024-01-26 21:54:37 -08:00
committed by Facebook GitHub Bot
parent 5e37c1f219
commit b5267d9436
46 changed files with 226 additions and 179 deletions
@@ -23,7 +23,7 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
val targetName = variant.name.capitalizeCompat()
val targetPath = variant.name
val buildDir = this.layout.buildDirectory.get().asFile
val buildDir = layout.buildDirectory.get().asFile
// Resources: generated/assets/react/<variant>/index.android.bundle
val resourcesDir = File(buildDir, "generated/res/react/$targetPath")
// Bundle: generated/assets/react/<variant>/index.android.bundle
@@ -40,7 +40,7 @@ abstract class PrepareBoostTask : DefaultTask() {
it.into(outputDir)
}
File(outputDir.asFile.get(), "boost").apply {
renameTo(File(this.parentFile, "boost_${boostVersion.get()}"))
renameTo(File(parentFile, "boost_${boostVersion.get()}"))
}
}
}
@@ -119,7 +119,7 @@ internal object DependencyUtils {
fun readVersionAndGroupStrings(propertiesFile: File): Pair<String, String> {
val reactAndroidProperties = Properties()
propertiesFile.inputStream().use { reactAndroidProperties.load(it) }
val versionStringFromFile = reactAndroidProperties[INTERNAL_VERSION_NAME] as? String ?: ""
val versionStringFromFile = (reactAndroidProperties[INTERNAL_VERSION_NAME] as? String).orEmpty()
// If on a nightly, we need to fetch the -SNAPSHOT artifact from Sonatype.
val versionString =
if (versionStringFromFile.startsWith("0.0.0") || "-nightly-" in versionStringFromFile) {
@@ -40,6 +40,6 @@ internal object Os {
if (isWindows()) {
this.relativeTo(base).path
} else {
this.absolutePath
absolutePath
}
}
@@ -122,7 +122,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
}
public int getValue() {
return this.value;
return value;
}
public static BatchExecutionOpCodes fromId(int id) {
@@ -26,7 +26,7 @@ public class InteropModuleRegistry {
private final HashMap<Class, Object> supportedModules;
public InteropModuleRegistry() {
this.supportedModules = new HashMap<>();
supportedModules = new HashMap<>();
}
public <T extends JavaScriptModule> boolean shouldReturnInteropModule(Class<T> requestedModule) {
@@ -25,7 +25,7 @@ public class JavascriptException extends RuntimeException
}
public @Nullable String getExtraDataAsJson() {
return this.extraDataAsJson;
return extraDataAsJson;
}
public JavascriptException setExtraDataAsJson(@Nullable String extraDataAsJson) {
@@ -38,13 +38,13 @@ class ReadableMapBuffer : MapBuffer {
@DoNotStrip
private constructor(hybridData: HybridData) {
this.mHybridData = hybridData
this.buffer = importByteBuffer()
mHybridData = hybridData
buffer = importByteBuffer()
readHeader()
}
private constructor(buffer: ByteBuffer) {
this.mHybridData = null
mHybridData = null
this.buffer = buffer
readHeader()
}
@@ -41,10 +41,10 @@ object DefaultNewArchitectureEntryPoint {
ReactFeatureFlags.useNativeViewConfigsInBridgelessMode = fabricEnabled && bridgelessEnabled
ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled
this.privateFabricEnabled = fabricEnabled
this.privateTurboModulesEnabled = turboModulesEnabled
this.privateConcurrentReactEnabled = fabricEnabled
this.privateBridgelessEnabled = bridgelessEnabled
privateFabricEnabled = fabricEnabled
privateTurboModulesEnabled = turboModulesEnabled
privateConcurrentReactEnabled = fabricEnabled
privateBridgelessEnabled = bridgelessEnabled
DefaultSoLoader.maybeLoadSoLibrary()
}
@@ -41,14 +41,14 @@ private constructor(
mutableListOf()
fun addCxxReactPackage(provider: () -> CxxReactPackage): Builder {
this.cxxReactPackageProviders.add({ _ -> provider() })
cxxReactPackageProviders.add({ _ -> provider() })
return this
}
fun addCxxReactPackage(
provider: (context: ReactApplicationContext) -> CxxReactPackage
): Builder {
this.cxxReactPackageProviders.add(provider)
cxxReactPackageProviders.add(provider)
return this
}
@@ -51,8 +51,8 @@ public class DevToolsReactPerfLogger implements ReactMarker.FabricMarkerListener
private final int mCounter;
public FabricCommitPointData(long timeStamp, int counter) {
this.mTimeStamp = timeStamp;
this.mCounter = counter;
mTimeStamp = timeStamp;
mCounter = counter;
}
public long getTimeStamp() {
@@ -69,7 +69,7 @@ public class DevToolsReactPerfLogger implements ReactMarker.FabricMarkerListener
private final Map<ReactMarkerConstants, FabricCommitPointData> mPoints = new HashMap<>();
private FabricCommitPoint(int commitNumber) {
this.mCommitNumber = commitNumber;
mCommitNumber = commitNumber;
}
private void addPoint(ReactMarkerConstants key, FabricCommitPointData data) {
@@ -65,7 +65,8 @@ class AnimationsDebugModule extends NativeAnimationsDebugModuleSpec {
FpsDebugFrameCallback.FpsInfo fpsInfo = mFrameCallback.getFpsInfo((long) animationStopTimeMs);
if (fpsInfo == null) {
Toast.makeText(getReactApplicationContext(), "Unable to get FPS info", Toast.LENGTH_LONG);
Toast.makeText(getReactApplicationContext(), "Unable to get FPS info", Toast.LENGTH_LONG)
.show();
} else {
String fpsString =
String.format(
@@ -24,7 +24,7 @@ public class ReactNetworkImageRequest extends ImageRequest {
protected ReactNetworkImageRequest(ImageRequestBuilder builder, ReadableMap headers) {
super(builder);
this.mHeaders = headers;
mHeaders = headers;
}
public ReadableMap getHeaders() {
@@ -25,8 +25,8 @@ public class ProgressResponseBody extends ResponseBody {
private long mTotalBytesRead;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
this.mResponseBody = responseBody;
this.mProgressListener = progressListener;
mResponseBody = responseBody;
mProgressListener = progressListener;
mTotalBytesRead = 0L;
}
@@ -28,7 +28,7 @@ public class ReactCookieJarContainer implements CookieJarContainer {
@Override
public void removeCookieJar() {
this.cookieJar = null;
cookieJar = null;
}
@Override
@@ -104,12 +104,12 @@ public class FileIoHandler implements Runnable {
if (!(params instanceof Number)) {
throw new Exception("params must be a file handle");
}
TtlFileInputStream stream = mOpenFiles.get((int) params);
TtlFileInputStream stream = mOpenFiles.get(params);
if (stream == null) {
throw new Exception("invalid file handle, it might have timed out");
}
mOpenFiles.remove((int) params);
mOpenFiles.remove(params);
stream.close();
responder.respond("");
} catch (Exception e) {
@@ -704,7 +704,7 @@ public class ReactPropertyProcessor extends ProcessorBase {
public ReactPropertyException(String message, PropertyInfo propertyInfo) {
super(message);
this.element = propertyInfo.element;
element = propertyInfo.element;
}
public ReactPropertyException(String message, Element element) {
@@ -647,7 +647,7 @@ public class Task<TResult> implements TaskInterface<TResult> {
synchronized (lock) {
completed = this.isCompleted();
if (!completed) {
this.continuations.add(
continuations.add(
new Continuation<TResult, Void>() {
@Override
public Void then(Task<TResult> task) {
@@ -704,7 +704,7 @@ public class Task<TResult> implements TaskInterface<TResult> {
synchronized (lock) {
completed = this.isCompleted();
if (!completed) {
this.continuations.add(
continuations.add(
new Continuation<TResult, Void>() {
@Override
public Void then(Task<TResult> task) {
@@ -24,7 +24,7 @@ class UnobservedErrorNotifier {
@Override
protected void finalize() throws Throwable {
try {
Task faultedTask = this.task;
Task faultedTask = task;
if (faultedTask != null) {
Task.UnobservedExceptionHandler ueh = Task.getUnobservedExceptionHandler();
if (ueh != null) {
@@ -44,8 +44,8 @@ public class LayoutShadowNode extends ReactShadowNodeImpl {
private MutableYogaValue() {}
private MutableYogaValue(MutableYogaValue mutableYogaValue) {
this.value = mutableYogaValue.value;
this.unit = mutableYogaValue.unit;
value = mutableYogaValue.value;
unit = mutableYogaValue.unit;
}
void setFromDynamic(Dynamic dynamic) {
@@ -28,7 +28,7 @@ class ScaleTypeStartInside extends ScalingUtils.AbstractScaleType {
float dx = parentRect.left;
float dy = parentRect.top;
outTransform.setScale(scale, scale);
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
outTransform.postTranslate((dx + 0.5f), (dy + 0.5f));
}
@Override
@@ -46,7 +46,7 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
}
public void setColor(@Nullable Integer color) {
this.mColor = color;
mColor = color;
}
public void setIndeterminate(boolean indeterminate) {
@@ -47,10 +47,10 @@ public class OnScrollDispatchHelper {
}
public float getXFlingVelocity() {
return this.mXFlingVelocity;
return mXFlingVelocity;
}
public float getYFlingVelocity() {
return this.mYFlingVelocity;
return mYFlingVelocity;
}
}
@@ -359,8 +359,7 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
Spanned text =
Assertions.assertNotNull(
this.mPreparedSpannableText,
"Spannable element has not been prepared in onBeforeLayout");
mPreparedSpannableText, "Spannable element has not been prepared in onBeforeLayout");
TextInlineViewPlaceholderSpan[] placeholders =
text.getSpans(0, text.length(), TextInlineViewPlaceholderSpan.class);
ArrayList<ReactShadowNode> shadowNodes = new ArrayList<>(placeholders.length);
@@ -126,7 +126,7 @@ public class TextLayoutManagerMapBuffer {
return false;
}
MapBuffer fragment = fragments.getMapBuffer((short) 0);
MapBuffer fragment = fragments.getMapBuffer(0);
MapBuffer textAttributes = fragment.getMapBuffer(FR_KEY_TEXT_ATTRIBUTES);
if (!textAttributes.contains(TextAttributeProps.TA_KEY_LAYOUT_DIRECTION)) {
@@ -18,7 +18,7 @@ public class CustomLineHeightSpan implements LineHeightSpan, ReactSpan {
private final int mHeight;
public CustomLineHeightSpan(float height) {
this.mHeight = (int) Math.ceil(height);
mHeight = (int) Math.ceil(height);
}
public int getLineHeight() {
@@ -22,13 +22,13 @@ public class ReactViewBackgroundManager {
private int mColor = Color.TRANSPARENT;
public ReactViewBackgroundManager(View view) {
this.mView = view;
mView = view;
}
public void cleanup() {
ViewCompat.setBackground(mView, null);
this.mView = null;
this.mReactBackgroundDrawable = null;
mView = null;
mReactBackgroundDrawable = null;
}
private ReactViewBackgroundDrawable getOrCreateReactViewBackground() {
@@ -11,7 +11,8 @@
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="#B3B3B3" />
android:color="#B3B3B3"
/>
</shape>
</item>
</layer-list>
@@ -4,7 +4,8 @@
<item name="android:textColor">@android:color/black</item>
</style>
<style name="Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen"
parent="@style/Theme.ReactNative.AppCompat.Light">
parent="@style/Theme.ReactNative.AppCompat.Light"
>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
@@ -81,9 +81,9 @@ class BaseJavaModuleTest {
private class MethodsModule : BaseJavaModule() {
override fun getName(): String = "Methods"
@ReactMethod fun regularMethod(a: String?, b: Int?) {}
@ReactMethod fun regularMethod(a: String?, b: Int?) = Unit
@ReactMethod fun asyncMethod(a: Int, p: Promise) {}
@ReactMethod fun asyncMethod(a: Int, p: Promise) = Unit
@ReactMethod(isBlockingSynchronousMethod = true) fun syncMethod(a: Int, b: Int): Int = a + b
}
@@ -95,6 +95,6 @@ class BaseJavaModuleTest {
private inner class GeneratedMethodsModule : NativeTestGeneratedModuleSpec() {
override fun getName(): String = "GeneratedMethods"
override fun generatedMethod(a: String?, b: Int?) {}
override fun generatedMethod(a: String?, b: Int?) = Unit
}
}
@@ -15,11 +15,11 @@ import com.facebook.react.uimanager.events.RCTEventEmitter
class FakeRCTEventEmitter : RCTEventEmitter {
override fun receiveEvent(targetReactTag: Int, eventName: String, event: WritableMap?) {}
override fun receiveEvent(targetReactTag: Int, eventName: String, event: WritableMap?) = Unit
override fun receiveTouches(
eventName: String,
touches: WritableArray,
changedIndices: WritableArray
) {}
) = Unit
}
@@ -132,7 +132,7 @@ class MultipartStreamReaderTest {
callCount++
}
override fun onChunkProgress(headers: Map<String, String>, loaded: Long, total: Long) {}
override fun onChunkProgress(headers: Map<String, String>, loaded: Long, total: Long) = Unit
}
private fun encodeUtf8(input: String): ByteString =
@@ -39,7 +39,7 @@ class DialogModuleTest {
private set
override fun invoke(vararg args: Any?) {
this.calls++
calls++
this.args = args
}
}
@@ -29,14 +29,14 @@ class ReactPropAnnotationSetterSpecTest {
override fun createViewInstance(reactContext: ThemedReactContext): View =
createViewInstance(reactContext)
override fun updateExtraData(root: View, extraData: Any) {}
override fun updateExtraData(root: View, extraData: Any) = Unit
}
@Test(expected = RuntimeException::class)
fun testMethodWithWrongNumberOfParams() {
object : BaseViewManager() {
@ReactProp(name = "prop")
fun setterWithIncorrectNumberOfArgs(v: View?, value: Boolean, otherValue: Boolean) {}
fun setterWithIncorrectNumberOfArgs(v: View?, value: Boolean, otherValue: Boolean) = Unit
}
.nativeProps
}
@@ -44,7 +44,7 @@ class ReactPropAnnotationSetterSpecTest {
@Test(expected = RuntimeException::class)
fun testMethodWithTooFewParams() {
object : BaseViewManager() {
@ReactProp(name = "prop") fun setterWithTooFewParams(v: View?) {}
@ReactProp(name = "prop") fun setterWithTooFewParams(v: View?) = Unit
}
.nativeProps
}
@@ -52,7 +52,8 @@ class ReactPropAnnotationSetterSpecTest {
@Test(expected = RuntimeException::class)
fun testUnsupportedPropValueType() {
object : BaseViewManager() {
@ReactProp(name = "prop") fun setterWithUnsupportedValueType(v: View?, value: Date?) {}
@ReactProp(name = "prop")
fun setterWithUnsupportedValueType(v: View?, value: Date?) = Unit
}
.nativeProps
}
@@ -60,7 +61,7 @@ class ReactPropAnnotationSetterSpecTest {
@Test(expected = RuntimeException::class)
fun testSetterWithNonViewParam() {
object : BaseViewManager() {
@ReactProp(name = "prop") fun setterWithNonViewParam(v: Any?, value: Boolean) {}
@ReactProp(name = "prop") fun setterWithNonViewParam(v: Any?, value: Boolean) = Unit
}
.nativeProps
}
@@ -69,7 +70,8 @@ class ReactPropAnnotationSetterSpecTest {
fun testGroupInvalidNumberOfParams() {
object : BaseViewManager() {
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithInvalidNumberOfParams(v: View?, index: Int, value: Float, other: Float) {}
fun setterWithInvalidNumberOfParams(v: View?, index: Int, value: Float, other: Float) =
Unit
}
.nativeProps
}
@@ -78,7 +80,7 @@ class ReactPropAnnotationSetterSpecTest {
fun testGroupTooFewParams() {
object : BaseViewManager() {
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithTooFewParams(v: View?, index: Int) {}
fun setterWithTooFewParams(v: View?, index: Int) = Unit
}
.nativeProps
}
@@ -87,7 +89,7 @@ class ReactPropAnnotationSetterSpecTest {
fun testGroupNoIndexParam() {
object : BaseViewManager() {
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithoutIndexParam(v: View?, value: Float, sth: Float) {}
fun setterWithoutIndexParam(v: View?, value: Float, sth: Float) = Unit
}
.nativeProps
}
@@ -96,7 +98,7 @@ class ReactPropAnnotationSetterSpecTest {
fun testGroupNoViewParam() {
object : BaseViewManager() {
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithoutViewParam(v: Any?, index: Int, value: Float) {}
fun setterWithoutViewParam(v: Any?, index: Int, value: Float) = Unit
}
.nativeProps
}
@@ -105,7 +107,7 @@ class ReactPropAnnotationSetterSpecTest {
fun testGroupUnsupportedPropType() {
object : BaseViewManager() {
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithUnsupportedPropType(v: View?, index: Int, value: Long) {}
fun setterWithUnsupportedPropType(v: View?, index: Int, value: Long) = Unit
}
.nativeProps
}
@@ -45,40 +45,40 @@ class ReactPropConstantsTest {
error("This method should not be executed as a part of this test")
}
@ReactProp(name = "boolProp") fun setBoolProp(v: View?, value: Boolean) {}
@ReactProp(name = "boolProp") fun setBoolProp(v: View?, value: Boolean) = Unit
@ReactProp(name = "intProp") fun setIntProp(v: View?, value: Int) {}
@ReactProp(name = "intProp") fun setIntProp(v: View?, value: Int) = Unit
@ReactProp(name = "floatProp") fun setFloatProp(v: View?, value: Float) {}
@ReactProp(name = "floatProp") fun setFloatProp(v: View?, value: Float) = Unit
@ReactProp(name = "doubleProp") fun setDoubleProp(v: View?, value: Double) {}
@ReactProp(name = "doubleProp") fun setDoubleProp(v: View?, value: Double) = Unit
@ReactProp(name = "stringProp") fun setStringProp(v: View?, value: String?) {}
@ReactProp(name = "stringProp") fun setStringProp(v: View?, value: String?) = Unit
@ReactProp(name = "boxedBoolProp") fun setBoxedBoolProp(v: View?, value: Boolean?) {}
@ReactProp(name = "boxedBoolProp") fun setBoxedBoolProp(v: View?, value: Boolean?) = Unit
@ReactProp(name = "boxedIntProp") fun setBoxedIntProp(v: View?, value: Int?) {}
@ReactProp(name = "boxedIntProp") fun setBoxedIntProp(v: View?, value: Int?) = Unit
@ReactProp(name = "arrayProp") fun setArrayProp(v: View?, value: ReadableArray?) {}
@ReactProp(name = "arrayProp") fun setArrayProp(v: View?, value: ReadableArray?) = Unit
@ReactProp(name = "mapProp") fun setMapProp(v: View?, value: ReadableMap?) {}
@ReactProp(name = "mapProp") fun setMapProp(v: View?, value: ReadableMap?) = Unit
@ReactPropGroup(names = ["floatGroupPropFirst", "floatGroupPropSecond"])
fun setFloatGroupProp(v: View?, index: Int, value: Float) {}
fun setFloatGroupProp(v: View?, index: Int, value: Float) = Unit
@ReactPropGroup(names = ["intGroupPropFirst", "intGroupPropSecond"])
fun setIntGroupProp(v: View?, index: Int, value: Int) {}
fun setIntGroupProp(v: View?, index: Int, value: Int) = Unit
@ReactPropGroup(names = ["boxedIntGroupPropFirst", "boxedIntGroupPropSecond"])
fun setBoxedIntGroupProp(v: View?, index: Int, value: Int?) {}
fun setBoxedIntGroupProp(v: View?, index: Int, value: Int?) = Unit
@ReactProp(name = "customIntProp", customType = "date")
fun customIntProp(v: View?, value: Int) {}
fun customIntProp(v: View?, value: Int) = Unit
@ReactPropGroup(
names = ["customBoxedIntGroupPropFirst", "customBoxedIntGroupPropSecond"],
customType = "color")
fun customIntGroupProp(v: View?, index: Int, value: Int?) {}
fun customIntGroupProp(v: View?, index: Int, value: Int?) = Unit
}
@Test
@@ -33,7 +33,7 @@ class ReactPropForShadowNodeSpecTest {
object : ReactShadowNodeImpl() {
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "prop")
fun setterWithIncorrectNumberOfArgs(value: Boolean, anotherValue: Int) {}
fun setterWithIncorrectNumberOfArgs(value: Boolean, anotherValue: Int) = Unit
}
.javaClass)
.nativeProps
@@ -43,7 +43,7 @@ class ReactPropForShadowNodeSpecTest {
fun testMethodWithTooFewParams() {
BaseViewManager(
object : ReactShadowNodeImpl() {
@ReactProp(name = "prop") fun setterWithNoArgs() {}
@ReactProp(name = "prop") fun setterWithNoArgs() = Unit
}
.javaClass)
.nativeProps
@@ -55,7 +55,7 @@ class ReactPropForShadowNodeSpecTest {
object : ReactShadowNodeImpl() {
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "prop")
fun setterWithMap(value: Map<*, *>) {}
fun setterWithMap(value: Map<*, *>) = Unit
}
.javaClass)
.nativeProps
@@ -67,7 +67,7 @@ class ReactPropForShadowNodeSpecTest {
object : ReactShadowNodeImpl() {
@Suppress("UNUSED_PARAMETER")
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithTooManyParams(index: Int, value: Float, boolean: Boolean) {}
fun setterWithTooManyParams(index: Int, value: Float, boolean: Boolean) = Unit
}
.javaClass)
.nativeProps
@@ -79,7 +79,7 @@ class ReactPropForShadowNodeSpecTest {
object : ReactShadowNodeImpl() {
@Suppress("UNUSED_PARAMETER")
@ReactPropGroup(names = ["props1", "prop2"])
fun setterWithTooFewParams(index: Int) {}
fun setterWithTooFewParams(index: Int) = Unit
}
.javaClass)
.nativeProps
@@ -91,7 +91,7 @@ class ReactPropForShadowNodeSpecTest {
object : ReactShadowNodeImpl() {
@Suppress("UNUSED_PARAMETER")
@ReactPropGroup(names = ["prop1", "prop2"])
fun setterWithNoIndexParam(value: Float, boolean: Boolean) {}
fun setterWithNoIndexParam(value: Float, boolean: Boolean) = Unit
}
.javaClass)
.nativeProps
@@ -110,7 +110,7 @@ class ReactPropForShadowNodeSpecTest {
override fun createViewInstance(reactContext: ThemedReactContext): View = View(null)
override fun updateExtraData(root: View, extraData: Any?) {}
override fun updateExtraData(root: View, extraData: Any?) = Unit
}
}
}
@@ -28,11 +28,13 @@ import org.robolectric.RuntimeEnvironment
class SimpleViewPropertyTest {
private class ConcreteViewManager : SimpleViewManager<View?>() {
@Suppress("UNUSED_PARAMETER") @ReactProp(name = "foo") fun setFoo(view: View, foo: Boolean) {}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "foo")
fun setFoo(view: View, foo: Boolean) = Unit
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "bar")
fun setBar(view: View, bar: ReadableMap?) {}
fun setBar(view: View, bar: ReadableMap?) = Unit
override fun createViewInstance(reactContext: ThemedReactContext): View {
return View(reactContext)
@@ -28,21 +28,21 @@ class FakeEventDispatcher : EventDispatcher {
recordedDispatchedEvents.add(event)
}
override fun dispatchAllEvents() {}
override fun dispatchAllEvents() = Unit
override fun addListener(listener: EventDispatcherListener) {}
override fun addListener(listener: EventDispatcherListener) = Unit
override fun removeListener(listener: EventDispatcherListener) {}
override fun removeListener(listener: EventDispatcherListener) = Unit
override fun addBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {}
override fun addBatchEventDispatchedListener(listener: BatchEventDispatchedListener) = Unit
override fun removeBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {}
override fun removeBatchEventDispatchedListener(listener: BatchEventDispatchedListener) = Unit
override fun registerEventEmitter(uiManagerType: Int, eventEmitter: RCTEventEmitter) {}
override fun registerEventEmitter(uiManagerType: Int, eventEmitter: RCTEventEmitter) = Unit
override fun registerEventEmitter(uiManagerType: Int, eventEmitter: RCTModernEventEmitter) {}
override fun registerEventEmitter(uiManagerType: Int, eventEmitter: RCTModernEventEmitter) = Unit
override fun unregisterEventEmitter(uiManagerType: Int) {}
override fun unregisterEventEmitter(uiManagerType: Int) = Unit
override fun onCatalystInstanceDestroyed() {}
override fun onCatalystInstanceDestroyed() = Unit
}
@@ -26,87 +26,87 @@ import com.facebook.yoga.YogaWrap
/** A fake [YogaNode] that allows us to test Yoga without using the real JNI. */
class FakeYogaNode : YogaNode() {
override fun setWidth(width: Float) {}
override fun setWidth(width: Float) = Unit
override fun setWidthPercent(percent: Float) {}
override fun setWidthPercent(percent: Float) = Unit
override fun setMinWidth(minWidth: Float) {}
override fun setMinWidth(minWidth: Float) = Unit
override fun setMinWidthPercent(percent: Float) {}
override fun setMinWidthPercent(percent: Float) = Unit
override fun setMaxWidth(maxWidth: Float) {}
override fun setMaxWidth(maxWidth: Float) = Unit
override fun setMaxWidthPercent(percent: Float) {}
override fun setMaxWidthPercent(percent: Float) = Unit
override fun setWidthAuto() {}
override fun setWidthAuto() = Unit
override fun setHeight(height: Float) {}
override fun setHeight(height: Float) = Unit
override fun setHeightPercent(percent: Float) {}
override fun setHeightPercent(percent: Float) = Unit
override fun setMinHeight(minHeight: Float) {}
override fun setMinHeight(minHeight: Float) = Unit
override fun setMinHeightPercent(percent: Float) {}
override fun setMinHeightPercent(percent: Float) = Unit
override fun setMaxHeight(maxheight: Float) {}
override fun setMaxHeight(maxheight: Float) = Unit
override fun setMaxHeightPercent(percent: Float) {}
override fun setMaxHeightPercent(percent: Float) = Unit
override fun setHeightAuto() {}
override fun setHeightAuto() = Unit
override fun setMargin(edge: YogaEdge?, margin: Float) {}
override fun setMargin(edge: YogaEdge?, margin: Float) = Unit
override fun setMarginPercent(edge: YogaEdge?, percent: Float) {}
override fun setMarginPercent(edge: YogaEdge?, percent: Float) = Unit
override fun setMarginAuto(edge: YogaEdge?) {}
override fun setMarginAuto(edge: YogaEdge?) = Unit
override fun setPadding(edge: YogaEdge?, padding: Float) {}
override fun setPadding(edge: YogaEdge?, padding: Float) = Unit
override fun setPaddingPercent(edge: YogaEdge?, percent: Float) {}
override fun setPaddingPercent(edge: YogaEdge?, percent: Float) = Unit
override fun setPositionType(positionType: YogaPositionType?) {}
override fun setPositionType(positionType: YogaPositionType?) = Unit
override fun setPosition(edge: YogaEdge?, position: Float) {}
override fun setPosition(edge: YogaEdge?, position: Float) = Unit
override fun setPositionPercent(edge: YogaEdge?, percent: Float) {}
override fun setPositionPercent(edge: YogaEdge?, percent: Float) = Unit
override fun setAlignContent(alignContent: YogaAlign?) {}
override fun setAlignContent(alignContent: YogaAlign?) = Unit
override fun setAlignItems(alignItems: YogaAlign?) {}
override fun setAlignItems(alignItems: YogaAlign?) = Unit
override fun setAlignSelf(alignSelf: YogaAlign?) {}
override fun setAlignSelf(alignSelf: YogaAlign?) = Unit
override fun setFlex(flex: Float) {}
override fun setFlex(flex: Float) = Unit
override fun setFlexBasisAuto() {}
override fun setFlexBasisAuto() = Unit
override fun setFlexBasisPercent(percent: Float) {}
override fun setFlexBasisPercent(percent: Float) = Unit
override fun setFlexBasis(flexBasis: Float) {}
override fun setFlexBasis(flexBasis: Float) = Unit
override fun setFlexDirection(flexDirection: YogaFlexDirection?) {}
override fun setFlexDirection(flexDirection: YogaFlexDirection?) = Unit
override fun setFlexGrow(flexGrow: Float) {}
override fun setFlexGrow(flexGrow: Float) = Unit
override fun setFlexShrink(flexShrink: Float) {}
override fun setFlexShrink(flexShrink: Float) = Unit
override fun setJustifyContent(justifyContent: YogaJustify?) {}
override fun setJustifyContent(justifyContent: YogaJustify?) = Unit
override fun setDirection(direction: YogaDirection?) {}
override fun setDirection(direction: YogaDirection?) = Unit
override fun setBorder(edge: YogaEdge?, border: Float) {}
override fun setBorder(edge: YogaEdge?, border: Float) = Unit
override fun setWrap(flexWrap: YogaWrap?) {}
override fun setWrap(flexWrap: YogaWrap?) = Unit
override fun setAspectRatio(aspectRatio: Float) {}
override fun setAspectRatio(aspectRatio: Float) = Unit
override fun setIsReferenceBaseline(isReferenceBaseline: Boolean) {}
override fun setIsReferenceBaseline(isReferenceBaseline: Boolean) = Unit
override fun setMeasureFunction(measureFunction: YogaMeasureFunction?) {}
override fun setMeasureFunction(measureFunction: YogaMeasureFunction?) = Unit
override fun setBaselineFunction(baselineFunction: YogaBaselineFunction?) {}
override fun setBaselineFunction(baselineFunction: YogaBaselineFunction?) = Unit
override fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) {}
override fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) = Unit
override fun getWidth(): YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED)
@@ -17,7 +17,7 @@ import org.robolectric.annotation.Implements
@Implements(SoLoader::class)
class ShadowSoLoader {
companion object {
@JvmStatic @Implementation fun init(context: Context?, flags: Int) {}
@JvmStatic @Implementation fun init(context: Context?, flags: Int) = Unit
@JvmStatic @Implementation fun loadLibrary(shortName: String?): Boolean = true
}
@@ -30,7 +30,7 @@ class MainApplication : Application(), ReactApplication {
}
override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
get() = getDefaultReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
@@ -17,7 +17,8 @@
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
>
<selector>
<!--
@@ -122,7 +122,7 @@ class RNTesterApplication : Application(), ReactApplication {
}
override val reactHost: ReactHost
get() = DefaultReactHost.getDefaultReactHost(this.applicationContext, reactNativeHost)
get() = DefaultReactHost.getDefaultReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik)
@@ -4,71 +4,105 @@
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
>
<path android:fillColor="#282c34"
android:pathData="M0,0h108v108h-108z"/>
android:pathData="M0,0h108v108h-108z"
/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"
/>
</vector>
@@ -2,22 +2,26 @@
android:width="108dp"
android:height="108dp"
android:viewportWidth="400"
android:viewportHeight="361">
android:viewportHeight="361"
>
<group android:scaleX="0.5"
android:scaleY="0.45125"
android:translateX="100"
android:translateY="99.04938">
android:translateY="99.04938"
>
<path
android:pathData="M200.5,141.29C179.34,141.29 162.19,158.44 162.19,179.6C162.19,200.76 179.34,217.91 200.5,217.91C221.65,217.91 238.81,200.76 238.81,179.6C238.81,158.44 221.65,141.29 200.5,141.29"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
android:strokeColor="#00000000"
/>
<path
android:pathData="M399.97,180.1C399.97,149.99 372.12,123.59 327.77,106.22C328.36,102.31 328.9,98.44 329.28,94.64C333.65,51.39 323.24,20.17 299.97,6.72C273.94,-8.32 237.17,2.6 199.99,32.37C162.81,2.6 126.03,-8.32 100,6.72C76.73,20.17 66.32,51.39 70.69,94.64C71.07,98.44 71.6,102.32 72.2,106.25C68.51,107.66 64.88,109.16 61.39,110.73C21.8,128.54 0,153.2 0,180.1C0,210.2 27.85,236.6 72.2,253.97C71.6,257.88 71.07,261.75 70.69,265.55C66.32,308.81 76.73,340.02 100,353.47C108,358.01 117.06,360.33 126.26,360.19C148.3,360.19 174.04,348.58 199.99,327.82C225.92,348.58 251.67,360.19 273.74,360.19C282.94,360.33 292,358.01 300,353.47C323.27,340.02 333.68,308.81 329.31,265.55C328.93,261.75 328.39,257.88 327.8,253.97C372.15,236.63 400,210.18 400,180.1M273.57,19.07C279.48,18.92 285.33,20.36 290.5,23.22C306.66,32.56 313.91,57.88 310.39,92.7C310.15,95.08 309.86,97.48 309.52,99.89C291.08,94.33 272.2,90.37 253.08,88.04C241.49,72.62 228.61,58.22 214.56,45C236.62,27.94 257.32,19.07 273.56,19.07M265.98,218.23C258.84,230.63 251.07,242.66 242.7,254.25C228.5,255.71 214.24,256.44 199.97,256.43C185.71,256.44 171.45,255.71 157.26,254.25C148.91,242.66 141.16,230.63 134.05,218.23C126.91,205.87 120.43,193.14 114.62,180.1C120.43,167.05 126.91,154.32 134.05,141.96C141.15,129.61 148.87,117.63 157.19,106.06C171.41,104.57 185.69,103.82 199.99,103.83C214.25,103.82 228.51,104.55 242.7,106.01C251.04,117.59 258.8,129.59 265.92,141.96C273.05,154.33 279.54,167.06 285.35,180.1C279.54,193.14 273.05,205.87 265.92,218.23M295.06,204.11C299.54,216.33 303.22,228.84 306.07,241.54C293.69,245.4 281.08,248.45 268.31,250.65C273.16,243.33 277.87,235.7 282.42,227.78C286.92,219.96 291.14,212.06 295.12,204.17M173.19,274.64C181.97,275.17 190.93,275.48 200,275.48C209.07,275.48 218.09,275.17 226.88,274.64C218.55,284.63 209.57,294.07 200,302.89C190.45,294.07 181.5,284.63 173.19,274.64ZM131.68,250.62C118.9,248.43 106.28,245.39 93.9,241.54C96.74,228.86 100.41,216.37 104.87,204.17C108.79,212.06 113,219.96 117.57,227.78C122.14,235.61 126.87,243.32 131.68,250.65M104.87,156.01C100.42,143.85 96.77,131.41 93.93,118.78C106.28,114.92 118.87,111.87 131.61,109.64C126.78,116.94 122.05,124.51 117.5,132.41C112.94,140.3 108.78,148.1 104.8,156.01M226.8,85.54C218.02,85 209.06,84.69 199.92,84.69C190.85,84.69 181.91,84.98 173.11,85.54C181.41,75.55 190.37,66.11 199.92,57.29C209.49,66.11 218.46,75.54 226.8,85.54ZM282.39,132.41C277.82,124.48 273.09,116.85 268.21,109.53C281.02,111.73 293.66,114.78 306.07,118.65C303.22,131.33 299.56,143.82 295.1,156.03C291.18,148.13 286.96,140.23 282.4,132.42M89.64,92.72C86.07,57.91 93.37,32.57 109.51,23.23C114.69,20.38 120.53,18.94 126.44,19.08C142.68,19.08 163.38,27.95 185.44,45.02C171.38,58.24 158.49,72.65 146.89,88.08C127.78,90.42 108.9,94.37 90.45,99.89C90.12,97.48 89.83,95.09 89.6,92.72M69.21,128.11C71.38,127.17 73.6,126.23 75.86,125.29C80.3,144.03 86.31,162.37 93.85,180.1C86.3,197.86 80.28,216.23 75.84,235.01C39.89,220.25 19.05,199.8 19.05,180.1C19.05,161.42 37.39,142.48 69.21,128.11ZM109.51,336.96C93.37,327.62 86.07,302.28 89.64,267.47C89.87,265.1 90.17,262.71 90.49,260.28C108.93,265.84 127.81,269.81 146.93,272.14C158.52,287.56 171.41,301.97 185.45,315.2C154.71,338.98 126.61,346.82 109.55,336.96M310.37,267.47C313.9,302.29 306.65,327.62 290.49,336.96C273.44,346.84 245.34,338.98 214.6,315.2C228.64,301.97 241.52,287.56 253.11,272.14C272.23,269.81 291.11,265.84 309.55,260.28C309.89,262.71 310.17,265.1 310.41,267.47M324.21,234.99C319.77,216.21 313.74,197.85 306.19,180.1C313.74,162.33 319.76,143.96 324.2,125.18C360.08,139.94 380.98,160.39 380.98,180.1C380.98,199.8 360.14,220.25 324.19,235.01"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
android:strokeColor="#00000000"
/>
</group>
</vector>
@@ -2,11 +2,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".RNTesterApp">
tools:context=".RNTesterApp"
>
<com.facebook.react.ReactRootView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/react_root_view"/>
android:id="@+id/react_root_view"
/>
</RelativeLayout>