Skip to content

Commit

Permalink
KnockExpoPushNotificationProvider Fix (#166)
Browse files Browse the repository at this point in the history
* Fixed an issue in KnockExpoPushNotificationProvider that prevented auto device token registration from working

* chore: update app.json

* fix dependency
  • Loading branch information
matgar26 authored Jul 30, 2024
1 parent 7aa7471 commit b11aed5
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 89 deletions.
6 changes: 6 additions & 0 deletions .changeset/afraid-radios-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@knocklabs/react-native-example": patch
"@knocklabs/react-native": patch
---

Fixed an issue in KnockExpoPushNotificationProvider that prevented auto device token registration from working
11 changes: 7 additions & 4 deletions examples/react-native-example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
Expand All @@ -25,6 +23,11 @@
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "YOUR_EAS_PROJECT_ID"
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/react-native-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
},
"dependencies": {
"@knocklabs/react-native": "workspace:^",
"expo-status-bar": "~1.11.1",
"expo": ">=50.0.14",
"expo-constants": ">=15.4.0",
"expo-device": ">=5.9.3",
"expo-notifications": ">=0.27.6",
"expo-status-bar": "~1.11.1",
"react": "^18.2.0",
"react-native": "^0.73.4"
},
Expand Down
1 change: 1 addition & 0 deletions examples/react-native-example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function App() {
apiKey={process.env.EXPO_PUBLIC_KNOCK_PUBLIC_API_KEY}
host={process.env.EXPO_PUBLIC_KNOCK_HOST}
userId={process.env.EXPO_PUBLIC_KNOCK_USER_ID}
logLevel="debug"
>
<KnockExpoPushNotificationProvider
knockExpoChannelId={process.env.EXPO_PUBLIC_KNOCK_PUSH_CHANNEL_ID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ export default function NotificationFeed() {
const { loading, items, pageInfo } = useFeedStore((state) => state);

useEffect(() => {
const teardown = feedClient.listenForUpdates();

feedClient.fetch();
feedClient.on("messages.new", (data) => {
console.log(data);
});

feedClient.on("items.received.*", (data) => {
console.log(data);
});

return () => teardown();
}, [feedClient]);

return (
Expand Down
8 changes: 6 additions & 2 deletions examples/react-native-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"compilerOptions": {},
"extends": "expo/tsconfig.base"
"compilerOptions": {
"jsx": "react"
},
"extends": "expo/tsconfig.base",
"include": ["src"],
"exclude": ["node_modules"]
}
14 changes: 14 additions & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@
"react": "^18.2.0",
"react-native": "^0.73.4"
},
"peerDependenciesMeta": {
"expo": {
"optional": true
},
"expo-constants": {
"optional": true
},
"expo-device": {
"optional": true
},
"expo-notifications": {
"optional": true
}
},
"dependencies": {
"@knocklabs/client": "workspace:^",
"@knocklabs/react-core": "workspace:^"
Expand Down
Loading

0 comments on commit b11aed5

Please sign in to comment.