Skip to content

Commit

Permalink
Install Stream SDK (#71)
Browse files Browse the repository at this point in the history
* npx expo install stream-chat-expo

* expo install @react-native-community/netinfo expo-av expo-document-picker expo-file-system expo-haptics expo-image-manipulator expo-image-picker expo-media-library expo-sharing react-native-gesture-handler react-native-reanimated react-native-svg

* Configure reanimated via babel

* Add prettier config

* Import RN gesture handler in index

* Format all via prettier
  • Loading branch information
Christopher David authored Apr 4, 2023
1 parent b143fff commit 4e7fae1
Show file tree
Hide file tree
Showing 17 changed files with 702 additions and 123 deletions.
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"endOfLine": "auto",
"printWidth": 80,
"tabWidth": 2,
"singleQuote": true,
"bracketSameLine": false,
"trailingComma": "es5",
"arrowParens": "always",
"semi": false
}
4 changes: 1 addition & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"bundleIdentifier": "arcade.labs.arc",
"buildNumber": "1",
Expand Down
21 changes: 11 additions & 10 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { Link, Tabs } from 'expo-router';
import { Pressable, useColorScheme } from 'react-native';
import FontAwesome from '@expo/vector-icons/FontAwesome'
import { Link, Tabs } from 'expo-router'
import { Pressable, useColorScheme } from 'react-native'

import Colors from '../../constants/Colors';
import Colors from '../../constants/Colors'

/**
* You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
*/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>['name'];
color: string;
name: React.ComponentProps<typeof FontAwesome>['name']
color: string
}) {
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />
}

export default function TabLayout() {
const colorScheme = useColorScheme();
const colorScheme = useColorScheme()

return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
}}>
}}
>
<Tabs.Screen
name="index"
options={{
Expand Down Expand Up @@ -51,5 +52,5 @@ export default function TabLayout() {
}}
/>
</Tabs>
);
)
}
16 changes: 10 additions & 6 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { StyleSheet } from 'react-native';
import { StyleSheet } from 'react-native'

import EditScreenInfo from '../../components/EditScreenInfo';
import { Text, View } from '../../components/Themed';
import EditScreenInfo from '../../components/EditScreenInfo'
import { Text, View } from '../../components/Themed'

export default function TabOneScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab One</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<EditScreenInfo path="app/(tabs)/index.tsx" />
</View>
);
)
}

const styles = StyleSheet.create({
Expand All @@ -28,4 +32,4 @@ const styles = StyleSheet.create({
height: 1,
width: '80%',
},
});
})
16 changes: 10 additions & 6 deletions app/(tabs)/two.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { StyleSheet } from 'react-native';
import { StyleSheet } from 'react-native'

import EditScreenInfo from '../../components/EditScreenInfo';
import { Text, View } from '../../components/Themed';
import EditScreenInfo from '../../components/EditScreenInfo'
import { Text, View } from '../../components/Themed'

export default function TabTwoScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab Two</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<EditScreenInfo path="app/(tabs)/two.tsx" />
</View>
);
)
}

const styles = StyleSheet.create({
Expand All @@ -28,4 +32,4 @@ const styles = StyleSheet.create({
height: 1,
width: '80%',
},
});
})
10 changes: 5 additions & 5 deletions app/[...missing].tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link, Stack } from 'expo-router';
import { StyleSheet } from 'react-native';
import { Link, Stack } from 'expo-router'
import { StyleSheet } from 'react-native'

import { Text, View } from '../components/Themed';
import { Text, View } from '../components/Themed'

export default function NotFoundScreen() {
return (
Expand All @@ -15,7 +15,7 @@ export default function NotFoundScreen() {
</Link>
</View>
</>
);
)
}

const styles = StyleSheet.create({
Expand All @@ -37,4 +37,4 @@ const styles = StyleSheet.create({
fontSize: 14,
color: '#2e78b7',
},
});
})
32 changes: 18 additions & 14 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { SplashScreen, Stack } from 'expo-router';
import { useEffect } from 'react';
import { useColorScheme } from 'react-native';
import FontAwesome from '@expo/vector-icons/FontAwesome'
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from '@react-navigation/native'
import { useFonts } from 'expo-font'
import { SplashScreen, Stack } from 'expo-router'
import { useEffect } from 'react'
import { useColorScheme } from 'react-native'

export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
} from 'expo-router'

export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: '(tabs)',
};
}

export default function RootLayout() {
const [loaded, error] = useFonts({
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
...FontAwesome.font,
});
})

// Expo Router uses Error Boundaries to catch errors in the navigation tree.
useEffect(() => {
if (error) throw error;
}, [error]);
if (error) throw error
}, [error])

return (
<>
{/* Keep the splash screen open until the assets have loaded. In the future, we should just support async font loading with a native version of font-display. */}
{!loaded && <SplashScreen />}
{loaded && <RootLayoutNav />}
</>
);
)
}

function RootLayoutNav() {
const colorScheme = useColorScheme();
const colorScheme = useColorScheme()

return (
<>
Expand All @@ -47,5 +51,5 @@ function RootLayoutNav() {
</Stack>
</ThemeProvider>
</>
);
)
}
18 changes: 11 additions & 7 deletions app/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { StatusBar } from 'expo-status-bar';
import { Platform, StyleSheet } from 'react-native';
import { StatusBar } from 'expo-status-bar'
import { Platform, StyleSheet } from 'react-native'

import EditScreenInfo from '../components/EditScreenInfo';
import { Text, View } from '../components/Themed';
import EditScreenInfo from '../components/EditScreenInfo'
import { Text, View } from '../components/Themed'

export default function ModalScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Modal</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<EditScreenInfo path="app/modal.tsx" />

{/* Use a light status bar on iOS to account for the black space above the modal */}
<StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
</View>
);
)
}

const styles = StyleSheet.create({
Expand All @@ -32,4 +36,4 @@ const styles = StyleSheet.create({
height: 1,
width: '80%',
},
});
})
11 changes: 6 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = function (api) {
api.cache(true);
api.cache(true)
return {
presets: ["babel-preset-expo"],
presets: ['babel-preset-expo'],
plugins: [
require.resolve("expo-router/babel"),
require.resolve('expo-router/babel'),
'react-native-reanimated/plugin', // Must be listed last
],
};
};
}
}
34 changes: 20 additions & 14 deletions components/EditScreenInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import React from 'react'
import { StyleSheet } from 'react-native'

import Colors from '../constants/Colors';
import { ExternalLink } from './ExternalLink';
import { MonoText } from './StyledText';
import { Text, View } from './Themed';
import Colors from '../constants/Colors'
import { ExternalLink } from './ExternalLink'
import { MonoText } from './StyledText'
import { Text, View } from './Themed'

export default function EditScreenInfo({ path }: { path: string }) {
return (
Expand All @@ -13,36 +13,42 @@ export default function EditScreenInfo({ path }: { path: string }) {
<Text
style={styles.getStartedText}
lightColor="rgba(0,0,0,0.8)"
darkColor="rgba(255,255,255,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)">
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.
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}>
<ExternalLink
style={styles.helpLink}
href="https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet">
href="https://docs.expo.io/get-started/create-a-new-app/#opening-the-app-on-your-phonetablet"
>
<Text style={styles.helpLinkText} lightColor={Colors.light.tint}>
Tap here if your app doesn't automatically update after making changes
Tap here if your app doesn't automatically update after making
changes
</Text>
</ExternalLink>
</View>
</View>
);
)
}

const styles = StyleSheet.create({
Expand Down Expand Up @@ -73,4 +79,4 @@ const styles = StyleSheet.create({
helpLinkText: {
textAlign: 'center',
},
});
})
14 changes: 7 additions & 7 deletions components/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from 'expo-router';
import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import { Platform } from 'react-native';
import { Link } from 'expo-router'
import * as WebBrowser from 'expo-web-browser'
import React from 'react'
import { Platform } from 'react-native'

export function ExternalLink(props: React.ComponentProps<typeof Link>) {
return (
Expand All @@ -14,11 +14,11 @@ export function ExternalLink(props: React.ComponentProps<typeof Link>) {
onPress={(e) => {
if (Platform.OS !== 'web') {
// Prevent the default behavior of linking to the default browser on native.
e.preventDefault();
e.preventDefault()
// Open the link in an in-app browser.
WebBrowser.openBrowserAsync(props.href as string);
WebBrowser.openBrowserAsync(props.href as string)
}
}}
/>
);
)
}
4 changes: 2 additions & 2 deletions components/StyledText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text, TextProps } from './Themed';
import { Text, TextProps } from './Themed'

export function MonoText(props: TextProps) {
return <Text {...props} style={[props.style, { fontFamily: 'SpaceMono' }]} />;
return <Text {...props} style={[props.style, { fontFamily: 'SpaceMono' }]} />
}
Loading

0 comments on commit 4e7fae1

Please sign in to comment.