Skip to content

Commit fbaae3c

Browse files
committed
docs(messaging): add comments to sample code
Noticed by @mtalhabaig2 Supercedes #7103 Fixes #7073
1 parent c723c95 commit fbaae3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/messaging/usage/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,23 @@ you can configure your `AppDelegate.m` file (see instructions below) to inject a
268268
import { AppRegistry } from 'react-native';
269269
import messaging from '@react-native-firebase/messaging';
270270

271+
// Handle background messages using setBackgroundMessageHandler
271272
messaging().setBackgroundMessageHandler(async remoteMessage => {
272273
console.log('Message handled in the background!', remoteMessage);
273274
});
274275

276+
// Check if app was launched in the background and conditionally render null if so
275277
function HeadlessCheck({ isHeadless }) {
276278
if (isHeadless) {
277279
// App has been launched in the background by iOS, ignore
278280
return null;
279281
}
280282

283+
// Render the app component on foreground launch
281284
return <App />;
282285
}
283286

287+
// Your main application component defined here
284288
function App() {
285289
// Your application
286290
}

0 commit comments

Comments
 (0)