react-native 0.87.0-rc.0 → 0.87.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/Libraries/Core/InitializeCore.js +9 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/ReactNative/AppRegistry.flow.js +1 -0
  4. package/Libraries/ReactNative/AppRegistryImpl.js +2 -3
  5. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +5 -116
  6. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +5 -31
  7. package/React/Base/RCTVersion.m +1 -1
  8. package/React/I18n/RCTLocalizedString.mm +38 -2
  9. package/React-Core-prebuilt.podspec +45 -17
  10. package/React-Core.podspec +9 -2
  11. package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
  12. package/ReactAndroid/gradle.properties +1 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +8 -2
  14. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  15. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  16. package/index.js +15 -3
  17. package/index.js.flow +0 -2
  18. package/package.json +27 -29
  19. package/react-native.config.js +81 -0
  20. package/scripts/cocoapods/fabric.rb +1 -1
  21. package/scripts/cocoapods/rncore.rb +35 -78
  22. package/scripts/cocoapods/rncore_facades.rb +232 -0
  23. package/scripts/cocoapods/rndependencies.rb +64 -3
  24. package/scripts/cocoapods/rndeps_facades.rb +193 -0
  25. package/scripts/cocoapods/spm.rb +78 -11
  26. package/scripts/codegen/templates/Package.swift.spm-template +97 -0
  27. package/scripts/react-native-xcode.sh +20 -0
  28. package/scripts/react_native_pods.rb +65 -16
  29. package/scripts/replace-rncore-version.js +53 -6
  30. package/scripts/setup-apple-spm.js +1165 -0
  31. package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
  32. package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
  33. package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
  34. package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
  35. package/scripts/spm/__doc__/spm-scripts.md +451 -0
  36. package/scripts/spm/autolinking-plugins.js +331 -0
  37. package/scripts/spm/download-spm-artifacts.js +1409 -0
  38. package/scripts/spm/expand-spm-dependencies.js +216 -0
  39. package/scripts/spm/flavored-frameworks.js +1008 -0
  40. package/scripts/spm/generate-spm-autolinking-config.js +161 -0
  41. package/scripts/spm/generate-spm-autolinking.js +1888 -0
  42. package/scripts/spm/generate-spm-package.js +302 -0
  43. package/scripts/spm/generate-spm-xcodeproj.js +2224 -0
  44. package/scripts/spm/read-podspec.js +695 -0
  45. package/scripts/spm/scaffold-package-swift.js +1206 -0
  46. package/scripts/spm/spm-pbxproj.js +654 -0
  47. package/scripts/spm/spm-types.js +517 -0
  48. package/scripts/spm/spm-utils.js +645 -0
  49. package/scripts/spm/sync-spm-autolinking.js +160 -0
  50. package/sdks/.hermesv1version +1 -0
  51. package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
  52. package/sdks/hermes-engine/version.properties +1 -1
  53. package/src/asset-registry.js +1 -1
  54. package/src/react-private-interface.js +145 -0
  55. package/src/react-private-interface.js.flow +48 -0
  56. package/src/setup-env.js +22 -0
  57. package/src/unstable-internals-do-not-use.d.ts +214 -0
  58. package/src/unstable-internals-do-not-use.js +76 -0
  59. package/third-party-podspecs/ReactNativeDependencies.podspec +2 -2
  60. package/types_generated/Libraries/ReactNative/AppRegistry.flow.d.ts +2 -2
  61. package/types_generated/Libraries/ReactPrivate/ReactNativePrivateInterface.d.ts +6 -21
  62. package/types_generated/index.d.ts +1 -2
  63. package/types_generated/src/private/renderer/events/dispatchNativeEvent.d.ts +26 -0
  64. package/types_generated/src/react-private-interface.d.ts +33 -0
  65. package/Libraries/Utilities/SceneTracker.js +0 -42
  66. package/jest-preset.js +0 -26
  67. package/rn-get-polyfills.js +0 -13
  68. package/types/tsconfig.json +0 -17
  69. package/types_generated/Libraries/Components/Touchable/Touchable.d.ts +0 -261
  70. package/types_generated/tsconfig.test.json +0 -17
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @noflow
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+ 'use client';
13
+
14
+ // ----------------------------------------------------------------------------
15
+ // react-native/unstable-internals-do-not-use
16
+ //
17
+ // UNSTABLE WITH NO SEMVER GUARANTEES.
18
+ // SHOULD NOT BE DEPENDED ON BY NEW CODE.
19
+ //
20
+ // This is a secondary entry point for frameworks and libraries that depend on
21
+ // specific React Native internals, serving as a compatibility bridge.
22
+ //
23
+ // Consuming codebases must opt in via tsconfig.json:
24
+ // "customConditions": ["react-native-unstable-internals"]
25
+ //
26
+ // Having this entry point:
27
+ // - Maintains a known list of which React Native internals are in use.
28
+ // - Enables us to relocate supporting files more freely.
29
+ // - Gives us time to decide on the future of these APIs (independent from
30
+ // removal of the Strict API opt out).
31
+ //
32
+ // The long term future of these exports is to formalize/delete them where
33
+ // appropriate, and collapse this entry point.
34
+ //
35
+ // Replaces RFC0985
36
+ // https://github.com/react-native-community/discussions-and-proposals/pull/985
37
+ // where we reviewed internal APIs used in the ecosystem.
38
+ //
39
+ // IMPORTANT: Keep this file in sync with unstable-internals-do-not-use.d.ts.
40
+ // ----------------------------------------------------------------------------
41
+
42
+ // eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
43
+ module.exports = {
44
+ get AppContainer() {
45
+ return require('../Libraries/ReactNative/AppContainer').default;
46
+ },
47
+ get AssetSourceResolver() {
48
+ return require('../Libraries/Image/AssetSourceResolver').default;
49
+ },
50
+ get customDirectEventTypes() {
51
+ return require('../Libraries/Renderer/shims/ReactNativeViewConfigRegistry')
52
+ .customDirectEventTypes;
53
+ },
54
+ get DevLoadingView() {
55
+ return require('../Libraries/Utilities/DevLoadingView').default;
56
+ },
57
+ get getDevServer() {
58
+ return require('../Libraries/Core/Devtools/getDevServer').default;
59
+ },
60
+ get HMRClient() {
61
+ return require('../Libraries/Utilities/HMRClient').default;
62
+ },
63
+ get NativeExceptionsManager() {
64
+ return require('../Libraries/Core/NativeExceptionsManager').default;
65
+ },
66
+ get NativeRedBox() {
67
+ return require('../Libraries/NativeModules/specs/NativeRedBox').default;
68
+ },
69
+ get NativeSourceCode() {
70
+ return require('../Libraries/NativeModules/specs/NativeSourceCode').default;
71
+ },
72
+ get PressabilityDebugView() {
73
+ return require('../Libraries/Pressability/PressabilityDebug')
74
+ .PressabilityDebugView;
75
+ },
76
+ };
@@ -53,13 +53,13 @@ Pod::Spec.new do |spec|
53
53
  # Check if XCFRAMEWORK_PATH is empty
54
54
  if [ -z "$XCFRAMEWORK_PATH" ]; then
55
55
  echo "ERROR: XCFRAMEWORK_PATH is empty."
56
- exit 0
56
+ exit 1
57
57
  fi
58
58
 
59
59
  # Check if HEADERS_PATH is empty
60
60
  if [ -z "$HEADERS_PATH" ]; then
61
61
  echo "ERROR: HEADERS_PATH is empty."
62
- exit 0
62
+ exit 1
63
63
  fi
64
64
 
65
65
  cp -R "$HEADERS_PATH/." Headers
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<ccf8d135ed3ff1cceb054f570091639a>>
7
+ * @generated SignedSource<<35a87be1231250402e878ae18738792b>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/Libraries/ReactNative/AppRegistry.flow.js
@@ -39,5 +39,5 @@ export type Registry = {
39
39
  sections: ReadonlyArray<string>;
40
40
  runnables: Runnables;
41
41
  };
42
- export type WrapperComponentProvider = (appParameters: Object) => React.ComponentType<any>;
42
+ export type WrapperComponentProvider = (appParameters: Object, appKey?: string) => React.ComponentType<any>;
43
43
  export type RootViewStyleProvider = (appParameters: Object) => ViewStyleProp;
@@ -4,29 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<01b91d7159f100a845fa121b57f3218d>>
7
+ * @generated SignedSource<<449bbe3a2d07ab8a97f94597606ba139>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow
11
11
  */
12
12
 
13
- import type { createPublicTextInstance as $$IMPORT_TYPEOF_1$$ } from "../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
14
- type createPublicTextInstanceT = typeof $$IMPORT_TYPEOF_1$$;
15
- export type { PublicRootInstance } from "../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
16
- export type PublicTextInstance = ReturnType<createPublicTextInstanceT>;
17
- export { default as BatchedBridge } from "../BatchedBridge/BatchedBridge";
18
- export { default as ExceptionsManager } from "../Core/ExceptionsManager";
19
- export { default as Platform } from "../Utilities/Platform";
20
- export { default as RCTEventEmitter } from "../EventEmitter/RCTEventEmitter";
21
- export * as ReactNativeViewConfigRegistry from "../Renderer/shims/ReactNativeViewConfigRegistry";
22
- export { default as TextInputState } from "../Components/TextInput/TextInputState";
23
- export { default as UIManager } from "../ReactNative/UIManager";
24
- export { default as deepDiffer } from "../Utilities/differ/deepDiffer";
25
- export { default as deepFreezeAndThrowOnMutationInDev } from "../Utilities/deepFreezeAndThrowOnMutationInDev";
26
- export { default as flattenStyle } from "../StyleSheet/flattenStyle";
27
- export { default as ReactFiberErrorDialog } from "../Core/ReactFiberErrorDialog";
28
- export { default as legacySendAccessibilityEvent } from "../Components/AccessibilityInfo/legacySendAccessibilityEvent";
29
- export { default as RawEventEmitter } from "../Core/RawEventEmitter";
30
- export { default as CustomEvent } from "../../src/private/webapis/dom/events/CustomEvent";
31
- export { create as createAttributePayload, diff as diffAttributePayloads } from "../ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload";
32
- export { createPublicRootInstance, createPublicInstance, createPublicTextInstance, getNativeTagFromPublicInstance, getNodeFromPublicInstance, getInternalInstanceHandleFromPublicInstance } from "../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
13
+ /**
14
+ * @deprecated Since 0.88. Use 'react-native/react-private-interface' instead.
15
+ */
16
+ export type * from "../../src/react-private-interface";
17
+ export * from "../../src/react-private-interface";
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<19fa05080365a8e46925f6d0ab8127a8>>
7
+ * @generated SignedSource<<e97e3c47b4192fcbc62a9957d6f5f6e8>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/index.js.flow
@@ -59,7 +59,6 @@ export { NativeText as unstable_NativeText } from "./Libraries/Text/TextNativeCo
59
59
  export { default as unstable_TextAncestorContext } from "./Libraries/Text/TextAncestorContext";
60
60
  export type { AutoCapitalize, EnterKeyHintTypeOptions, KeyboardTypeOptions, InputModeOptions, TextContentType, TextInputAndroidProps, TextInputInstance, TextInputIOSProps, TextInputProps, TextInputBlurEvent, TextInputChangeEvent, TextInputContentSizeChangeEvent, TextInputEndEditingEvent, TextInputFocusEvent, TextInputKeyPressEvent, TextInputSelectionChangeEvent, TextInputSubmitEditingEvent, ReturnKeyTypeOptions, SubmitBehavior } from "./Libraries/Components/TextInput/TextInput";
61
61
  export { default as TextInput } from "./Libraries/Components/TextInput/TextInput";
62
- export { default as Touchable } from "./Libraries/Components/Touchable/Touchable";
63
62
  export type { TouchableHighlightInstance, TouchableHighlightProps } from "./Libraries/Components/Touchable/TouchableHighlight";
64
63
  export { default as TouchableHighlight } from "./Libraries/Components/Touchable/TouchableHighlight";
65
64
  export type { TouchableNativeFeedbackInstance, TouchableNativeFeedbackProps } from "./Libraries/Components/Touchable/TouchableNativeFeedback";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @generated SignedSource<<1028d478babdabc71e24ec4ba8a83745>>
8
+ *
9
+ * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
+ * Original file: packages/react-native/src/private/renderer/events/dispatchNativeEvent.js
11
+ */
12
+
13
+ import type EventTarget from "../../webapis/dom/events/EventTarget";
14
+ /**
15
+ * Dispatches a native event through the EventTarget-based dispatch system.
16
+ * This handles:
17
+ * 1. Responder negotiation (touch handling, grant/release lifecycle)
18
+ * 2. Normal event dispatch via dispatchTrustedEvent (capture/bubble phases)
19
+ *
20
+ * Called from the React renderer's dispatchEvent when
21
+ * enableNativeEventTargetEventDispatching is enabled.
22
+ */
23
+ declare function dispatchNativeEvent(target: EventTarget, type: string, payload: {
24
+ [$$Key$$: string]: unknown;
25
+ }): void;
26
+ export default dispatchNativeEvent;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @generated SignedSource<<43644da4b4f4c04a0f152e538ac03b9e>>
8
+ *
9
+ * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
+ * Original file: packages/react-native/src/react-private-interface.js.flow
11
+ */
12
+
13
+ import type { createPublicTextInstance as $$IMPORT_TYPEOF_1$$ } from "../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
14
+ type createPublicTextInstanceT = typeof $$IMPORT_TYPEOF_1$$;
15
+ export type { PublicRootInstance } from "../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
16
+ export type PublicTextInstance = ReturnType<createPublicTextInstanceT>;
17
+ export { default as BatchedBridge } from "../Libraries/BatchedBridge/BatchedBridge";
18
+ export { default as ExceptionsManager } from "../Libraries/Core/ExceptionsManager";
19
+ export { default as Platform } from "../Libraries/Utilities/Platform";
20
+ export { default as RCTEventEmitter } from "../Libraries/EventEmitter/RCTEventEmitter";
21
+ export * as ReactNativeViewConfigRegistry from "../Libraries/Renderer/shims/ReactNativeViewConfigRegistry";
22
+ export { default as TextInputState } from "../Libraries/Components/TextInput/TextInputState";
23
+ export { default as UIManager } from "../Libraries/ReactNative/UIManager";
24
+ export { default as deepDiffer } from "../Libraries/Utilities/differ/deepDiffer";
25
+ export { default as deepFreezeAndThrowOnMutationInDev } from "../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev";
26
+ export { default as flattenStyle } from "../Libraries/StyleSheet/flattenStyle";
27
+ export { default as ReactFiberErrorDialog } from "../Libraries/Core/ReactFiberErrorDialog";
28
+ export { default as legacySendAccessibilityEvent } from "../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent";
29
+ export { default as RawEventEmitter } from "../Libraries/Core/RawEventEmitter";
30
+ export { default as CustomEvent } from "./private/webapis/dom/events/CustomEvent";
31
+ export { create as createAttributePayload, diff as diffAttributePayloads } from "../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload";
32
+ export { createPublicRootInstance, createPublicInstance, createPublicTextInstance, getNativeTagFromPublicInstance, getNodeFromPublicInstance, getInternalInstanceHandleFromPublicInstance } from "../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance";
33
+ export { default as dispatchNativeEvent } from "./private/renderer/events/dispatchNativeEvent";
@@ -1,42 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- export type Scene = {name: string, [string]: unknown, ...};
14
-
15
- let _listeners: Array<(scene: Scene) => void> = [];
16
-
17
- let _activeScene: Scene = {name: 'default'};
18
-
19
- const SceneTracker = {
20
- setActiveScene(scene: Scene) {
21
- _activeScene = scene;
22
- _listeners.forEach(listener => listener(_activeScene));
23
- },
24
-
25
- getActiveScene(): Scene {
26
- return _activeScene;
27
- },
28
-
29
- addActiveSceneChangedListener(callback: (scene: Scene) => void): {
30
- remove: () => void,
31
- ...
32
- } {
33
- _listeners.push(callback);
34
- return {
35
- remove: () => {
36
- _listeners = _listeners.filter(listener => callback !== listener);
37
- },
38
- };
39
- },
40
- };
41
-
42
- export default SceneTracker;
package/jest-preset.js DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @noflow
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- try {
14
- module.exports = require('@react-native/jest-preset');
15
- } catch (error) {
16
- if (error.code === 'MODULE_NOT_FOUND') {
17
- throw new Error(
18
- `The React Native Jest preset has moved to a separate package.
19
- To migrate, please install "@react-native/jest-preset" and update your
20
- jest.config.js to reference:
21
- preset: '@react-native/jest-preset'`,
22
- );
23
- } else {
24
- throw error;
25
- }
26
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- module.exports = require('@react-native/js-polyfills');
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "lib": ["es6"],
5
- "strict": false,
6
- "noImplicitAny": true,
7
- "noImplicitThis": true,
8
- "strictFunctionTypes": true,
9
- "strictNullChecks": true,
10
- "types": [],
11
- "jsx": "react",
12
- "noEmit": true,
13
- "forceConsistentCasingInFileNames": true,
14
- "paths": {"react-native": ["."]}
15
- },
16
- "include": ["**/*.d.ts", "../__typetests__/**/*"]
17
- }
@@ -1,261 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @generated SignedSource<<81be4da4cec114a71bce2b6e263588a1>>
8
- *
9
- * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
- * Original file: packages/react-native/Libraries/Components/Touchable/Touchable.js
11
- */
12
-
13
- import type { EdgeInsetsProp } from "../../StyleSheet/EdgeInsetsPropType";
14
- import type { ColorValue } from "../../StyleSheet/StyleSheet";
15
- import type { BlurEvent, FocusEvent, GestureResponderEvent } from "../../Types/CoreEventTypes";
16
- import * as React from "react";
17
- /**
18
- * Touchable states.
19
- */
20
-
21
- declare const States: {
22
- NOT_RESPONDER: "NOT_RESPONDER";
23
- RESPONDER_INACTIVE_PRESS_IN: "RESPONDER_INACTIVE_PRESS_IN";
24
- RESPONDER_INACTIVE_PRESS_OUT: "RESPONDER_INACTIVE_PRESS_OUT";
25
- RESPONDER_ACTIVE_PRESS_IN: "RESPONDER_ACTIVE_PRESS_IN";
26
- RESPONDER_ACTIVE_PRESS_OUT: "RESPONDER_ACTIVE_PRESS_OUT";
27
- RESPONDER_ACTIVE_LONG_PRESS_IN: "RESPONDER_ACTIVE_LONG_PRESS_IN";
28
- RESPONDER_ACTIVE_LONG_PRESS_OUT: "RESPONDER_ACTIVE_LONG_PRESS_OUT";
29
- ERROR: "ERROR";
30
- };
31
- type TouchableState = typeof States.NOT_RESPONDER | typeof States.RESPONDER_INACTIVE_PRESS_IN | typeof States.RESPONDER_INACTIVE_PRESS_OUT | typeof States.RESPONDER_ACTIVE_PRESS_IN | typeof States.RESPONDER_ACTIVE_PRESS_OUT | typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN | typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT | typeof States.ERROR;
32
- /**
33
- * By convention, methods prefixed with underscores are meant to be @private,
34
- * and not @protected. Mixers shouldn't access them - not even to provide them
35
- * as callback handlers.
36
- *
37
- *
38
- * ========== Geometry =========
39
- * `Touchable` only assumes that there exists a `HitRect` node. The `PressRect`
40
- * is an abstract box that is extended beyond the `HitRect`.
41
- *
42
- * +--------------------------+
43
- * | | - "Start" events in `HitRect` cause `HitRect`
44
- * | +--------------------+ | to become the responder.
45
- * | | +--------------+ | | - `HitRect` is typically expanded around
46
- * | | | | | | the `VisualRect`, but shifted downward.
47
- * | | | VisualRect | | | - After pressing down, after some delay,
48
- * | | | | | | and before letting up, the Visual React
49
- * | | +--------------+ | | will become "active". This makes it eligible
50
- * | | HitRect | | for being highlighted (so long as the
51
- * | +--------------------+ | press remains in the `PressRect`).
52
- * | PressRect o |
53
- * +----------------------|---+
54
- * Out Region |
55
- * +-----+ This gap between the `HitRect` and
56
- * `PressRect` allows a touch to move far away
57
- * from the original hit rect, and remain
58
- * highlighted, and eligible for a "Press".
59
- * Customize this via
60
- * `touchableGetPressRectOffset()`.
61
- *
62
- *
63
- *
64
- * ======= State Machine =======
65
- *
66
- * +-------------+ <---+ RESPONDER_RELEASE
67
- * |NOT_RESPONDER|
68
- * +-------------+ <---+ RESPONDER_TERMINATED
69
- * +
70
- * | RESPONDER_GRANT (HitRect)
71
- * v
72
- * +---------------------------+ DELAY +-------------------------+ T + DELAY +------------------------------+
73
- * |RESPONDER_INACTIVE_PRESS_IN|+-------->|RESPONDER_ACTIVE_PRESS_IN| +------------> |RESPONDER_ACTIVE_LONG_PRESS_IN|
74
- * +---------------------------+ +-------------------------+ +------------------------------+
75
- * + ^ + ^ + ^
76
- * |LEAVE_ |ENTER_ |LEAVE_ |ENTER_ |LEAVE_ |ENTER_
77
- * |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT
78
- * | | | | | |
79
- * v + v + v +
80
- * +----------------------------+ DELAY +--------------------------+ +-------------------------------+
81
- * |RESPONDER_INACTIVE_PRESS_OUT|+------->|RESPONDER_ACTIVE_PRESS_OUT| |RESPONDER_ACTIVE_LONG_PRESS_OUT|
82
- * +----------------------------+ +--------------------------+ +-------------------------------+
83
- *
84
- * T + DELAY => LONG_PRESS_DELAY_MS + DELAY
85
- *
86
- * Not drawn are the side effects of each transition. The most important side
87
- * effect is the `touchableHandlePress` abstract method invocation that occurs
88
- * when a responder is released while in either of the "Press" states.
89
- *
90
- * The other important side effects are the highlight abstract method
91
- * invocations (internal callbacks) to be implemented by the mixer.
92
- *
93
- *
94
- * @lends Touchable.prototype
95
- */
96
- declare const TouchableMixinImpl: {
97
- componentDidMount: () => void;
98
- /**
99
- * Clear all timeouts on unmount
100
- */
101
- componentWillUnmount: () => void;
102
- /**
103
- * It's prefer that mixins determine state in this way, having the class
104
- * explicitly mix the state in the one and only `getInitialState` method.
105
- *
106
- * @return {object} State object to be placed inside of
107
- * `this.state.touchable`.
108
- */
109
- touchableGetInitialState: () => {
110
- touchable: {
111
- touchState: TouchableState | undefined;
112
- responderID: GestureResponderEvent["currentTarget"] | undefined;
113
- };
114
- };
115
- /**
116
- * Must return true if embedded in a native platform scroll view.
117
- */
118
- touchableHandleResponderTerminationRequest: () => any;
119
- /**
120
- * Must return true to start the process of `Touchable`.
121
- */
122
- touchableHandleStartShouldSetResponder: () => any;
123
- /**
124
- * Return true to cancel press on long press.
125
- */
126
- touchableLongPressCancelsPress: () => boolean;
127
- /**
128
- * Place as callback for a DOM element's `onResponderGrant` event.
129
- * @param {NativeSyntheticEvent} e Synthetic event from event system.
130
- *
131
- */
132
- touchableHandleResponderGrant: (e: GestureResponderEvent) => void;
133
- /**
134
- * Place as callback for a DOM element's `onResponderRelease` event.
135
- */
136
- touchableHandleResponderRelease: (e: GestureResponderEvent) => void;
137
- /**
138
- * Place as callback for a DOM element's `onResponderTerminate` event.
139
- */
140
- touchableHandleResponderTerminate: (e: GestureResponderEvent) => void;
141
- /**
142
- * Place as callback for a DOM element's `onResponderMove` event.
143
- */
144
- touchableHandleResponderMove: (e: GestureResponderEvent) => void;
145
- /**
146
- * Invoked when the item receives focus. Mixers might override this to
147
- * visually distinguish the `VisualRect` so that the user knows that it
148
- * currently has the focus. Most platforms only support a single element being
149
- * focused at a time, in which case there may have been a previously focused
150
- * element that was blurred just prior to this. This can be overridden when
151
- * using `Touchable.Mixin.withoutDefaultFocusAndBlur`.
152
- */
153
- touchableHandleFocus: (e: FocusEvent) => void;
154
- /**
155
- * Invoked when the item loses focus. Mixers might override this to
156
- * visually distinguish the `VisualRect` so that the user knows that it
157
- * no longer has focus. Most platforms only support a single element being
158
- * focused at a time, in which case the focus may have moved to another.
159
- * This can be overridden when using
160
- * `Touchable.Mixin.withoutDefaultFocusAndBlur`.
161
- */
162
- touchableHandleBlur: (e: BlurEvent) => void;
163
- withoutDefaultFocusAndBlur: {};
164
- };
165
- declare const TouchableImpl: {
166
- Mixin: typeof TouchableMixinImpl;
167
- /**
168
- * Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
169
- */
170
- renderDebugView: ($$PARAM_0$$: {
171
- color: ColorValue;
172
- hitSlop?: EdgeInsetsProp;
173
- }) => null | React.ReactNode;
174
- };
175
- /**
176
- * `Touchable`: Taps done right.
177
- *
178
- * You hook your `ResponderEventPlugin` events into `Touchable`. `Touchable`
179
- * will measure time/geometry and tells you when to give feedback to the user.
180
- *
181
- * ====================== Touchable Tutorial ===============================
182
- * The `Touchable` mixin helps you handle the "press" interaction. It analyzes
183
- * the geometry of elements, and observes when another responder (scroll view
184
- * etc) has stolen the touch lock. It notifies your component when it should
185
- * give feedback to the user. (bouncing/highlighting/unhighlighting).
186
- *
187
- * - When a touch was activated (typically you highlight)
188
- * - When a touch was deactivated (typically you unhighlight)
189
- * - When a touch was "pressed" - a touch ended while still within the geometry
190
- * of the element, and no other element (like scroller) has "stolen" touch
191
- * lock ("responder") (Typically you bounce the element).
192
- *
193
- * A good tap interaction isn't as simple as you might think. There should be a
194
- * slight delay before showing a highlight when starting a touch. If a
195
- * subsequent touch move exceeds the boundary of the element, it should
196
- * unhighlight, but if that same touch is brought back within the boundary, it
197
- * should rehighlight again. A touch can move in and out of that boundary
198
- * several times, each time toggling highlighting, but a "press" is only
199
- * triggered if that touch ends while within the element's boundary and no
200
- * scroller (or anything else) has stolen the lock on touches.
201
- *
202
- * To create a new type of component that handles interaction using the
203
- * `Touchable` mixin, do the following:
204
- *
205
- * - Initialize the `Touchable` state.
206
- *
207
- * getInitialState: function() {
208
- * return merge(this.touchableGetInitialState(), yourComponentState);
209
- * }
210
- *
211
- * - Choose the rendered component who's touches should start the interactive
212
- * sequence. On that rendered node, forward all `Touchable` responder
213
- * handlers. You can choose any rendered node you like. Choose a node whose
214
- * hit target you'd like to instigate the interaction sequence:
215
- *
216
- * // In render function:
217
- * return (
218
- * <View
219
- * onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}
220
- * onResponderTerminationRequest={this.touchableHandleResponderTerminationRequest}
221
- * onResponderGrant={this.touchableHandleResponderGrant}
222
- * onResponderMove={this.touchableHandleResponderMove}
223
- * onResponderRelease={this.touchableHandleResponderRelease}
224
- * onResponderTerminate={this.touchableHandleResponderTerminate}>
225
- * <View>
226
- * Even though the hit detection/interactions are triggered by the
227
- * wrapping (typically larger) node, we usually end up implementing
228
- * custom logic that highlights this inner one.
229
- * </View>
230
- * </View>
231
- * );
232
- *
233
- * - You may set up your own handlers for each of these events, so long as you
234
- * also invoke the `touchable*` handlers inside of your custom handler.
235
- *
236
- * - Implement the handlers on your component class in order to provide
237
- * feedback to the user. See documentation for each of these class methods
238
- * that you should implement.
239
- *
240
- * touchableHandlePress: function() {
241
- * this.performBounceAnimation(); // or whatever you want to do.
242
- * },
243
- * touchableHandleActivePressIn: function() {
244
- * this.beginHighlighting(...); // Whatever you like to convey activation
245
- * },
246
- * touchableHandleActivePressOut: function() {
247
- * this.endHighlighting(...); // Whatever you like to convey deactivation
248
- * },
249
- *
250
- * - There are more advanced methods you can implement (see documentation below):
251
- * touchableGetHighlightDelayMS: function() {
252
- * return 20;
253
- * }
254
- * // In practice, *always* use a predeclared constant (conserve memory).
255
- * touchableGetPressRectOffset: function() {
256
- * return {top: 20, left: 20, right: 20, bottom: 100};
257
- * }
258
- */
259
- declare const $$Touchable: typeof TouchableImpl;
260
- declare type $$Touchable = typeof $$Touchable;
261
- export default $$Touchable;
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "esnext",
4
- "lib": ["es2020"],
5
- "strict": false,
6
- "noImplicitAny": true,
7
- "noImplicitThis": true,
8
- "types": [],
9
- "jsx": "react",
10
- "noEmit": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "paths": {"react-native": ["."]},
13
- "moduleResolution": "bundler",
14
- "customConditions": ["react-native-strict-api"]
15
- },
16
- "include": ["**/*.d.ts", "../__typetests__/**/*"]
17
- }