Skip to content

Commit d298212

Browse files
skv-headlessfacebook-github-bot
authored andcommitted
better place for dismiss all button
Summary: This pr makes a little bit simpler to dismiss all warnings (1 click instead of 2) Sometimes you don't want to use `YellowBox.ignoreWarnings` to remember. RNTester sceenshot: <img width="322" alt="screen shot 2018-05-30 at 09 51 25" src="https://user-images.githubusercontent.com/1488195/40701475-1142506a-63ef-11e8-8fc9-ea1696d9cb65.png"> Or RNTester -> Native Animation Example -> Force JS Stalls (in the end of the list) also cause warning to test. [GENERAL][ENHANCEMENT][YellowBox] - Move `Dismiss All` yellow box button to another place which makes a little bit simpler to dismiss warnings. Closes #19501 Differential Revision: D8243823 Pulled By: hramos fbshipit-source-id: 31887469cddb4adfd7b889ae0c29a3bf41e87b7b
1 parent b2b2caa commit d298212

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

Libraries/ReactNative/YellowBox.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ const WarningInspector = ({
247247
warning,
248248
stacktraceVisible,
249249
onDismiss,
250-
onDismissAll,
251250
onMinimize,
252251
toggleStacktrace,
253252
}) => {
@@ -301,13 +300,6 @@ const WarningInspector = ({
301300
underlayColor="transparent">
302301
<Text style={styles.inspectorButtonText}>Dismiss</Text>
303302
</TouchableHighlight>
304-
<TouchableHighlight
305-
activeOpacity={0.5}
306-
onPress={onDismissAll}
307-
style={styles.inspectorButton}
308-
underlayColor="transparent">
309-
<Text style={styles.inspectorButtonText}>Dismiss All</Text>
310-
</TouchableHighlight>
311303
</View>
312304
</SafeAreaView>
313305
</View>
@@ -392,6 +384,8 @@ class YellowBox extends React.Component<
392384
}
393385
const ScrollView = require('ScrollView');
394386
const View = require('View');
387+
const Text = require('Text');
388+
const TouchableHighlight = require('TouchableHighlight');
395389

396390
const {inspecting, stacktraceVisible} = this.state;
397391
const inspector =
@@ -401,7 +395,6 @@ class YellowBox extends React.Component<
401395
warning={inspecting}
402396
stacktraceVisible={stacktraceVisible}
403397
onDismiss={() => this.dismissWarning(inspecting)}
404-
onDismissAll={() => this.dismissWarning(null)}
405398
onMinimize={() => this.setState({inspecting: null})}
406399
toggleStacktrace={() =>
407400
this.setState({stacktraceVisible: !stacktraceVisible})
@@ -431,6 +424,13 @@ class YellowBox extends React.Component<
431424
];
432425
return (
433426
<View style={inspector ? styles.fullScreen : listStyle}>
427+
{!inspector && (
428+
<TouchableHighlight
429+
style={styles.dismissAllContainer}
430+
onPress={() => this.dismissWarning(null)}>
431+
<Text style={styles.dismissAll}>Dismiss All</Text>
432+
</TouchableHighlight>
433+
)}
434434
<ScrollView style={listStyle} scrollsToTop={false}>
435435
{rows}
436436
</ScrollView>
@@ -535,6 +535,19 @@ const styles = StyleSheet.create({
535535
marginLeft: 15,
536536
marginRight: 15,
537537
},
538+
dismissAllContainer: {
539+
height: 20,
540+
justifyContent: 'center',
541+
marginTop: -30,
542+
marginRight: 5,
543+
backgroundColor: backgroundColor(0.95),
544+
alignSelf: 'flex-end',
545+
paddingHorizontal: 10,
546+
borderRadius: 10,
547+
},
548+
dismissAll: {
549+
color: 'white',
550+
},
538551
});
539552

540553
module.exports = YellowBox;

0 commit comments

Comments
 (0)