-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Warn if the logger doesn't start due to duplicate logger (#56)
- add new forceEnable option to override default behaviour
- Loading branch information
1 parent
a452565
commit 35b54e0
Showing
7 changed files
with
112 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet, Text } from 'react-native'; | ||
import { Theme, useThemedStyles } from '../theme'; | ||
|
||
const Unmounted = () => { | ||
const styles = useThemedStyles(themedStyles); | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.heading}>Unmounted Error</Text> | ||
<Text style={styles.body}> | ||
It looks like the network logger hasn’t been enabled yet. | ||
</Text> | ||
<Text style={styles.body}> | ||
This is likely due to you running another debugging tool that is also | ||
intercepting network requests. Either disable that or start the network | ||
logger with the option:{' '} | ||
<Text style={styles.code}>"forceEnable: true"</Text>. | ||
</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
const themedStyles = (theme: Theme) => | ||
StyleSheet.create({ | ||
container: { | ||
padding: 15, | ||
}, | ||
heading: { | ||
color: theme.colors.text, | ||
fontWeight: '600', | ||
fontSize: 25, | ||
marginBottom: 10, | ||
}, | ||
body: { | ||
color: theme.colors.text, | ||
marginTop: 5, | ||
}, | ||
code: { | ||
color: theme.colors.muted, | ||
}, | ||
}); | ||
|
||
export default Unmounted; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const warn = (message: string) => | ||
console.warn(`react-native-network-logger: ${message}`); |