Skip to main content

Display the community

Show the Octopus community screens inside your app, full screen or embedded in one of your screens.

Before you begin​

How it works​

The community UI starts on the main feed and handles its own navigation between feeds, posts, groups and profiles. You choose where it lives:

PresentationAndroidiOSFlutterReact NativeUnity
Full screen, over your appYour own route.fullScreenCovershowOctopusHomeScreenopenUI()Open()
Embedded in one of your screensOctopusHomeContentOctopusHomeScreen in a tabOctopusHomeScreen widget<OctopusUIView>Not available

Your app gets callbacks when the community needs something only your app can do: sign the user in, edit a profile field your app owns, open a link, or show your own profile screen.


Show the community​

Add the OctopusHomeContent composable to your community screen:

  • navController: your main NavHostController.
  • onNavigateToLogin: called when the SDK needs a signed-in user. Start your login flow, then call OctopusSDK.connectUser(...).
  • onNavigateToProfileEdit: called when the user taps a profile field your app owns. fieldToEdit tells you which one, or null. Open your profile editor, then call OctopusSDK.connectUser(...) again with the updated profile.
OctopusTheme {
OctopusHomeContent(
modifier = Modifier.fillMaxSize(),
navController = navController,
onNavigateToLogin = {
navController.navigate(LoginRoute)
},
onNavigateToProfileEdit = { fieldToEdit ->
navController.navigate(
ProfileRoute(focusNickname = fieldToEdit == ProfileField.NICKNAME),
)
},
)
}

Then register the other community screens in your main NavHost with octopusComposables. It adds one composable() destination per community screen to your NavGraphBuilder:

NavHost(navController = navController, startDestination = HomeRoute) {
// Your own destinations
octopusComposables(
navController = navController,
onNavigateToLogin = { navController.navigate(LoginRoute) },
onNavigateToProfileEdit = { fieldToEdit -> /* same as above */ },
) { backStackEntry, content ->
// Theme a community screen, possibly based on backStackEntry
OctopusTheme {
content()
}
}
}
warning

When OctopusHomeContent, or the NavHost that holds octopusComposables, sits inside your own Scaffold, pass the innerPadding and consume it: Modifier.padding(innerPadding).consumeWindowInsets(innerPadding). Otherwise the system bar and keyboard insets count twice: the comment composer floats above the keyboard by the height of your bottom bar, and a gap shows under it when the keyboard is closed. This is the Compose guidance for nested Scaffolds.

See the samples for each integration: Community screen, Full screen, Bottom navigation bar, Floating bottom navigation bar and Single activity.


Modify the bottom safe area​

Android availableiOS availableFlutter ≥ 1.12.0React Native availableUnity not available

Reserve extra space at the bottom of the community UI, for example under your own bottom bar, so the floating "Write a post" button and the comment composer stay visible.

Use the contentPadding parameter of OctopusHomeContent:

OctopusHomeContent(
modifier = Modifier.fillMaxSize(),
navController = navController,
contentPadding = PaddingValues(bottom = 10.dp),
)

See the Floating bottom navigation bar sample.

Next steps​