From 9de5655c84e36d7378c9c85e128daa524f7967ff Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Thu, 12 Nov 2026 10:17:23 +0000 Subject: [PATCH 1/3] Deprecate Button # Conflicts: # packages/react-native/index.js --- .../Libraries/Components/Button.js | 20 +++++++++++++++---- packages/react-native/index.js | 11 ++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index f61d1bb01ffd..be93e97df6c1 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -156,22 +156,30 @@ type ButtonPropsCore = Readonly<{ accessibilityLanguage?: ?Stringish, }>; -/** @build-types emit-as-interface Uniwind compatibility */ +/** + * Button is deprecated and will be removed in a future release. + * Build your own button with `Pressable` instead. + * @see https://reactnative.dev/docs/button + * @deprecated + * @build-types emit-as-interface Uniwind compatibility + */ export type ButtonProps = ButtonPropsCore; const NativeTouchable: typeof TouchableNativeFeedback | typeof TouchableOpacity = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity; +/** + * Button is deprecated and will be removed in a future release. + * Build your own button with `Pressable` instead. + * @deprecated + */ export type ButtonInstance = React.ElementRef; /** * A basic button component that should render nicely on any platform. Supports a * minimal level of customization. * - * If this button doesn't look right for your app, you can build your own button - * using `Pressable`. - * * Example: * * ```tsx @@ -183,7 +191,11 @@ export type ButtonInstance = React.ElementRef; * /> * ``` * + * Button is deprecated and will be removed in a future release. + * Build your own button with `Pressable` instead. + * * @see https://reactnative.dev/docs/button + * @deprecated */ const Button: component( ref?: React.RefSetter, diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 73f16e7dd219..e44518f5007e 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -34,8 +34,19 @@ module.exports = { return require('./Libraries/Components/ActivityIndicator/ActivityIndicator') .default; }, + /** + * @deprecated Button is deprecated and will be removed in a future release. + * Build your own button with Pressable instead. + * See https://reactnative.dev/docs/button + */ // $FlowFixMe[unsafe-getters-setters] get Button() { + warnOnce( + 'button-deprecated', + 'Button is deprecated and will be removed in a future release. ' + + 'Build your own button with Pressable instead. ' + + 'See https://reactnative.dev/docs/button', + ); return require('./Libraries/Components/Button').default; }, /** From 942fd13effe7d7f4818a459ef9b67274dc5cb790 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Thu, 12 Nov 2026 10:29:29 +0000 Subject: [PATCH 2/3] Update URL --- packages/react-native/Libraries/Components/Button.js | 4 ++-- packages/react-native/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index be93e97df6c1..12c1b532aece 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -159,7 +159,7 @@ type ButtonPropsCore = Readonly<{ /** * Button is deprecated and will be removed in a future release. * Build your own button with `Pressable` instead. - * @see https://reactnative.dev/docs/button + * @see https://reactnative.dev/docs/pressable * @deprecated * @build-types emit-as-interface Uniwind compatibility */ @@ -194,7 +194,7 @@ export type ButtonInstance = React.ElementRef; * Button is deprecated and will be removed in a future release. * Build your own button with `Pressable` instead. * - * @see https://reactnative.dev/docs/button + * @see https://reactnative.dev/docs/pressable * @deprecated */ const Button: component( diff --git a/packages/react-native/index.js b/packages/react-native/index.js index e44518f5007e..065f9c839a74 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -37,7 +37,7 @@ module.exports = { /** * @deprecated Button is deprecated and will be removed in a future release. * Build your own button with Pressable instead. - * See https://reactnative.dev/docs/button + * See https://reactnative.dev/docs/pressable */ // $FlowFixMe[unsafe-getters-setters] get Button() { @@ -45,7 +45,7 @@ module.exports = { 'button-deprecated', 'Button is deprecated and will be removed in a future release. ' + 'Build your own button with Pressable instead. ' + - 'See https://reactnative.dev/docs/button', + 'See https://reactnative.dev/docs/pressable', ); return require('./Libraries/Components/Button').default; }, From a580709974f71218572cb80179d589623dee360a Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Thu, 12 Nov 2026 13:03:03 +0000 Subject: [PATCH 3/3] Switch to RNTesterButton --- .../SafeAreaInsets/SafeAreaInsetsExample.js | 62 ++++++++++--------- .../__tests__/SafeAreaInsetsExample-test.js | 4 +- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js b/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js index ed8dfab585a4..b6c8fcbe42a2 100644 --- a/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js +++ b/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js @@ -13,11 +13,11 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {SafeAreaInsetsChangeEvent} from 'react-native'; +import RNTesterButton from '../../components/RNTesterButton'; import RNTesterText from '../../components/RNTesterText'; import * as React from 'react'; import {useCallback, useState} from 'react'; import { - Button, Modal, Platform, ScrollView, @@ -105,13 +105,15 @@ function FullScreenModalContent({onClose}: {onClose: () => void}): React.Node { the same frame, without the content jumping. {!applied ? ( -