diff --git a/packages/eslint-plugin-react-native/utils.js b/packages/eslint-plugin-react-native/utils.js index 12f0f3c2c417..32c181b951ea 100644 --- a/packages/eslint-plugin-react-native/utils.js +++ b/packages/eslint-plugin-react-native/utils.js @@ -86,10 +86,6 @@ const publicAPIMapping = { default: 'Button', types: ['ButtonInstance', 'ButtonProps'], }, - 'Libraries/Components/Clipboard/Clipboard': { - default: 'Clipboard', - types: null, - }, 'Libraries/Components/DrawerAndroid/DrawerLayoutAndroid': { default: 'DrawerLayoutAndroid', types: null, diff --git a/packages/react-native-babel-preset/src/configs/lazy-imports.js b/packages/react-native-babel-preset/src/configs/lazy-imports.js index 95cb75e262c2..8623ef344d6b 100644 --- a/packages/react-native-babel-preset/src/configs/lazy-imports.js +++ b/packages/react-native-babel-preset/src/configs/lazy-imports.js @@ -56,7 +56,6 @@ module.exports = new Set([ 'AppState', 'AsyncStorage', 'BackHandler', - 'Clipboard', 'DeviceInfo', 'Dimensions', 'Easing', diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index cb67856cb4b3..c1a909d89508 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<2ceaa8e472a53fc667994edb63ccd995>> + * @generated SignedSource<<0df40052762a394474666f7090b89f69>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -163,10 +163,6 @@ declare const Button_default: ( ref?: React.Ref }, ) => React.ReactNode -declare const Clipboard: { - getString(): Promise - setString(content: string): void -} declare const codegenNativeCommands: typeof codegenNativeCommands_default declare const codegenNativeComponent: typeof codegenNativeComponent_default declare const compose: typeof composeStyles_default @@ -1717,7 +1713,6 @@ declare class CellRenderMask { equals(other: CellRenderMask): boolean numCells(): number } -declare type Clipboard = typeof Clipboard declare type codegenNativeCommands = typeof codegenNativeCommands declare function codegenNativeCommands_default( options: NativeCommandsOptions, @@ -5796,7 +5791,6 @@ export { Button, // 35d2ff2d ButtonInstance, // 8d4861a8 ButtonProps, // 5f462ce0 - Clipboard, // 41addb89 CodegenTypes, // 9067fd06 ColorSchemeName, // 6615edd6 ColorValue, // 98989a8f diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 79b601abb36d..e0b1d072cdec 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -236,15 +236,6 @@ module.exports = { get BackHandler() { return require('./Libraries/Utilities/BackHandler').default; }, - get Clipboard() { - warnOnce( - 'clipboard-moved', - 'Clipboard has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-clipboard/clipboard' instead of 'react-native'. " + - 'See https://github.com/react-native-clipboard/clipboard', - ); - return require('./Libraries/Components/Clipboard/Clipboard').default; - }, get codegenNativeCommands() { return require('./Libraries/Utilities/codegenNativeCommands').default; }, @@ -443,4 +434,20 @@ if (__DEV__) { ); }, }); + + /* $FlowFixMe[prop-missing] This is intentional: Flow will error when + * attempting to access Clipboard. */ + /* $FlowFixMe[invalid-export] This is intentional: Flow will error when + * attempting to access Clipboard. */ + Object.defineProperty(module.exports, 'Clipboard', { + configurable: true, + get() { + invariant( + false, + 'Clipboard has been removed from react-native core. ' + + "It can now be installed and imported from '@react-native-clipboard/clipboard' instead of 'react-native'. " + + 'See https://github.com/react-native-clipboard/clipboard', + ); + }, + }); } diff --git a/packages/react-native/index.js.flow b/packages/react-native/index.js.flow index 3d015144404b..387f3ce27003 100644 --- a/packages/react-native/index.js.flow +++ b/packages/react-native/index.js.flow @@ -291,8 +291,6 @@ export type { export type {BackPressEventName} from './Libraries/Utilities/BackHandler'; export {default as BackHandler} from './Libraries/Utilities/BackHandler'; -export {default as Clipboard} from './Libraries/Components/Clipboard/Clipboard'; - export {default as codegenNativeComponent} from './Libraries/Utilities/codegenNativeComponent'; export {default as codegenNativeCommands} from './Libraries/Utilities/codegenNativeCommands'; diff --git a/packages/react-native/types_DEPRECATED/Libraries/Components/Clipboard/Clipboard.d.ts b/packages/react-native/types_DEPRECATED/Libraries/Components/Clipboard/Clipboard.d.ts deleted file mode 100644 index 8bc5cb7623cf..000000000000 --- a/packages/react-native/types_DEPRECATED/Libraries/Components/Clipboard/Clipboard.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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. - * - * @format - */ - -export interface ClipboardStatic { - getString(): Promise; - setString(content: string): void; -} - -/** - * Clipboard has been extracted from react-native core and will be removed in a future release. - * It can now be installed and imported from `@react-native-clipboard/clipboard` instead of 'react-native'. - * @see https://github.com/react-native-clipboard/clipboard - * @deprecated - */ -export const Clipboard: ClipboardStatic; -/** - * Clipboard has been extracted from react-native core and will be removed in a future release. - * It can now be installed and imported from `@react-native-clipboard/clipboard` instead of 'react-native'. - * @see https://github.com/react-native-clipboard/clipboard - * @deprecated - */ -export type Clipboard = ClipboardStatic; diff --git a/packages/react-native/types_DEPRECATED/index.d.ts b/packages/react-native/types_DEPRECATED/index.d.ts index b5541260cb62..91dc6296c397 100644 --- a/packages/react-native/types_DEPRECATED/index.d.ts +++ b/packages/react-native/types_DEPRECATED/index.d.ts @@ -81,7 +81,6 @@ export * from './Libraries/AppState/AppState'; export * from './Libraries/BatchedBridge/NativeModules'; export * from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; export * from './Libraries/Components/ActivityIndicator/ActivityIndicator'; -export * from './Libraries/Components/Clipboard/Clipboard'; export * from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; export * from './Libraries/Components/Keyboard/Keyboard'; export * from './Libraries/Components/Keyboard/KeyboardAvoidingView';