stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

openReactionSelector deprecated improperly and new function openReactionPicker not functional

Open cenzovit opened this issue 6 years ago • 13 comments

Describe the bug MessageSimple openReactionSelector has been deprecated but is not referencing the old functionality correctly. Even when making calls to the new openReactionPicker, the reaction picker is not opening in the correct location

  1. Set the onPress or onLongPress of MessageSimple as per docs
   * Function that overrides default behaviour when message is long pressed
   * e.g. if you would like to open reaction picker on message long press:
   *
   * ```
   * import { MessageSimple } from 'stream-chat-react-native' // or 'stream-chat-expo'
   * ...
   * const MessageUIComponent = (props) => {
   *  return (
   *    <MessageSimple
   *      {...props}
   *      onLongPress={(thisArg, message, e) => {
   *        thisArg.openReactionSelector();
   *      }}
   *  )
   * }
  1. Press a message and see that you get a deprecation warning but the reaction picker is not opened
  2. Instead make sure to reference thisArg.props.openReactionPicker() instead.
  3. Press a message and see that the reaction picker is not opened in the correct location (it is not properly setting the location of the modal.

Expected behavior Docs to be updated. Deprecated functions to still reference the correct code. The code to actually be functional.

cenzovit avatar Apr 11 '20 02:04 cenzovit

THanks @cenzovit . Will fix it in next publish :)

vishalnarkhede avatar Apr 12 '20 17:04 vishalnarkhede

Also, you use to be able to pass props along to MessageContent (because it was receiving the props from the parent MessageSimple); however, that no longer appears to be the case. We used to be able to set the delayLongPress attribute of the touchable.

cenzovit avatar Apr 13 '20 23:04 cenzovit

Also, you use to be able to pass props along to MessageContent (because it was receiving the props from the parent MessageSimple); however, that no longer appears to be the case. We used to be able to set the delayLongPress attribute of the touchable.

@cenzovit thats strange. We still forward all the props to MessageContent - https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/index.js#L413

Can you should me your code please?

vishalnarkhede avatar Apr 14 '20 07:04 vishalnarkhede

If you look at MessageContent you can see that only specific props are passed along (contentProps). Additional feedback, when wrapping the MessageInput in an InputAccessoryView, when a modal opens (in this case the reactionpicker), the accessory view / keyboard disappears and the reaction picker opens in the wrong spot

cenzovit avatar Apr 22 '20 03:04 cenzovit

To clarify, the major issue is that the openReactionPicker() method does not open the reaction picker in the correct location. Formerly this could be worked around by calling _setReactionPickerPosition directly but this is no longer accessible as it has been moved from MessageSimple to ReactionPickerWrapper.

cenzovit avatar Apr 22 '20 22:04 cenzovit

Can you should me a screen recording if possible? And also what code you are using?

The PR linked to this issue should fix your issues imo :)

vishalnarkhede avatar Apr 23 '20 10:04 vishalnarkhede

Here is a screen recording: RPReplay_Final1587670041.MP4.zip

We're using 0.10.0 of stream-chat-react-native. Here is the function we call:

            if (typeof thisArg?.props?.openReactionPicker === 'function') {
              thisArg.props.openReactionPicker();

bscharfstein avatar Apr 23 '20 19:04 bscharfstein

@cenzovit @bscharfstein can you please test once on 0.10.2 and let me know. I can see from your comments that the issues fixed in 0.10.2 are un-related to your issues. But just want to make sure you are still facing the issue on latest version before I dive again in this.

vishalnarkhede avatar May 04 '20 07:05 vishalnarkhede

Unfortunately 0.10.2 does not fix the issue

bscharfstein avatar May 04 '20 14:05 bscharfstein

nor does v0.10.3 as far as we can tell

bscharfstein avatar May 28 '20 18:05 bscharfstein

Hey @bscharfstein pardon me, been busy with some pressing issue. I will take a look earlier next week on this :)

vishalnarkhede avatar May 29 '20 08:05 vishalnarkhede

Hello, @bscharfstein and @cenzovit.

I've spent a couple of hours investigating the issues mentioned here to see if I could help, but I wasn't able to reproduce them entirely. If I understood correctly, there have been three problems reported:

  1. The openReactionSelector function was wrongly deprecated (meaning that the functionality was not there anymore).
  2. Even after you worked around the first issue, the reaction openReactionPicker itself is rendered in the wrong place when you call it.
  3. @cenzovit mentions a third issue, where we no longer pass down some props to the MessageSimple user event handlers (onPress, onLongPress).

I did some investigation on v0.11.0, to see if I could reproduce the issues mentioned. The first issue described, regarding the deprecation of the openReactionSelector function seems to be fixed. This issue could easily be replicated in v0.10.0 and is no longer present. But I could not reproduce the second issue yet.

I do see from the code that the implementation relies on a couple of async events, and I can imagine some side effects that could lead to this issue in different places, though I didn't manage to force them to happen. @vishalnarkhede is going to have a new look at it next week, but while he's on that, I have a couple of questions:

  • Are you using a custom KeyboardAvoidingView or something similar (i.e: setting to true the disableKeyboardCompatibleView prop and using your own implementation)?
  • Does the issue happen regardless of if you're building a release or a debug version of your application?

Other than that, if you could share an example with more context where you see the issue, this would be awesome.

vc0d35 avatar Jun 05 '20 13:06 vc0d35

closing as ReactionPicker does not seem to have these problems on the latest version of the sdk

virdesai avatar Oct 14 '20 15:10 virdesai