Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
2 changes: 1 addition & 1 deletion packages/rn-tester/js/components/RNTesterPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/

import {RNTesterThemeContext} from './RNTesterTheme';
import RNTesterTitle from './RNTesterTitle';
import {useContext} from 'react';

const RNTesterTitle = require('./RNTesterTitle');
const React = require('react');
const {SafeAreaView, ScrollView, StyleSheet, View} = require('react-native');

Expand Down
53 changes: 27 additions & 26 deletions packages/rn-tester/js/components/RNTesterTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,34 @@
*/

import {RNTesterThemeContext} from './RNTesterTheme';
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';

const React = require('react');
const {StyleSheet, Text, View} = require('react-native');
type Props = $ReadOnly<{
title: string,
}>;

class RNTesterTitle extends React.Component<$FlowFixMeProps> {
render(): React.Node {
return (
<RNTesterThemeContext.Consumer>
{theme => {
return (
<View
style={[
styles.container,
{
borderColor: theme.SeparatorColor,
backgroundColor: theme.TertiaryGroupedBackgroundColor,
},
]}>
<Text style={[styles.text, {color: theme.LabelColor}]}>
{this.props.title}
</Text>
</View>
);
}}
</RNTesterThemeContext.Consumer>
);
}
function RNTesterTitle({title}: Props): React.Node {
return (
<RNTesterThemeContext.Consumer>
{theme => {
return (
<View
style={[
styles.container,
{
borderColor: theme.SeparatorColor,
backgroundColor: theme.TertiaryGroupedBackgroundColor,
},
]}>
<Text style={[styles.text, {color: theme.LabelColor}]}>
{title}
</Text>
</View>
);
}}
</RNTesterThemeContext.Consumer>
);
}

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

module.exports = RNTesterTitle;
export default RNTesterTitle;
Loading