Skip to content

Commit

Permalink
[skip ci] Migrate rn-tester/js/components/RNTesterButton.js to functi…
Browse files Browse the repository at this point in the history
…on components (facebook#48645)

Summary:

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68098118
  • Loading branch information
fabriziocucci authored and facebook-github-bot committed Jan 13, 2025
1 parent 5a290c4 commit 52d602d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions packages/rn-tester/js/components/RNTesterButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,17 +22,15 @@ type Props = $ReadOnly<{|
onPress?: ?(event: PressEvent) => mixed,
|}>;

class RNTesterButton extends React.Component<Props> {
render(): React.Node {
return (
<Pressable
testID={this.props.testID}
onPress={this.props.onPress}
style={({pressed}) => [styles.button, pressed && styles.pressed]}>
<Text testID={this.props.textTestID}>{this.props.children}</Text>
</Pressable>
);
}
function RNTesterButton(props: Props): React.Node {
return (
<Pressable
testID={props.testID}
onPress={props.onPress}
style={({pressed}) => [styles.button, pressed && styles.pressed]}>
<Text testID={props.textTestID}>{props.children}</Text>
</Pressable>
);
}

const styles = StyleSheet.create({
Expand All @@ -51,4 +49,4 @@ const styles = StyleSheet.create({
},
});

module.exports = RNTesterButton;
export default RNTesterButton;

0 comments on commit 52d602d

Please sign in to comment.