Skip to content

reason-react-native: add example for ScrollView scrollTo method #577

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

Merged
merged 5 commits into from
Aug 28, 2019

Conversation

MoOx
Copy link
Member

@MoOx MoOx commented Aug 20, 2019

totally wip but better than nothing?

@MoOx
Copy link
Member Author

MoOx commented Aug 23, 2019

I used a switch for the example.

Btw, I noticed that scrollTo have scrollToParams & that scrollToEndWithOptions have scrollToEndOptions. What do you think about normalising naming with Params or Options (& same for similar places?).

@cknitt @sgny We could normalize & deprecate with warnings & remove deprecating warning in next major release?

@cknitt
Copy link
Member

cknitt commented Aug 23, 2019

I think I used the different names on purpose. In the case of scrollTo, we have a required params object (similar to the props object of a React component). In the case of scrollToEnd, we have an optional options object that may be supplied as an additional parameter to override some default values.

Not sure if this is consistent across the code though...

@MoOx
Copy link
Member Author

MoOx commented Aug 26, 2019

@cknitt I just find confusing the 2 namings. I get the idea.
But maybe we could stick to Option, since we might have xxx & xxxWithOptions ? (and xxxOptions would be the method to generate options).
Not sure if naming things option/param/argument are really different & clear for users. We should imo keep one & stick to it.

@sgny any comment?

@cknitt
Copy link
Member

cknitt commented Aug 27, 2019

I am open to changing these method args from "params" to "options".

Callback params like VirtualizedList.onEndReachedParams would remain as they currently are though, right?

@sgny
Copy link
Collaborator

sgny commented Aug 27, 2019

I think the function name should remain scrollToEndWithOptions as that is consistent across the various modules. However, the optional argument could be renamed scrollToEndParams which would be more consistent with scrollParams and still be a reasonable name for what it is.

@cknitt
Copy link
Member

cknitt commented Aug 27, 2019

I find scrollToEndWithOptions with scrollToEndParams even more confusing.

I'd expect xxxWithYyy to take a yyy param...

@MoOx
Copy link
Member Author

MoOx commented Aug 28, 2019

I would go for just ditching one & keep only the other for simplicity.
Ditch "Params" & use "Options" everywhere. Or the opposite.
Having this kind of naming is anyway "confusing" somehow, so we should just have one.
Migration won't be a problem: we can deprecate call easily, people will have warnings, & next major release we remove them.

@cknitt
Copy link
Member

cknitt commented Aug 28, 2019

If we want to unify this, I am for "Options" everywhere.

@MoOx MoOx merged commit 4049d95 into master Aug 28, 2019
@MoOx MoOx deleted the scrolltoexample branch August 28, 2019 08:33
@sgny
Copy link
Collaborator

sgny commented Aug 28, 2019

How about instead of withOptions we use withOptional (or withOptionals)? Then we could have optional parameters or configs without causing much confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants