Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: last expo sample for android and ios and session replay #272

Merged
merged 10 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .github/disabled_workflows/ci-e2e.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- uses: actions/checkout@v4
- uses: preactjs/compressed-size-action@v2
with:
pattern: 'posthog-{web,node}/lib/**/*.js'
pattern: 'posthog-{web,node,react-native}/lib/**/*.js'
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18

- run: yarn install
- run: yarn test
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18

- run: yarn install
- run: yarn build
Expand All @@ -42,10 +42,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
- run: |
yarn
cd examples/example-expo
cd examples/example-expo-latest
yarn global add yalc
yarn
yarn tsc
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
with:
path: ${{ matrix.package.name }}

- name: Set up Node 16
- name: Set up Node 18
uses: actions/setup-node@v4
if: steps.check-package-version.outputs.is-new-version == 'true'
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org

- name: Install dependencies
Expand Down
29 changes: 0 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,3 @@ yarn test
# Run the RN tests - these are separate due to specific babel configs
yarn test:rn
```

### Running E2E tests with Detox

See [Example Expo Readme](./examples/example-expo/README.md)

### Examples

#### React Native

```sh
cd examples/example-expo
yarn && yarn start
```

#### Node.js

First install yalc:

```sh
yarn global add yalc
```

Then run:

```sh
cd examples/example-node
yarn && yarn start
# example-expo has some buttons that will talk to this server
```
38 changes: 38 additions & 0 deletions examples/example-expo-latest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

yarn.lock
package-lock.json
36 changes: 36 additions & 0 deletions examples/example-expo-latest/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { useState } from 'react'
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, Text, View } from 'react-native'
import PostHog from 'posthog-react-native'

export const posthog = new PostHog('phc_QFbR1y41s5sxnNTZoyKG2NJo2RlsCIWkUfdpawgb40D', {
host: 'https://us.i.posthog.com',
flushAt: 1,
enableSessionReplay: true,
})
posthog.debug(true)

export default function App() {
const [buttonText, setButtonText] = useState('Open up App.js to start working on your app!')

const handleClick = () => {
posthog.capture('button_clicked', { name: 'example' })
setButtonText('button_clicked' + new Date().toISOString())
}

return (
<View style={styles.container}>
<Text onPress={handleClick}>{buttonText}</Text>
<StatusBar style="auto" />
</View>
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
16 changes: 16 additions & 0 deletions examples/example-expo-latest/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# OSX
#
.DS_Store

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/

# Bundle artifacts
*.jsbundle
Loading