Skip to content

better place for dismiss all button #19501

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
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
31 changes: 22 additions & 9 deletions Libraries/ReactNative/YellowBox.js
Original file line number Diff line number Diff line change
@@ -247,7 +247,6 @@ const WarningInspector = ({
warning,
stacktraceVisible,
onDismiss,
onDismissAll,
onMinimize,
toggleStacktrace,
}) => {
@@ -301,13 +300,6 @@ const WarningInspector = ({
underlayColor="transparent">
<Text style={styles.inspectorButtonText}>Dismiss</Text>
</TouchableHighlight>
<TouchableHighlight
activeOpacity={0.5}
onPress={onDismissAll}
style={styles.inspectorButton}
underlayColor="transparent">
<Text style={styles.inspectorButtonText}>Dismiss All</Text>
</TouchableHighlight>
</View>
</SafeAreaView>
</View>
@@ -392,6 +384,8 @@ class YellowBox extends React.Component<
}
const ScrollView = require('ScrollView');
const View = require('View');
const Text = require('Text');
const TouchableHighlight = require('TouchableHighlight');

const {inspecting, stacktraceVisible} = this.state;
const inspector =
@@ -401,7 +395,6 @@ class YellowBox extends React.Component<
warning={inspecting}
stacktraceVisible={stacktraceVisible}
onDismiss={() => this.dismissWarning(inspecting)}
onDismissAll={() => this.dismissWarning(null)}
onMinimize={() => this.setState({inspecting: null})}
toggleStacktrace={() =>
this.setState({stacktraceVisible: !stacktraceVisible})
@@ -431,6 +424,13 @@ class YellowBox extends React.Component<
];
return (
<View style={inspector ? styles.fullScreen : listStyle}>
{!inspector && (
<TouchableHighlight
style={styles.dismissAllContainer}
onPress={() => this.dismissWarning(null)}>
<Text style={styles.dismissAll}>Dismiss All</Text>
</TouchableHighlight>
)}
<ScrollView style={listStyle} scrollsToTop={false}>
{rows}
</ScrollView>
@@ -535,6 +535,19 @@ const styles = StyleSheet.create({
marginLeft: 15,
marginRight: 15,
},
dismissAllContainer: {
height: 20,
justifyContent: 'center',
marginTop: -30,
marginRight: 5,
backgroundColor: backgroundColor(0.95),
alignSelf: 'flex-end',
paddingHorizontal: 10,
borderRadius: 10,
},
dismissAll: {
color: 'white',
},
});

module.exports = YellowBox;