-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore: migrate NewServerView to hooks #5919
base: develop
Are you sure you want to change the base?
Conversation
5c776db
to
7fdf956
Compare
7fdf956
to
1538871
Compare
203b7ad
to
9178ada
Compare
9178ada
to
825b054
Compare
@@ -67,8 +67,7 @@ const ServerInput = ({ | |||
/> | |||
{focused && serversHistory?.length ? ( | |||
<View | |||
style={[styles.serverHistory, { backgroundColor: themes[theme].surfaceRoom, borderColor: themes[theme].strokeLight }]} | |||
> | |||
style={[styles.serverHistory, { backgroundColor: themes[theme].surfaceRoom, borderColor: themes[theme].strokeLight }]}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useTheme
@@ -0,0 +1,51 @@ | |||
import { useLayoutEffect, useState } from 'react'; | |||
import { Q } from '@nozbe/watermelondb'; | |||
import { sanitizeLikeString } from '@nozbe/watermelondb/QueryDescription'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { sanitizeLikeString } from '../../lib/database/utils';
} | ||
}; | ||
|
||
useLayoutEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect
connecting: state.server.connecting | ||
})); | ||
|
||
const [text, setText] = useState<string>(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ref
dispatch(inviteLinksClear()); | ||
if (previousServer) { | ||
dispatch(selectServerRequest(previousServer)); | ||
} | ||
}; | ||
|
||
handleNewServerEvent = (event: { server: string }) => { | ||
const handleNewServerEvent = (event: { server: string }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useCallback
this.setState({ connectingOpen: false }); | ||
useLayoutEffect(() => { | ||
EventEmitter.addEventListener('NewServer', handleNewServerEvent); | ||
BackHandler.addEventListener('hardwareBackPress', handleBackPress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useCallback
const { dispatch } = this.props; | ||
|
||
this.setState({ connectingOpen: false }); | ||
useLayoutEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect
chooseCertificate={chooseCertificate} | ||
handleRemove={removeCertificate} | ||
previousServer={previousServer} | ||
theme={theme} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useTheme
|
||
import { serializeAsciiUrl } from '../../../lib/methods'; | ||
|
||
const completeUrl = (url: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write unit tests
Proposed changes
MIgrate the NewServerView code from class components to function component.
Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-18
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments