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