diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 64dd7ced00a..ad34c96851d 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -27,7 +27,7 @@ import View from './View/View'; import invariant from 'invariant'; import * as React from 'react'; -type ButtonProps = $ReadOnly<{ +export type ButtonProps = $ReadOnly<{ /** Text to display inside the button. On Android the given title will be converted to the uppercased form. @@ -286,7 +286,7 @@ const Touchable: typeof TouchableNativeFeedback | typeof TouchableOpacity = type ButtonRef = React.ElementRef; const Button: component( - ref: React.RefSetter, + ref?: React.RefSetter, ...props: ButtonProps ) = React.forwardRef((props: ButtonProps, ref: React.RefSetter) => { const { diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index c20bc453ec2..4b47dac9ec5 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -1407,7 +1407,7 @@ declare export default typeof ActivityIndicatorViewNativeComponent; `; exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = ` -"type ButtonProps = $ReadOnly<{ +"export type ButtonProps = $ReadOnly<{ title: string, onPress: (event?: GestureResponderEvent) => mixed, touchSoundDisabled?: ?boolean, @@ -1440,7 +1440,7 @@ declare const Touchable: | typeof TouchableOpacity; type ButtonRef = React.ElementRef; declare const Button: component( - ref: React.RefSetter, + ref?: React.RefSetter, ...props: ButtonProps ); declare export default typeof Button; diff --git a/scripts/build/build-types/buildTypes.js b/scripts/build/build-types/buildTypes.js index 9557eaec902..4d153ebcaac 100644 --- a/scripts/build/build-types/buildTypes.js +++ b/scripts/build/build-types/buildTypes.js @@ -37,6 +37,7 @@ const ENTRY_POINTS = [ 'packages/react-native/Libraries/Blob/URLSearchParams.js', 'packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js', 'packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js', + 'packages/react-native/Libraries/Components/Button.js', 'packages/react-native/Libraries/Components/Clipboard/Clipboard.js', 'packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js', 'packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js',