-
Notifications
You must be signed in to change notification settings - Fork 17
Add React Native getting started #480
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
Conversation
Codecov Report
@@ Coverage Diff @@
## 7-dev #480 +/- ##
=======================================
Coverage 95.57% 95.57%
=======================================
Files 32 32
Lines 1312 1312
=======================================
Hits 1254 1254
Misses 58 58 Continue to review full report at Codecov.
|
Co-Authored-By: Adrien Maret <amaret93@gmail.com>
); | ||
} else { | ||
return ( | ||
<Login onSubmitName={this.handleSubmitName} /> |
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.
Why not directly pass this.onSubmitName
here?
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.
Because function need to be bounded to the context of this class in order to use the this
keyword inside the login component.
But i agree that this.handleSubmitName = this.onSubmitName.bind(this);
should not be named differently to keep readability of the component. They both should keep the name handleSubmitName
@@ -0,0 +1,149 @@ | |||
/* snippet:start:1 */ |
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.
The indentation of this file is wrong (4 spaces instead of 2)
render() { | ||
const messages = this.state.messages; | ||
return ( | ||
<ChatView messages={messages} onSendMessage={this.handleSendMessage} name={this.props.name} /> |
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.
Same remark, why don't pass directly this.onSendMessage
?
@@ -0,0 +1,135 @@ | |||
/* snippet:start:1 */ |
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.
This file have a wrong indentation (4 spaces instead of 2)
<TextInput | ||
style={styles.inputMessage} | ||
placeholder='Send message...' | ||
onSubmitEditing={this.handleSendMessage} |
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.
Same remark, why don't just pass this.onSendMessage
instead?
@@ -0,0 +1,40 @@ | |||
/* snippet:start:1 */ |
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.
This file have a wrong indentation (4 spaces instead of 2)
); | ||
} else { | ||
return ( | ||
<Login onSubmitName={this.handleSubmitName} /> |
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.
Because function need to be bounded to the context of this class in order to use the this
keyword inside the login component.
But i agree that this.handleSubmitName = this.onSubmitName.bind(this);
should not be named differently to keep readability of the component. They both should keep the name handleSubmitName
<View> | ||
<View> | ||
{ | ||
item.displayDate ? |
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.
This could be written item.displayDate && .... instead of item.displayDate ? ... : null
return ( | ||
<SafeAreaView style={{ flex: 1 }}> | ||
<KeyboardAvoidingView style={styles.container} behavior="padding"> | ||
<FlatList |
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.
For readability purpose you shall put the component inside a dedicated function ?
maybe a function called renderFlatList() {}
Co-Authored-By: Adrien Maret <amaret93@gmail.com>
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.
After the failing test pass, 👍
…etting-started-react-native
What does this PR do?
This PR add the react native getting started project with cypress tests.
Like the others getting started this a simple chat with document create and realtime subscription.
The readme will follow in another PR.
In the screens/Chat/ChatView.js file, each message only display the author, the messge and the hour. The date of the message is displayed once for each message sended on the same date.
I'm not sure about the
⚠️
fetchMessages()
subscribeMessages()
andgetMessage()
functions in screens/Chat/ChatClient.js file because of the little complexity of the code at the top of thegetMessage()
function.It's just used to check on each message if the date need to be displayed by checking the previous date message.
It also decrease the readability of the
render()
function of the screens/Chat/ChatView.js file.Please tell me if you think it's too much for a simple getting started or if I need to simplify it.
How should this be manually tested?
npm i
cd ./doc/7/getting-started/.react-native
npm i
npm run web
In another term from the same folder:
npm run test
(if you have the CYPRESS_RECORD_KEY env variable setted)node_modules/.bin/cypress run
(else)Other changes
/
Boyscout
In test-docs.sh, use
npm install
command instead ofnpm ci
because we must use the builded sdk of this repo instead of the one installed with package.json. (cf: package.json -> scripts -> postinstall)Rename spec files of cypress tests for a better readability on dashboad.cypress.io