Adding posthog navigation
This commit is contained in:
3
App.js
3
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,6 +261,7 @@ 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>
|
||||||
|
<PostHogProvider apiKey="phc_2zh7SoBDi83vaa7Rz4YWTXWCjV0bOLfiqRyUo2mkf0b" autocapture>
|
||||||
<StatusBar style="dark" />
|
<StatusBar style="dark" />
|
||||||
<Stack.Navigator screenOptions={{
|
<Stack.Navigator screenOptions={{
|
||||||
header: (props) => {
|
header: (props) => {
|
||||||
@@ -329,6 +331,7 @@ export default function App() {
|
|||||||
<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