-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 45f2372
Showing
28 changed files
with
26,031 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"e997a5256149a4b76e6bfd6cbf519c5e5a0f1d278a3d8fa1253022b03c90473b": true, | ||
"af683c96e0ffd2cf81287651c9433fa44debc1220ca7cb431fe482747f34a505": true, | ||
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, | ||
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true | ||
} |
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,14 @@ | ||
node_modules/ | ||
.expo/ | ||
dist/ | ||
npm-debug.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
# macOS | ||
.DS_Store |
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,22 @@ | ||
import { StatusBar } from 'expo-status-bar'; | ||
import { SafeAreaProvider } from 'react-native-safe-area-context'; | ||
|
||
import useCachedResources from './hooks/useCachedResources'; | ||
import useColorScheme from './hooks/useColorScheme'; | ||
import Navigation from './navigation'; | ||
|
||
export default function App() { | ||
const isLoadingComplete = useCachedResources(); | ||
const colorScheme = useColorScheme(); | ||
|
||
if (!isLoadingComplete) { | ||
return null; | ||
} else { | ||
return ( | ||
<SafeAreaProvider> | ||
<Navigation colorScheme={colorScheme} /> | ||
<StatusBar /> | ||
</SafeAreaProvider> | ||
); | ||
} | ||
} |
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,34 @@ | ||
{ | ||
"expo": { | ||
"name": "cloudflare-ip-tester-app", | ||
"slug": "cloudflare-ip-tester-app", | ||
"version": "1.0.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/images/icon.png", | ||
"scheme": "myapp", | ||
"userInterfaceStyle": "automatic", | ||
"splash": { | ||
"image": "./assets/images/splash.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"updates": { | ||
"fallbackToCacheTimeout": 0 | ||
}, | ||
"assetBundlePatterns": [ | ||
"**/*" | ||
], | ||
"ios": { | ||
"supportsTablet": true | ||
}, | ||
"android": { | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/images/adaptive-icon.png", | ||
"backgroundColor": "#ffffff" | ||
} | ||
}, | ||
"web": { | ||
"favicon": "./assets/images/favicon.png" | ||
} | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
module.exports = function(api) { | ||
api.cache(true); | ||
return { | ||
presets: ['babel-preset-expo'] | ||
}; | ||
}; |
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,79 @@ | ||
import * as WebBrowser from 'expo-web-browser'; | ||
import { StyleSheet, TouchableOpacity } from 'react-native'; | ||
|
||
import Colors from '../constants/Colors'; | ||
import { MonoText } from './StyledText'; | ||
import { Text, View } from './Themed'; | ||
|
||
export default function EditScreenInfo({ path }: { path: string }) { | ||
return ( | ||
<View> | ||
<View style={styles.getStartedContainer}> | ||
<Text | ||
style={styles.getStartedText} | ||
lightColor="rgba(0,0,0,0.8)" | ||
darkColor="rgba(255,255,255,0.8)"> | ||
Open up the code for this screen: | ||
</Text> | ||
|
||
<View | ||
style={[styles.codeHighlightContainer, styles.homeScreenFilename]} | ||
darkColor="rgba(255,255,255,0.05)" | ||
lightColor="rgba(0,0,0,0.05)"> | ||
<MonoText>{path}</MonoText> | ||
</View> | ||
|
||
<Text | ||
style={styles.getStartedText} | ||
lightColor="rgba(0,0,0,0.8)" | ||
darkColor="rgba(255,255,255,0.8)"> | ||
Change any of the text, save the file, and your app will automatically update. | ||
</Text> | ||
</View> | ||
|
||
<View style={styles.helpContainer}> | ||
<TouchableOpacity onPress={handleHelpPress} style={styles.helpLink}> | ||
<Text style={styles.helpLinkText} lightColor={Colors.light.tint}> | ||
Tap here if your app doesn't automatically update after making changes | ||
</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
function handleHelpPress() { | ||
WebBrowser.openBrowserAsync( | ||
'https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet' | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
getStartedContainer: { | ||
alignItems: 'center', | ||
marginHorizontal: 50, | ||
}, | ||
homeScreenFilename: { | ||
marginVertical: 7, | ||
}, | ||
codeHighlightContainer: { | ||
borderRadius: 3, | ||
paddingHorizontal: 4, | ||
}, | ||
getStartedText: { | ||
fontSize: 17, | ||
lineHeight: 24, | ||
textAlign: 'center', | ||
}, | ||
helpContainer: { | ||
marginTop: 15, | ||
marginHorizontal: 20, | ||
alignItems: 'center', | ||
}, | ||
helpLink: { | ||
paddingVertical: 15, | ||
}, | ||
helpLinkText: { | ||
textAlign: 'center', | ||
}, | ||
}); |
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,5 @@ | ||
import { Text, TextProps } from './Themed'; | ||
|
||
export function MonoText(props: TextProps) { | ||
return <Text {...props} style={[props.style, { fontFamily: 'space-mono' }]} />; | ||
} |
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,45 @@ | ||
/** | ||
* Learn more about Light and Dark modes: | ||
* https://docs.expo.io/guides/color-schemes/ | ||
*/ | ||
|
||
import { Text as DefaultText, View as DefaultView } from 'react-native'; | ||
|
||
import Colors from '../constants/Colors'; | ||
import useColorScheme from '../hooks/useColorScheme'; | ||
|
||
export function useThemeColor( | ||
props: { light?: string; dark?: string }, | ||
colorName: keyof typeof Colors.light & keyof typeof Colors.dark | ||
) { | ||
const theme = useColorScheme(); | ||
const colorFromProps = props[theme]; | ||
|
||
if (colorFromProps) { | ||
return colorFromProps; | ||
} else { | ||
return Colors[theme][colorName]; | ||
} | ||
} | ||
|
||
type ThemeProps = { | ||
lightColor?: string; | ||
darkColor?: string; | ||
}; | ||
|
||
export type TextProps = ThemeProps & DefaultText['props']; | ||
export type ViewProps = ThemeProps & DefaultView['props']; | ||
|
||
export function Text(props: TextProps) { | ||
const { style, lightColor, darkColor, ...otherProps } = props; | ||
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text'); | ||
|
||
return <DefaultText style={[{ color }, style]} {...otherProps} />; | ||
} | ||
|
||
export function View(props: ViewProps) { | ||
const { style, lightColor, darkColor, ...otherProps } = props; | ||
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background'); | ||
|
||
return <DefaultView style={[{ backgroundColor }, style]} {...otherProps} />; | ||
} |
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,10 @@ | ||
import * as React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import { MonoText } from '../StyledText'; | ||
|
||
it(`renders correctly`, () => { | ||
const tree = renderer.create(<MonoText>Snapshot test!</MonoText>).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
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,19 @@ | ||
const tintColorLight = '#2f95dc'; | ||
const tintColorDark = '#fff'; | ||
|
||
export default { | ||
light: { | ||
text: '#000', | ||
background: '#fff', | ||
tint: tintColorLight, | ||
tabIconDefault: '#ccc', | ||
tabIconSelected: tintColorLight, | ||
}, | ||
dark: { | ||
text: '#fff', | ||
background: '#000', | ||
tint: tintColorDark, | ||
tabIconDefault: '#ccc', | ||
tabIconSelected: tintColorDark, | ||
}, | ||
}; |
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,12 @@ | ||
import { Dimensions } from 'react-native'; | ||
|
||
const width = Dimensions.get('window').width; | ||
const height = Dimensions.get('window').height; | ||
|
||
export default { | ||
window: { | ||
width, | ||
height, | ||
}, | ||
isSmallDevice: width < 375, | ||
}; |
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,33 @@ | ||
import { FontAwesome } from '@expo/vector-icons'; | ||
import * as Font from 'expo-font'; | ||
import * as SplashScreen from 'expo-splash-screen'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export default function useCachedResources() { | ||
const [isLoadingComplete, setLoadingComplete] = useState(false); | ||
|
||
// Load any resources or data that we need prior to rendering the app | ||
useEffect(() => { | ||
async function loadResourcesAndDataAsync() { | ||
try { | ||
SplashScreen.preventAutoHideAsync(); | ||
|
||
// Load fonts | ||
await Font.loadAsync({ | ||
...FontAwesome.font, | ||
'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), | ||
}); | ||
} catch (e) { | ||
// We might want to provide this error information to an error reporting service | ||
console.warn(e); | ||
} finally { | ||
setLoadingComplete(true); | ||
SplashScreen.hideAsync(); | ||
} | ||
} | ||
|
||
loadResourcesAndDataAsync(); | ||
}, []); | ||
|
||
return isLoadingComplete; | ||
} |
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,8 @@ | ||
import { ColorSchemeName, useColorScheme as _useColorScheme } from 'react-native'; | ||
|
||
// The useColorScheme value is always either light or dark, but the built-in | ||
// type suggests that it can be null. This will not happen in practice, so this | ||
// makes it a bit easier to work with. | ||
export default function useColorScheme(): NonNullable<ColorSchemeName> { | ||
return _useColorScheme() as NonNullable<ColorSchemeName>; | ||
} |
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,36 @@ | ||
/** | ||
* Learn more about deep linking with React Navigation | ||
* https://reactnavigation.org/docs/deep-linking | ||
* https://reactnavigation.org/docs/configuring-links | ||
*/ | ||
|
||
import { LinkingOptions } from '@react-navigation/native'; | ||
import * as Linking from 'expo-linking'; | ||
|
||
import { RootStackParamList } from '../types'; | ||
|
||
const linking: LinkingOptions<RootStackParamList> = { | ||
prefixes: [Linking.makeUrl('/')], | ||
config: { | ||
screens: { | ||
Root: { | ||
screens: { | ||
TabOne: { | ||
screens: { | ||
TabOneScreen: 'one', | ||
}, | ||
}, | ||
TabTwo: { | ||
screens: { | ||
TabTwoScreen: 'two', | ||
}, | ||
}, | ||
}, | ||
}, | ||
Modal: 'modal', | ||
NotFound: '*', | ||
}, | ||
}, | ||
}; | ||
|
||
export default linking; |
Oops, something went wrong.