Adding posthog navigation
This commit is contained in:
139
App.js
139
App.js
@@ -29,6 +29,7 @@ import NewGroup from './Views/NewGroup.js';
|
||||
import Slideshow from './Views/Slideshow.js';
|
||||
import SongPlayer from './Views/SongPlayer.js';
|
||||
import { Platform } from 'react-native';
|
||||
import { PostHogProvider } from 'posthog-react-native'
|
||||
|
||||
|
||||
const Tab = createBottomTabNavigator();
|
||||
@@ -260,75 +261,77 @@ export default function App() {
|
||||
}} theme={theme}>
|
||||
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={{ flex: 1 }}>
|
||||
<NavigationContainer>
|
||||
<StatusBar style="dark" />
|
||||
<Stack.Navigator screenOptions={{
|
||||
header: (props) => {
|
||||
return (
|
||||
<Appbar.Header style={{ backgroundColor: '#fff' }}>
|
||||
{props.navigation.canGoBack() ? <Appbar.BackAction onPress={() => {
|
||||
props.navigation.goBack();
|
||||
}} /> : <Appbar.Action icon="menu" style={{ padding: 0, margin: 0 }} onPress={() => { props.navigation.navigate('Menu'); }} />}
|
||||
<Appbar.Content title="EMI Fellowship" titleStyle={{}} />
|
||||
<Appbar.Action icon="chat" onPress={() => {
|
||||
alert("Chats are comming soon.");
|
||||
}} onLongPress={()=>{
|
||||
props.navigation.navigate("SongPlayer");
|
||||
}} />
|
||||
<Appbar.Action icon="search" onPress={() => { props.navigation.navigate("Search") }} />
|
||||
<Appbar.Action icon="notifications" onPress={() => { props.navigation.navigate("Notifications") }} />
|
||||
</Appbar.Header>
|
||||
)
|
||||
},
|
||||
}}>
|
||||
<Stack.Screen
|
||||
name="MainNavigation"
|
||||
component={MainNavigation}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Profile"
|
||||
component={Profile}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="NewPost"
|
||||
component={NewPostView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="NewGroup"
|
||||
component={NewGroup}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Search"
|
||||
component={Search}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="ProfileSettings"
|
||||
component={ProfileSettings}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Invite"
|
||||
component={InviteView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Menu"
|
||||
component={MenuView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Notifications"
|
||||
component={NotificationsView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Slideshow"
|
||||
component={Slideshow}
|
||||
<PostHogProvider apiKey="phc_2zh7SoBDi83vaa7Rz4YWTXWCjV0bOLfiqRyUo2mkf0b" autocapture>
|
||||
<StatusBar style="dark" />
|
||||
<Stack.Navigator screenOptions={{
|
||||
header: (props) => {
|
||||
return (
|
||||
<Appbar.Header style={{ backgroundColor: '#fff' }}>
|
||||
{props.navigation.canGoBack() ? <Appbar.BackAction onPress={() => {
|
||||
props.navigation.goBack();
|
||||
}} /> : <Appbar.Action icon="menu" style={{ padding: 0, margin: 0 }} onPress={() => { props.navigation.navigate('Menu'); }} />}
|
||||
<Appbar.Content title="EMI Fellowship" titleStyle={{}} />
|
||||
<Appbar.Action icon="chat" onPress={() => {
|
||||
alert("Chats are comming soon.");
|
||||
}} onLongPress={() => {
|
||||
props.navigation.navigate("SongPlayer");
|
||||
}} />
|
||||
<Appbar.Action icon="search" onPress={() => { props.navigation.navigate("Search") }} />
|
||||
<Appbar.Action icon="notifications" onPress={() => { props.navigation.navigate("Notifications") }} />
|
||||
</Appbar.Header>
|
||||
)
|
||||
},
|
||||
}}>
|
||||
<Stack.Screen
|
||||
name="MainNavigation"
|
||||
component={MainNavigation}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Profile"
|
||||
component={Profile}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="NewPost"
|
||||
component={NewPostView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="NewGroup"
|
||||
component={NewGroup}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Search"
|
||||
component={Search}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="ProfileSettings"
|
||||
component={ProfileSettings}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Invite"
|
||||
component={InviteView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Menu"
|
||||
component={MenuView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Notifications"
|
||||
component={NotificationsView}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Slideshow"
|
||||
component={Slideshow}
|
||||
//options={{ headerShown: false }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="SongPlayer"
|
||||
component={SongPlayer}
|
||||
/>
|
||||
<Stack.Screen name="SinglePost" component={SinglePost} />
|
||||
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
|
||||
<Tab.Screen name="Logout" component={Login} />
|
||||
</Stack.Navigator>
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="SongPlayer"
|
||||
component={SongPlayer}
|
||||
/>
|
||||
<Stack.Screen name="SinglePost" component={SinglePost} />
|
||||
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
|
||||
<Tab.Screen name="Logout" component={Login} />
|
||||
</Stack.Navigator>
|
||||
</PostHogProvider>
|
||||
</NavigationContainer>
|
||||
<MediaView></MediaView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
@@ -78,9 +78,11 @@ let Feed = ({ navigation, route }) => {
|
||||
API.getMe().then((me) => {
|
||||
if (subscribed){
|
||||
GlobalState.me = me;
|
||||
posthog.identify(me._id,
|
||||
posthog.identify(me.userid,
|
||||
{
|
||||
name: me.profile.firstName
|
||||
name: me.profile.firstName,
|
||||
profileid: me._id,
|
||||
is_superuser: me.superuser,
|
||||
}
|
||||
);
|
||||
posthog.capture('login');
|
||||
@@ -98,7 +100,6 @@ let Feed = ({ navigation, route }) => {
|
||||
storeFeed(posts);
|
||||
}
|
||||
console.log("Feed, end useEffect")
|
||||
posthog.capture('feed_impression');
|
||||
}
|
||||
getData()
|
||||
return () => {
|
||||
@@ -106,13 +107,6 @@ let Feed = ({ navigation, route }) => {
|
||||
}
|
||||
}, [route.params]);
|
||||
const renderPost = (({ item }) => {
|
||||
posthog.capture(
|
||||
'feed_impression',
|
||||
{
|
||||
post_id: item._id,
|
||||
post_type: item.type,
|
||||
}
|
||||
);
|
||||
if (item.nonOrganicType === 'PopularUsers' || item.nonOrganicType === 'PopularGroups'){
|
||||
if(item.nonOrganicType === 'PopularUsers'){
|
||||
return (<PostPopularUsers post={item}/>)
|
||||
|
||||
Reference in New Issue
Block a user