react-native-macos/Libraries/LogBox/UI/LogBoxNotification.js

220 строки
5.1 KiB
JavaScript
Исходник Обычный вид История

Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import * as React from 'react';
import Image from '../../Image/Image';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Text from '../../Text/Text';
import View from '../../Components/View/View';
import LogBoxButton from './LogBoxButton';
import * as LogBoxStyle from './LogBoxStyle';
import LogBoxLog from '../Data/LogBoxLog';
import LogBoxMessage from './LogBoxMessage';
import * as LogBoxData from '../Data/LogBoxData';
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
type Props = $ReadOnly<{|
log: LogBoxLog,
totalLogCount: number,
level: 'warn' | 'error',
onPressOpen: () => void,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
onPressDismiss: () => void,
|}>;
function LogBoxLogNotification(props: Props): React.Node {
const {totalLogCount, level, log} = props;
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
// Eagerly symbolicate so the stack is available when pressing to inspect.
React.useEffect(() => {
LogBoxData.symbolicateLogLazy(log);
}, [log]);
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
return (
<View style={toastStyles.container}>
<LogBoxButton
onPress={props.onPressOpen}
style={toastStyles.press}
backgroundColor={{
default: LogBoxStyle.getBackgroundColor(1),
pressed: LogBoxStyle.getBackgroundColor(0.9),
}}>
<View style={toastStyles.content}>
<CountBadge count={totalLogCount} level={level} />
<Message message={log.message} />
<DismissButton onPress={props.onPressDismiss} />
</View>
</LogBoxButton>
</View>
);
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
}
function CountBadge(props) {
return (
<View style={countStyles.outside}>
{/* $FlowFixMe(>=0.114.0) This suppression was added when fixing the type
* of `StyleSheet.create`. Remove this comment to see the error. */}
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
<View style={[countStyles.inside, countStyles[props.level]]}>
<Text style={countStyles.text}>
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
{props.count <= 1 ? '!' : props.count}
</Text>
</View>
</View>
);
}
function Message(props) {
return (
<View style={messageStyles.container}>
<Text numberOfLines={1} style={messageStyles.text}>
{props.message && (
<LogBoxMessage
plaintext
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
message={props.message}
style={messageStyles.substitutionText}
/>
)}
</Text>
</View>
);
}
function DismissButton(props) {
return (
<View style={dismissStyles.container}>
<LogBoxButton
backgroundColor={{
default: LogBoxStyle.getTextColor(0.3),
pressed: LogBoxStyle.getTextColor(0.5),
}}
hitSlop={{
top: 12,
right: 10,
bottom: 12,
left: 10,
}}
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
onPress={props.onPress}
style={dismissStyles.press}>
<Image
source={require('./LogBoxImages/close.png')}
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
style={dismissStyles.image}
/>
</LogBoxButton>
</View>
);
}
const countStyles = StyleSheet.create({
warn: {
backgroundColor: LogBoxStyle.getWarningColor(1),
},
error: {
backgroundColor: LogBoxStyle.getErrorColor(1),
},
log: {
backgroundColor: LogBoxStyle.getLogColor(1),
},
outside: {
padding: 2,
borderRadius: 25,
backgroundColor: '#fff',
marginRight: 8,
},
inside: {
minWidth: 18,
paddingLeft: 4,
paddingRight: 4,
borderRadius: 25,
fontWeight: '600',
},
text: {
color: LogBoxStyle.getTextColor(1),
fontSize: 14,
lineHeight: 18,
textAlign: 'center',
fontWeight: '600',
textShadowColor: LogBoxStyle.getBackgroundColor(0.4),
textShadowOffset: {width: 0, height: 0},
textShadowRadius: 3,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
},
});
const messageStyles = StyleSheet.create({
container: {
alignSelf: 'stretch',
flexGrow: 1,
flexShrink: 1,
flexBasis: 'auto',
borderLeftColor: LogBoxStyle.getTextColor(0.2),
borderLeftWidth: 1,
paddingLeft: 8,
},
text: {
color: LogBoxStyle.getTextColor(1),
flex: 1,
fontSize: 14,
lineHeight: 22,
},
substitutionText: {
color: LogBoxStyle.getTextColor(0.6),
},
});
const dismissStyles = StyleSheet.create({
container: {
alignSelf: 'center',
flexDirection: 'row',
flexGrow: 0,
flexShrink: 0,
flexBasis: 'auto',
marginLeft: 5,
},
press: {
height: 20,
width: 20,
borderRadius: 25,
alignSelf: 'flex-end',
alignItems: 'center',
justifyContent: 'center',
},
image: {
height: 8,
width: 8,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
tintColor: LogBoxStyle.getBackgroundColor(1),
},
});
const toastStyles = StyleSheet.create({
container: {
height: 48,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
position: 'relative',
width: '100%',
justifyContent: 'center',
marginTop: 0.5,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
backgroundColor: LogBoxStyle.getTextColor(1),
},
press: {
height: 48,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
position: 'relative',
width: '100%',
justifyContent: 'center',
marginTop: 0.5,
Add LogBox for warnings Summary: # Overview This diff adds the initial LogBox redesign implementing only Warnings for now. The following diffs include the tests for this, as well as a way to enable an experimental flag to opt-in. Changelog: [Internal] ## Changes To init LogBox, we've taken the core of YellowBox and rewritten it entirely. Differences from Yellowbox include: - Data model re-written - More performant - Allows a future listing of logs in order - Allows a future toggle to show ignored logs - Moves category into a property - Groups by the same sequential message (as chrome does) instead of by category - Does not store dupes of the same messages, only a count - UI revamp - Color and design refresh - Does not spam UI with logs - Only shows the most recent log - Dismiss all button is always in one place - Allows navigating through all of the warnings in the list, not just ones in the same category - Collapses message to 5 lines (tap to expand) - Collapses unrelated stack frames (tap to expand) - Moves React stack to it's own section - Formats React Stack like a stack frame - Collapses any React frames over 3 deep (tap to expand) - Adds a "Meta" information (to be expanded on later) - De-emphasizes the source map indicator - Better Engineering - Rewrote almost all components to hooks (will follow up with the rest) - Added more tests for Data files - Added testes for UI components (previously there were none) - Refactored some imperative render code to declarative ## Known Problems - The first major problem is that in the collapsed state (which is meant to model the FBLogger on Comet) does not show the user how many logs are in the console (only the count of the current log). - The way we're doing symbolication and navigation is slow. We will follow up with perf improvements - The React Stack logic is too simple and missed cases - We need to get properly scaled images for the close button ## What's next Next up we'll be: - Move over Moti's improvements to filtering and YellowBox changes since I started this - Adding in Errors, and not using the native redbox when LogBox is available - Adding in a list of all errors and a way to navigate to it - Adding in Logs, so users can see console.log in the app - Make React stack frames clickable - And many more Reviewed By: cpojer Differential Revision: D17965726 fbshipit-source-id: 2f28584ecb7e3ca8d3df034ea1e1a4a50e018c02
2019-10-22 07:05:47 +03:00
paddingHorizontal: 12,
},
content: {
alignItems: 'flex-start',
flexDirection: 'row',
borderRadius: 8,
flexGrow: 0,
flexShrink: 0,
flexBasis: 'auto',
},
});
export default LogBoxLogNotification;