Browse SDKs · React Native
Platform
SDKsReact Native

Add user to blacklist

Block a specified user and add them to the blacklist using the OpenIM React Native SDK.

Copy

Add a designated user to the current account's blacklist to block direct communication:

await OpenIMSDK.addBlack({
  toUserID,
  ex,
});

Parameters

ParameterTypeRequiredDescription
toUserIDstringYesTarget user ID to blacklist.
exstringNoCustom extension string attached to the blacklist record.

Return value

A resolved Promise confirms that the user was added to the blacklist on the server.

Adding a user to the blacklist triggers the OnBlackAdded event. Use userID as the unique key to append the entry into your local blacklist cache. For event listener details, see Get blacklist.