You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 12, 2020. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So this would take these realllllllly weird bits of a constructor: this.func_name = this.func_name.bind(this) and turns them into normal functions using class instance fields. This comes in with React Native in the form of class-properties-transform. It means that you replace it with
func_name=()=>{
...
}
whereas it used to be func_name(){ ... }. The => will rebind the this for you. Seems to work, at least a bunch of functions (like tabbing) seems to have not broken. Blog post on the topic.
TODO:
Decide on what to do with ensuring RN / R are in the flow/typescript types database.
The decision here is that we would have to put a 5k file in that needs updating whenever react/react-native update.
The one thing I will note about those class properties is that, iirc, they are ES7 features and thus highly experimental, so we night need to have to change all our source in the future. Iโm ok with it, though, just an FYI.
Feedback addressed, gonna see what happens WRT the typings for react/react native - currently it should make it automatically work for everyone rather than requiring some extra work
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does two major things:
and one semi-major thing.
So this would take these realllllllly weird bits of a constructor:
this.func_name = this.func_name.bind(this)
and turns them into normal functions using class instance fields. This comes in with React Native in the form of class-properties-transform. It means that you replace it withwhereas it used to be
func_name(){ ... }
. The=>
will rebind thethis
for you. Seems to work, at least a bunch of functions (like tabbing) seems to have not broken. Blog post on the topic.TODO:
The decision here is that we would have to put a 5k file in that needs updating whenever react/react-native update.
As ever, I've been documenting all this stuff in the
vscode.md
file. You can read the version while this PR is open here: https://github.com/artsy/emission/blob/flow/docs/vscode.md