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

[IMPROVEMENT] Change bottom sheet lib #847

Conversation

IlarionHalushka
Copy link
Contributor

@RocketChat/ReactNative
Closes #759

This PR aims to replace Action Sheet with Reanimated Bottom Sheet on message actions.

As you could notice I am not a great designer so suggestions are welcome :)
big screen Iphone X:
image

small screen Iphone SE:
image

@diegolmello
Copy link
Member

@IlarionHalushka Cool!!
We're not trying to copy Slack, but here's how they do it:

The idea is to show an amount of items and let the user swipe up if he wants to show the rest.
Also add the icons on the left.

For small screens: the tallest person in the world can have the smallest device, so he still needs a way to tap on the buttons :)
Leave the buttons in the same size and don't worry about it for now.

@diegolmello
Copy link
Member

@IlarionHalushka this is how our design looks like for commands, autocomplete, etc:

Use your lib with our design and you're fine :)

@IlarionHalushka
Copy link
Contributor Author

I updated the styles and added close on click-out.

When Longpress performed on message:
image

When user scrolled the bottom action sheet from bottom to top:
image

@diegolmello
Copy link
Member

@IlarionHalushka Looking so much better already!
Fix android build and I'll do a review.

@IlarionHalushka
Copy link
Contributor Author

Copy link
Member

@diegolmello diegolmello left a comment

Choose a reason for hiding this comment

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

I tested locally on iOS and this PR is becoming "better and better" really :)
I'm missing this in Messagebox's autocomplete.

getPermalink = async(message) => {
try {
return await RocketChat.getPermalink(message);
} catch (error) {
return null;
}
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary semicolons in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

const { actionsHide } = this.props;
actionsHide();
hideActionSheet() {
this.bottomSheetRef.current.snapTo(hiddenBottomSheet);
Copy link
Member

Choose a reason for hiding this comment

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

When swiping to close RoomView on iOS:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

render() {
return (
null
<BottomSheet
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately the bottomsheet doesn't have function onPositionChange or something similar, but I did manage to do backdrop using Animated.Code

@@ -131,6 +130,8 @@ export default class RoomView extends LoggedView {
} else {
EventEmitter.addEventListener('connected', this.handleConnected);
}

navigation.addListener('willBlur', () => this.hideActionSheet());
Copy link
Member

Choose a reason for hiding this comment

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

I think this is not needed as RoomView will be removed from the stack, but test it.

If it's necessary, check if it's opened and move it to componentWillUnmount.
This is similar to editCancel and replyCancel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's necessary, because when I open Bottom Action Sheet in RoomView and then go to Threads Single View (thread chat) then ActionSheet is still displayed there and same happens when changing RoomViews(chats)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And also I tried to move it to componentWillUnmount but as we use StackNavigator - the view in not unmounted when opening Threads View or Settings view and bottom sheet stays constantly opened.

@@ -1684,20 +1693,32 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
Copy link
Member

Choose a reason for hiding this comment

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

I think you all these CLANG* are from your Xcode setup and shouldn't be commited.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed in latest commit

{room._id && showActions
? <MessageActions room={room} user={user} />
{room._id
? <MessageActions room={room} user={user} setRef={ref => this.setRef(ref)} />
Copy link
Member

Choose a reason for hiding this comment

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

Creating arrow functions on render is a bad practice and it should be avoided.
This creates functions on every render.

You should always be using the class function directly like this:
setRef={this.setRef}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did bind this.setRef and then used like you suggested setRef={this.setRef}

@@ -22,6 +22,7 @@
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24A2AEF2383D44B586D31C01 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 06BB44DD4855498082A744AD /* libz.tbd */; };
2C800DF680F8451599E80AF1 /* libSafariViewManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3BB00B9ABF44EA9BD71318 /* libSafariViewManager.a */; };
3EAC15CC2271955100AD43B2 /* libRNReanimated.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EAC15CB2271937800AD43B2 /* libRNReanimated.a */; };
Copy link
Member

Choose a reason for hiding this comment

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

Am I wrong or did you tried to add reanimated from imports and from pods?
If I'm right, it's just a matter of changing Podfile and lines like this one is trash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did link the library manually using Xcode, but not sure what all these lines are about... :(

android/app/build.gradle Show resolved Hide resolved
- remove unnecessary changes in IOS xcode files;
- fix bug: 'When swiping to close RoomView on iOS';
- add backdrop;
- bind 'this.setRef' so that function is not created on every render;
@pranavpandey1998official
Copy link
Contributor

@IlarionHalushka can you resolve conflicts

@pranavpandey1998official
Copy link
Contributor

pranavpandey1998official commented May 10, 2019

@IlarionHalushka the vibration are setting off immediately after opening the room and not after we long press to open the message action

@pranavpandey1998official
Copy link
Contributor

pranavpandey1998official commented May 10, 2019

In my testing no button work https://drive.google.com/file/d/1k_GCnqwkCICWKUEjbR8iTuyOIpByAPAK/view?usp=sharing

Copy link
Contributor

@pranavpandey1998official pranavpandey1998official left a comment

Choose a reason for hiding this comment

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

I dont think we need the cancel button anymore

Copy link
Contributor

@pranavpandey1998official pranavpandey1998official left a comment

Choose a reason for hiding this comment

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

covers full screen screen in landscape

@pranavpandey1998official
Copy link
Contributor

where did the separator go , It was nice as user was able to distinguish between boundaries of button
WhatsApp Image 2019-05-11 at 6 27 00 PM

@pranavpandey1998official
Copy link
Contributor

its showing start all the time (unstar is not showing up)

@pranavpandey1998official
Copy link
Contributor

pin is not working

@IlarionHalushka
Copy link
Contributor Author

1. covers full screen screen in landscape . fixed
image

2. where did the separator go , It was nice as user was able to distinguish between boundaries of button - fixed.

3. its showing start all the time (unstar is not showing up) - currently I don't have any good idea how to change the titles because the bottomSheet is rendered once when the RoomView is opened.

4. pin is not working - is not connected to BottomSheet, action is called but 400 Not Authorized response is returned from Back-end (same behaviour on current testflight app). Issue

@diegolmello diegolmello changed the title use reanimated bottom sheet instead of action sheet on message actions [IMPROVEMENT] Change bottom sheet lib May 16, 2019
@IlarionHalushka IlarionHalushka self-assigned this May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use reanimated-bottom-sheet
3 participants