Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.bridge

import com.facebook.common.logging.FLog
import com.facebook.react.common.ReactConstants

/** Implementation of Dynamic wrapping a ReadableArray. */
public class DynamicFromObject(private val value: Any?) : Dynamic {
override fun recycle() {
// Noop - nothing to recycle since there is no pooling
}

override val isNull: Boolean
get() = value == null

override fun asBoolean(): Boolean {
if (value is Boolean) {
return value
}
throw ClassCastException("Dynamic value from Object is not a boolean")
}

override fun asDouble(): Double {
if (value is Number) {
return value as Double
}
throw ClassCastException("Dynamic value from Object is not a number")
}

override fun asInt(): Int {
if (value is Number) {
// Numbers from JS are always Doubles
return (value as Double).toInt()
}
throw ClassCastException("Dynamic value from Object is not a number")
}

override fun asString(): String {
if (value is String) {
return value
}
throw ClassCastException("Dynamic value from Object is not a string")
}

override fun asArray(): ReadableArray {
if (value is ReadableArray) {
return value
}
throw ClassCastException("Dynamic value from Object is not a ReadableArray")
}

override fun asMap(): ReadableMap {
if (value is ReadableMap) {
return value
}
throw ClassCastException("Dynamic value from Object is not a ReadableMap")
}

override val type: ReadableType
get() {
return when (value) {
null -> ReadableType.Null
is Boolean -> ReadableType.Boolean
is Number -> ReadableType.Number
is String -> ReadableType.String
is ReadableMap -> ReadableType.Map
is ReadableArray -> ReadableType.Array
else -> {
FLog.e(
ReactConstants.TAG,
"Unmapped object type " + (value.javaClass.name)
)
ReadableType.Null
}
}
}
}

Unchanged files with check annotations Beta

testHook2: function () {},
};
module.exports = MessageQueueTestModule;

Check warning on line 22 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js

GitHub Actions / test_js (20)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 22 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js

GitHub Actions / test_js (22)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 22 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js

GitHub Actions / test_js (18)

Use `export` syntax instead of CommonJS `module.exports`
remoteModuleConfig: remoteModulesConfig,
};
module.exports = MessageQueueTestConfig;

Check warning on line 38 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js

GitHub Actions / test_js (20)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 38 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js

GitHub Actions / test_js (22)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 38 in packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js

GitHub Actions / test_js (18)

Use `export` syntax instead of CommonJS `module.exports`
* transform which can receive values from multiple parents.
*/
export function flushValue(rootNode: AnimatedNode): void {
// eslint-disable-next-line func-call-spacing

Check warning on line 55 in packages/react-native/Libraries/Animated/nodes/AnimatedValue.js

GitHub Actions / test_js (20)

'func-call-spacing' rule is disabled but never reported

Check warning on line 55 in packages/react-native/Libraries/Animated/nodes/AnimatedValue.js

GitHub Actions / test_js (22)

'func-call-spacing' rule is disabled but never reported

Check warning on line 55 in packages/react-native/Libraries/Animated/nodes/AnimatedValue.js

GitHub Actions / test_js (18)

'func-call-spacing' rule is disabled but never reported
const leaves = new Set<{update: () => void, ...}>();
function findAnimatedStyles(node: AnimatedNode) {
// $FlowFixMe[prop-missing]
import type AnimatedValue from '../nodes/AnimatedValue';
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';

Check warning on line 16 in packages/react-native/Libraries/Animated/animations/Animation.js

GitHub Actions / test_js (20)

'ReactNativeFeatureFlags' is defined but never used

Check warning on line 16 in packages/react-native/Libraries/Animated/animations/Animation.js

GitHub Actions / test_js (22)

'ReactNativeFeatureFlags' is defined but never used

Check warning on line 16 in packages/react-native/Libraries/Animated/animations/Animation.js

GitHub Actions / test_js (18)

'ReactNativeFeatureFlags' is defined but never used
import AnimatedProps from '../nodes/AnimatedProps';
export type EndResult = {finished: boolean, value?: number, ...};
nativeTypeDiffingTypesAliases,
nativeTypeDiffingTypesMethodParamLookup,
nativeTypeDiffingTypesMethodLookup,
_,

Check warning on line 85 in packages/react-native-compatibility-check/src/__tests__/TypeDiffing-test.js

GitHub Actions / test_js (20)

'_' is assigned a value but never used

Check warning on line 85 in packages/react-native-compatibility-check/src/__tests__/TypeDiffing-test.js

GitHub Actions / test_js (22)

'_' is assigned a value but never used

Check warning on line 85 in packages/react-native-compatibility-check/src/__tests__/TypeDiffing-test.js

GitHub Actions / test_js (18)

'_' is assigned a value but never used
nativeTypeDiffingTypesEnums,
] = getModule(
'native-module-type-diffing-types',
'use client';
/* eslint-disable no-shadow, eqeqeq, curly, no-unused-vars, no-void, no-control-regex */

Check warning on line 14 in packages/polyfills/console.js

GitHub Actions / test_js (20)

'curly' rule is disabled but never reported

Check warning on line 14 in packages/polyfills/console.js

GitHub Actions / test_js (22)

'curly' rule is disabled but never reported

Check warning on line 14 in packages/polyfills/console.js

GitHub Actions / test_js (18)

'curly' rule is disabled but never reported
/**
* This pipes all of our console logging functions to native logging so that
const debug = require('debug')('Metro:InspectorProxy');
const PAGES_POLLING_INTERVAL = 1000;
const MIN_MESSAGE_QUEUE_BYTES_TO_REPORT = 2 * 1024 * 1024; // 2 MiB

Check warning on line 40 in packages/dev-middleware/src/inspector-proxy/Device.js

GitHub Actions / test_js (20)

'MIN_MESSAGE_QUEUE_BYTES_TO_REPORT' is assigned a value but never used

Check warning on line 40 in packages/dev-middleware/src/inspector-proxy/Device.js

GitHub Actions / test_js (22)

'MIN_MESSAGE_QUEUE_BYTES_TO_REPORT' is assigned a value but never used

Check warning on line 40 in packages/dev-middleware/src/inspector-proxy/Device.js

GitHub Actions / test_js (18)

'MIN_MESSAGE_QUEUE_BYTES_TO_REPORT' is assigned a value but never used
const WS_CLOSURE_CODE = {
NORMAL: 1000,
return assets[assetId - 1];
}
module.exports = {registerAsset, getAssetByID};

Check warning on line 43 in packages/assets/registry.js

GitHub Actions / test_js (20)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 43 in packages/assets/registry.js

GitHub Actions / test_js (22)

Use `export` syntax instead of CommonJS `module.exports`

Check warning on line 43 in packages/assets/registry.js

GitHub Actions / test_js (18)

Use `export` syntax instead of CommonJS `module.exports`
// Modifications are explained inline by comments beginning with `// MODIFIED`.
// MODIFIED: Added ESLint suppression comment - no-unused-vars doesn't understand declaration files
/* eslint-disable no-unused-vars */

Check warning on line 15 in flow-typed/npm/jest.js

GitHub Actions / test_js (20)

'no-unused-vars' rule is disabled but never reported

Check warning on line 15 in flow-typed/npm/jest.js

GitHub Actions / test_js (22)

'no-unused-vars' rule is disabled but never reported

Check warning on line 15 in flow-typed/npm/jest.js

GitHub Actions / test_js (18)

'no-unused-vars' rule is disabled but never reported
type JestMockFn<TArguments: $ReadOnlyArray<mixed>, TReturn> = {
(...args: TArguments): TReturn,
fromEnc: buffer$Encoding,
toEnc: buffer$Encoding,
): Node$Buffer;
declare var Buffer: Node$Buffer;

Check warning on line 200 in flow-typed/environment/node.js

GitHub Actions / test_js (20)

'Buffer' is already declared in the upper scope on line 53 column 15

Check warning on line 200 in flow-typed/environment/node.js

GitHub Actions / test_js (22)

'Buffer' is already declared in the upper scope on line 53 column 15

Check warning on line 200 in flow-typed/environment/node.js

GitHub Actions / test_js (18)

'Buffer' is already declared in the upper scope on line 53 column 15
}
type child_process$execOpts = {