There are many pages and actions on AmityUIKit. Pages can be nested inside others and it would be hard for overriding events on the nested pages. In order to solve this problem, we provide EkoEventHandler which is a behavior controller for actions that happen in UIKit.
To pass handlers into UIKit you need to set ‘actionHandlers’ prop for AmityUiKitProvider. All handlers are optional. If any is not passed, UIKit will use its own internal implementation.
You can access any action handler using the useAmityNavigation
hook.
Event
Parameter
Condition
onChangePage
pageName
onChangePage is called right before UIKit changes the page type which should be rendered. If handler is passed, UIKit relies on it instead of its internal implementation
onClickCategory
categoryId
Category display name is clicked
onClickCommunity
communityId
Community display name is clicked
onClickUser
userId
User avatar or user display name is clicked
onCommunityCreated
communityId
New community is created
onEditCommunity
communityId
Edit community button is clicked
onEditUser
userId
Edit user button is clicked
When a user clicks on the user profile avatar at the post creator area, UIKit will open User profile page.
However, you can intercept the event and define your own logic following the example below.
Let’s say you want to override the default logic and open your own modal showing the user profile instead of navigating to the user profile page.