From 52d602d514c97da1219903237568305fa8cb1ee5 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Mon, 13 Jan 2025 12:11:52 -0800 Subject: [PATCH] [skip ci] Migrate rn-tester/js/components/RNTesterButton.js to function components (#48645) Summary: As per title. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D68098118 --- .../rn-tester/js/components/RNTesterButton.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/rn-tester/js/components/RNTesterButton.js b/packages/rn-tester/js/components/RNTesterButton.js index d760b3a00ea230..686301af61567b 100644 --- a/packages/rn-tester/js/components/RNTesterButton.js +++ b/packages/rn-tester/js/components/RNTesterButton.js @@ -12,8 +12,8 @@ import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -const React = require('react'); -const {Pressable, StyleSheet, Text} = require('react-native'); +import React from 'react'; +import {Pressable, StyleSheet, Text} from 'react-native'; type Props = $ReadOnly<{| testID?: string, @@ -22,17 +22,15 @@ type Props = $ReadOnly<{| onPress?: ?(event: PressEvent) => mixed, |}>; -class RNTesterButton extends React.Component { - render(): React.Node { - return ( - [styles.button, pressed && styles.pressed]}> - {this.props.children} - - ); - } +function RNTesterButton(props: Props): React.Node { + return ( + [styles.button, pressed && styles.pressed]}> + {props.children} + + ); } const styles = StyleSheet.create({ @@ -51,4 +49,4 @@ const styles = StyleSheet.create({ }, }); -module.exports = RNTesterButton; +export default RNTesterButton;