Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet: Emoji picker performance #17891

Merged
merged 9 commits into from
Nov 27, 2023
Merged

Wallet: Emoji picker performance #17891

merged 9 commits into from
Nov 27, 2023

Conversation

OmarBasem
Copy link
Contributor

@OmarBasem OmarBasem commented Nov 13, 2023

fixes: #17889

This PR fixes performance issues with opening emoji selector.

Before:

RPReplay_Final1699873654.MP4

After:

RPReplay_Final1699879713.MP4

@OmarBasem OmarBasem self-assigned this Nov 13, 2023
@status-im-auto
Copy link
Member

status-im-auto commented Nov 13, 2023

Jenkins Builds

Click to see older builds (28)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 0773414 #1 2023-11-13 11:04:24 ~5 min ios 📱ipa 📲
✔️ 0773414 #1 2023-11-13 11:04:35 ~5 min android 🤖apk 📲
✔️ 0773414 #1 2023-11-13 11:06:14 ~7 min android-e2e 🤖apk 📲
✔️ 0773414 #1 2023-11-13 11:07:22 ~8 min tests 📄log
054d0bb #2 2023-11-13 12:04:15 ~2 min tests 📄log
✔️ 054d0bb #2 2023-11-13 12:07:58 ~5 min android 🤖apk 📲
✔️ 054d0bb #2 2023-11-13 12:08:10 ~6 min android-e2e 🤖apk 📲
085c70e #3 2023-11-13 12:12:28 ~2 min tests 📄log
085c70e #3 2023-11-13 12:14:36 ~4 min ios 📄log
✔️ 085c70e #3 2023-11-13 12:15:35 ~5 min android-e2e 🤖apk 📲
✔️ 085c70e #3 2023-11-13 12:16:16 ~6 min android 🤖apk 📲
257f784 #5 2023-11-13 12:22:17 ~2 min tests 📄log
✔️ 257f784 #5 2023-11-13 12:25:06 ~5 min android 🤖apk 📲
✔️ 257f784 #5 2023-11-13 12:25:14 ~5 min android-e2e 🤖apk 📲
✔️ 257f784 #5 2023-11-13 12:31:19 ~11 min ios 📱ipa 📲
✔️ 10fb677 #6 2023-11-13 12:41:59 ~5 min android 🤖apk 📲
✔️ 10fb677 #6 2023-11-13 12:45:13 ~9 min tests 📄log
✔️ 10fb677 #6 2023-11-13 12:45:15 ~9 min android-e2e 🤖apk 📲
✔️ 10fb677 #6 2023-11-13 12:47:15 ~11 min ios 📱ipa 📲
d249673 #7 2023-11-13 13:35:32 ~1 min tests 📄log
✔️ d249673 #7 2023-11-13 13:39:34 ~5 min android-e2e 🤖apk 📲
✔️ d249673 #7 2023-11-13 13:39:38 ~6 min android 🤖apk 📲
✔️ d249673 #7 2023-11-13 13:44:35 ~10 min ios 📱ipa 📲
✔️ 05a310f #8 2023-11-24 11:24:01 ~12 min ios 📱ipa 📲
05a310f #8 2023-11-24 11:44:31 ~33 min tests 📄log
✔️ 05a310f #9 2023-11-24 15:27:44 ~13 min android 🤖apk 📲
✔️ 05a310f #9 2023-11-24 15:31:07 ~16 min android-e2e 🤖apk 📲
05a310f #9 2023-11-24 15:42:56 ~4 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
3d6f7a3 #10 2023-11-27 05:37:21 ~5 min tests 📄log
✔️ 3d6f7a3 #10 2023-11-27 05:38:31 ~6 min android 🤖apk 📲
✔️ 3d6f7a3 #9 2023-11-27 05:38:34 ~6 min ios 📱ipa 📲
✔️ 3d6f7a3 #10 2023-11-27 05:39:34 ~7 min android-e2e 🤖apk 📲
✔️ 205b60a #11 2023-11-27 05:50:55 ~8 min android-e2e 🤖apk 📲
✔️ 205b60a #11 2023-11-27 05:52:54 ~10 min tests 📄log
✔️ 205b60a #11 2023-11-27 05:54:44 ~12 min android 🤖apk 📲
✔️ 205b60a #10 2023-11-27 05:56:06 ~13 min ios 📱ipa 📲

@OmarBasem OmarBasem force-pushed the wallet/emoji-picker-perf branch from 085c70e to fe9fea5 Compare November 13, 2023 12:17
@OmarBasem OmarBasem marked this pull request as ready for review November 13, 2023 12:36
@OmarBasem OmarBasem changed the title [WIP] Wallet: Emoji picker performance Nov 13, 2023
[{:keys [render-emojis? search-text on-change-text clear-states active-category scroll-ref theme]
:as sheet-opts}]
(let [search-active? (pos? (count @search-text))]
(rn/use-effect #(js/setTimeout (fn [] (reset! render-emojis? true)) 250))
Copy link
Contributor Author

@OmarBasem OmarBasem Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line 158 is the only change. The rest is refactoring.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does it work? what was causing the issue?

Copy link
Contributor Author

@OmarBasem OmarBasem Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@J-Son89 rendering the emojis data is heavy on the UI thread, we need to delay rendering until the navigation animation completes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Omar, maybe we should comment in the file about this?
Should the timeout time be a named def to help give context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Omar, maybe we should comment in the file about this?

@J-Son89 added comment.

Should the timeout time be a named def to help give context?

No need I think, it is used only once, and the ratom is named render-emojis? inside a setTimeout so I think it is clear what is happening

@status-im-auto
Copy link
Member

73% of end-end tests have passed

Total executed tests: 45
Failed tests: 9
Expected to fail tests: 3
Passed tests: 33
IDs of failed tests: 702733,703133,702745,703503,702869,702936,702855,702947,703629 
IDs of expected to fail tests: 702732,702731,702808 

Failed tests (9)

Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_join_when_node_owner_offline, id: 703629

    Device 2: Joining community
    Device 2: Find `Button` by `accessibility id`: `show-request-to-join-screen-button`

    critical/chats/test_public_chat_browsing.py:1070: in test_community_join_when_node_owner_offline
        self.community_2.join_community(open_community=False)
    ../views/chat_view.py:427: in join_community
        self.join_button.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 2: Button by accessibility id: `show-request-to-join-screen-button` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936

    Device 2: Find Button by xpath: //*[@content-desc='password-input']/../following-sibling::*//*[@text='Join Community']
    Device 2: Tap on found: Button

    Test setup failed: activity_center/test_activity_center.py:249: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:433: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Test setup failed: activity_center/test_activity_center.py:249: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:433: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_text_message_delete_push_disappear, id: 702733

    Device 2: Find Text by xpath: //*[starts-with(@text,'smth I should edit')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']
    Device 2: Tap on found: Text

    critical/chats/test_1_1_public_chats.py:468: in test_1_1_chat_text_message_delete_push_disappear
        self.chat_2.chat_element_by_text(message_after_edit_1_1).wait_for_status_to_be("Delivered")
    ../views/chat_view.py:240: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's; 
     RemoteDisconnected
    



    Device sessions

    2. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745

    Device 2: Tap on found: SendMessageButton
    Device 1: Looking for a message by text: hello

    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:703: in urlopen
        httplib_response = self._make_request(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:449: in _make_request
        six.raise_from(e, None)
    <string>:3: in raise_from
        ???
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:444: in _make_request
        httplib_response = conn.getresponse()
    /usr/lib/python3.10/http/client.py:1374: in getresponse
        response.begin()
    /usr/lib/python3.10/http/client.py:318: in begin
        version, status, reason = self._read_status()
    /usr/lib/python3.10/http/client.py:287: in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
    E   http.client.RemoteDisconnected: Remote end closed connection without response
    
    During handling of the above exception, another exception occurred:
    critical/chats/test_1_1_public_chats.py:286: in test_1_1_chat_non_latin_messages_stack_update_profile_photo
        if not self.chat_1.chat_element_by_text(message).is_element_displayed(10):
    ../views/base_element.py:212: in is_element_displayed
        return self.wait_for_visibility_of_element(sec, ignored_exceptions=ignored_exceptions)
    ../views/base_element.py:137: in wait_for_visibility_of_element
        .until(expected_conditions.visibility_of_element_located((self.by, self.locator)))
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/support/wait.py:86: in until
        value = method(self._driver)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/support/expected_conditions.py:152: in _predicate
        return _element_if_visible(driver.find_element(*locator))
    /home/jenkins/.local/lib/python3.10/site-packages/appium/webdriver/webdriver.py:409: in find_element
        return self.execute(RemoteCommand.FIND_ELEMENT, {'using': by, 'value': value})['value']
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:343: in execute
        response = self.command_executor.execute(driver_command, params)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py:291: in execute
        return self._request(command_info[0], url, body=data)
    /home/jenkins/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py:312: in _request
        response = self._conn.request(method, url, body=body, headers=headers)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/request.py:78: in request
        return self.request_encode_body(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/request.py:170: in request_encode_body
        return self.urlopen(method, url, **extra_kw)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/poolmanager.py:376: in urlopen
        response = conn.urlopen(method, u.request_uri, **kw)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:787: in urlopen
        retries = retries.increment(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/util/retry.py:550: in increment
        raise six.reraise(type(error), error, _stacktrace)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/packages/six.py:769: in reraise
        raise value.with_traceback(tb)
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:703: in urlopen
        httplib_response = self._make_request(
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:449: in _make_request
        six.raise_from(e, None)
    <string>:3: in raise_from
        ???
    /home/jenkins/.local/lib/python3.10/site-packages/urllib3/connectionpool.py:444: in _make_request
        httplib_response = conn.getresponse()
    /usr/lib/python3.10/http/client.py:1374: in getresponse
        response.begin()
    /usr/lib/python3.10/http/client.py:318: in begin
        version, status, reason = self._read_status()
    /usr/lib/python3.10/http/client.py:287: in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
     ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
    



    Device sessions

    3. test_1_1_chat_edit_message, id: 702855

    Device 2: Find Text by xpath: //*[starts-with(@text,'Message before edit 1-1')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']
    Device 2: Tap on found: Text

    critical/chats/test_1_1_public_chats.py:380: in test_1_1_chat_edit_message
        self.chat_2.chat_element_by_text(message_before_edit_1_1).wait_for_status_to_be("Delivered")
    ../views/chat_view.py:240: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's; 
     RemoteDisconnected
    



    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    # STEP: Check that can login with different user
    Device 1: Find Button by accessibility id: show-profiles

    critical/chats/test_public_chat_browsing.py:251: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.sign_in.show_profiles_button.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: Button by accessibility id: `show-profiles` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Device sessions

    2. test_community_discovery, id: 703503

    Device 1: Find Button by accessibility id: communities-home-discover-card
    Device 1: Tap on found: Button

    critical/chats/test_public_chat_browsing.py:40: in test_community_discovery
        self.home.community_card_item.wait_for_visibility_of_element(30)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: BaseElement by accessibility id:`community-card-item` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    3. test_community_undo_delete_message, id: 702869

    Device 1: Tap on found: Button
    Device 1: Find Button by xpath: //*[@text="Undo"]

    critical/chats/test_public_chat_browsing.py:108: in test_community_undo_delete_message
        self.channel.element_by_text("Undo").click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: Button by xpath: `//*[@text="Undo"]` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Device sessions

    Expected to fail tests (3)

    Click to expand

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_pin_messages, id: 702731

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Pin feature is in development]]

    2. test_group_chat_offline_pn, id: 702808

    Device 3: Looking for a message by text: message from old member
    Device 3: Looking for a message by text: message from new member

    critical/chats/test_group_chat.py:323: in test_group_chat_offline_pn
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Messages PN was not fetched from offline 
    

    [[Data delivery issue]]

    Device sessions

    Passed tests (33)

    Click to expand

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    3. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    3. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    4. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    3. test_community_mute_community_and_channel, id: 703382
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495
    Device sessions

    2. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    3. test_group_chat_reactions, id: 703202
    Device sessions

    4. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_message_delete, id: 702839
    Device sessions

    7. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    8. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    9. test_community_message_edit, id: 702843
    Device sessions

    10. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_leave, id: 702845
    Device sessions

    Copy link
    Member

    @smohamedjavid smohamedjavid left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    @OmarBasem - It's not good to hardcode the sheet's animation duration in the children’s view. We should have a ratom in the bottom sheet screen (status-im2.common.bottom-sheet-screen.view ns) and update it on the actual sheet animation completion.

    Also, this lag of scroll would still be present in the list if the user moves from the first tab/category to the last tab/category and tries to close the bottom sheet immediately with the pull-down gesture.

    The ideal solution is to use the window-size prop in the FlatList to limit the number of items rendered off the screen and free up the UI thread if there is any sheet animation is happening.

    https://reactnative.dev/docs/virtualizedlist#windowsize

    We should be using the drag-gesture method to determine if there is any animation happening (probably ratom named sheet-animating?) and updating the ratom. It’s similar to disabling scroll when there is an active animation.

    (defn drag-gesture
    [translate-y opacity scroll-enabled curr-scroll close]
    (->
    (gesture/gesture-pan)
    (gesture/on-start (fn [e]
    (when (< (oops/oget e "velocityY") 0)
    (reset! scroll-enabled true))))
    (gesture/on-update (fn [e]
    (let [translation (oops/oget e "translationY")
    progress (Math/abs (/ translation drag-threshold))]
    (when (pos? translation)
    (reanimated/set-shared-value translate-y translation)
    (reanimated/set-shared-value opacity (- 1 (/ progress 5)))))))
    (gesture/on-end (fn [e]
    (if (> (oops/oget e "translationY") drag-threshold)
    (close)
    (do
    (reanimated/animate translate-y 0 300)
    (reanimated/animate opacity 1 300)
    (reset! scroll-enabled true)))))
    (gesture/on-finalize (fn [e]
    (when (and (>= (oops/oget e "velocityY") 0)
    (<= @curr-scroll (if platform/ios? -1 0)))
    (reset! scroll-enabled false))))))

    then we can pass it to the children just like other props we pass from the parent.

    [content
    {:insets insets
    :close close
    :scroll-enabled scroll-enabled
    :current-scroll curr-scroll
    :on-scroll #(on-scroll % curr-scroll)}]]]]))))

    And use it in the emoji-picker to limit window-size where there is an active animation.

    @OmarBasem
    Copy link
    Contributor Author

    OmarBasem commented Nov 21, 2023

    Hi @smohamedjavid thanks for your review!

    This PR is fixing lagging navigation animation when navigating to the emoji picker. The issue you are describing about scrolling is another problem that I think we need to open an issue for.

    It's not good to hardcode the sheet's animation duration in the children’s view

    I am not hardcoding or changing any animation duration.

    Also, this lag of scroll would still be present in the list if the user moves from the first tab/category to the last tab/category and tries to close the bottom sheet immediately with the pull-down gesture.

    As I described above this issue is not about scrolling or gestures, but the navigation animation. Btw, in case you did not notice the only chagne in this PR is the following line 158
    (rn/use-effect #(js/setTimeout (fn [] (reset! render-emojis? true)) 250)).
    It delays rendering the emojis until the navigation animation is complete.

    @smohamedjavid
    Copy link
    Member

    This PR is fixing lagging navigation animation when navigating to the emoji picker. The issue you are describing about scrolling is another problem that I think we need to open an issue for.

    Oh, I'm sorry. It's not the scroll. It's the same lag that the user experiences when he/she switches to the last tab/category and tries to close the bottom sheet. When the user moves to the last tab/category immediately, the list renders items off the screen and it blocks the UI thread for closing animation of the sheet if the user tries to close it.

    RPReplay_Final1700642657.mov

    It's not good to hardcode the sheet's animation duration in the children’s view

    I am not hardcoding or changing any animation duration.

    I believe the 250ms timeout is correlated with the sheet opening animation duration (300ms). If the sheet's animation duration is changed, we need to update wherever we use this. It's good that we do it in the bottom sheet screen (status-im2.common.bottom-sheet-screen.view ns) as it will act as the single point of truth.

    Also, this lag of scroll would still be present in the list if the user moves from the first tab/category to the last tab/category and tries to close the bottom sheet immediately with the pull-down gesture.

    As I described above this issue is not about scrolling or gestures, but the navigation animation. Btw, in case you did not notice the only chagne in this PR is the following line 158 (rn/use-effect #(js/setTimeout (fn [] (reset! render-emojis? true)) 250)). It delays rendering the emojis until the navigation animation is complete.

    Yes, this solution is fine for now to delay the rendering of the emoji until the opening animation of the sheet is completed. But, we would experience the problems I have described above. The better solution is to update the bottom sheet screen to let the content/children know there is an active animation.

    @OmarBasem
    Copy link
    Contributor Author

    OmarBasem commented Nov 22, 2023

    @smohamedjavid the bottom sheet screen we have is a custom one. The navigation animation is not related to the gesture animation. From inside the bottom sheet screen we can know when a gesture animation is happening, but not for navigation animation (precisely, -- also the problem is local to the emojis screen). The gesture animation performance needs to be improved, but we still would need to delay rendering emojis for the navigation animation to execute smoothly. I have opened an issue #17964

    As for the timeout, the 300ms is the default navigation duration of screen transition in mobile in general. This comes from react-native-navigation, -- it is not hardcoded in our codebase. There would be no reason to change that duration. I can add to the comment mentioned in the code that the 250 is based on the default 300 ms.

    @smohamedjavid
    Copy link
    Member

    Thanks for creating a separate issue @OmarBasem.

    As for the timeout, the 300ms is the default navigation duration of screen transition in mobile in general. This comes from react-native-navigation, -- it is not hardcoded in our codebase. There would be no reason to change that duration. I can add to the comment mentioned in the code that the 250 is based on the default 300 ms.

    Yes, I agree it's the default for navigation transition. We have a 300ms duration in the bottom sheet screen for the opening animation. If we change it, we need to update it in the content/children too.

    (rn/use-effect
    (fn []
    (reanimated/animate translate-y 0 300)
    (reanimated/animate opacity 1 300)))

    Apologies, if I'm not clear earlier 🙏

    @churik churik force-pushed the wallet/emoji-picker-perf branch from d249673 to 05a310f Compare November 24, 2023 11:10
    @churik churik self-assigned this Nov 24, 2023
    @churik
    Copy link
    Member

    churik commented Nov 24, 2023

    @OmarBasem can you please fix lint?

    16:40:35  Formatting required in file src/status_im2/contexts/emoji_picker/view.cljs
    16:40:38  Processed 1561 files, 1 of which requires formatting.
    16:40:38  make: *** [Makefile:314: lint] Error 1
    

    @churik
    Copy link
    Member

    churik commented Nov 24, 2023

    @OmarBasem performance is great in your PR, it is safe to merge as it touches only particular component.

    Ready to merge after fixing Lint.

    @OmarBasem OmarBasem force-pushed the wallet/emoji-picker-perf branch from 05a310f to 3d6f7a3 Compare November 27, 2023 05:31
    @OmarBasem
    Copy link
    Contributor Author

    @OmarBasem performance is great in your PR, it is safe to merge as it touches only particular component.

    Ready to merge after fixing Lint.

    Thank you!

    @OmarBasem OmarBasem merged commit a2856cf into develop Nov 27, 2023
    6 checks passed
    @OmarBasem OmarBasem deleted the wallet/emoji-picker-perf branch November 27, 2023 05:57
    yevh-berdnyk pushed a commit that referenced this pull request Dec 8, 2023
    Wallet: Emoji picker navigation perf
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Emoji Picker - Improve Performance on opening emoji picker
    5 participants