Skip to content

[RNTester] Remove ToolbarAndroid #24999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
61 changes: 41 additions & 20 deletions RNTester/js/RNTesterApp.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const {
BackHandler,
Dimensions,
DrawerLayoutAndroid,
Image,
Linking,
StatusBar,
StyleSheet,
ToolbarAndroid,
Text,
TouchableWithoutFeedback,
UIManager,
View,
} = require('react-native');
Expand All @@ -47,18 +49,27 @@ type Props = {

const APP_STATE_KEY = 'RNTesterAppState.v2';

const HEADER_LOGO_ICON = nativeImageSource({
android: 'launcher_icon',
width: 132,
height: 144,
});

const HEADER_NAV_ICON = nativeImageSource({
android: 'ic_menu_black_24dp',
width: 48,
height: 48,
});

const Header = ({title, onPressDrawer}) => {
return (
<View style={styles.toolbar}>
<View style={styles.toolbarCenter}>
<Text style={styles.title}>{title}</Text>
</View>
<View style={styles.toolbarLeft}>
<TouchableWithoutFeedback onPress={onPressDrawer}>
<Image source={HEADER_NAV_ICON} />
</TouchableWithoutFeedback>
</View>
</View>
);
};

class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
UNSAFE_componentWillMount() {
BackHandler.addEventListener(
Expand Down Expand Up @@ -155,14 +166,11 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
} else if (ExampleModule) {
return (
<View style={styles.container}>
<ToolbarAndroid
logo={HEADER_LOGO_ICON}
navIcon={HEADER_NAV_ICON}
<Header
title={ExampleModule.title}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue
* was found when making Flow check .android.js files. */
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title={ExampleModule.title}
onPressDrawer={() => this.drawer.openDrawer()}
/>
<RNTesterExampleContainer
module={ExampleModule}
Expand All @@ -179,14 +187,11 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {

return (
<View style={styles.container}>
<ToolbarAndroid
logo={HEADER_LOGO_ICON}
navIcon={HEADER_NAV_ICON}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
<Header
title="RNTester"
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue
* was found when making Flow check .android.js files. */
onPressDrawer={() => this.drawer.openDrawer()}
/>
<RNTesterExampleList
onNavigate={this._handleAction}
Expand Down Expand Up @@ -245,6 +250,22 @@ const styles = StyleSheet.create({
backgroundColor: '#E9EAED',
height: 56,
},
toolbarLeft: {
marginTop: 2,
},
toolbarCenter: {
flex: 1,
position: 'absolute',
top: 12,
left: 0,
right: 0,
alignItems: 'center',
},
title: {
fontSize: 19,
fontWeight: '600',
textAlign: 'center',
},
drawerContentWrapper: {
flex: 1,
paddingTop: StatusBar.currentHeight,
Expand Down
6 changes: 0 additions & 6 deletions RNTester/js/RNTesterList.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ const ComponentExamples: Array<RNTesterExample> = [
* when making Flow check .android.js files. */
module: require('./TextInputExample'),
},
{
key: 'ToolbarAndroidExample',
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
module: require('./ToolbarAndroidExample'),
},
{
key: 'TouchableExample',
module: require('./TouchableExample'),
Expand Down
186 changes: 0 additions & 186 deletions RNTester/js/ToolbarAndroidExample.android.js

This file was deleted.

16 changes: 0 additions & 16 deletions RNTester/js/ToolbarAndroidExample.ios.js

This file was deleted.