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

Working with gestures #37

Open
thitemple opened this issue Aug 14, 2018 · 2 comments
Open

Working with gestures #37

thitemple opened this issue Aug 14, 2018 · 2 comments

Comments

@thitemple
Copy link
Contributor

Hey there, I'm trying to work with some animation stuff and I'm having some difficulties. You may have seen my PR alread but I do have another issue that I'd like to understand how to fix it.

The interface IViewProperties inherits from IGestureResponderHandlers

inherit IGestureResponderHandlers

And I was wondering how I could pass it to the view.
I began creating an object:

let panResponderConfig = createEmpty<Fable.Import.ReactNative.PanResponderCallbacks>
let panResponder = RN.PanResponder.create(panResponderConfig)

But then, how am I suppose to pass panResponder.panHandlers to the view?

Usually with javascript this is done this way:

this._panResponder = PanResponder.create({ .... })
<View {...this._panResponder.panHandlers}>....</View>

How can I replicate JavaScript's spread operator and how can I pass that to IViewProperties?

Thanks

@forki
Copy link
Contributor

forki commented Aug 15, 2018 via email

@alfonsogarciacaro
Copy link
Member

There's no equivalent to the object spread operator in Fable, but you should be able to use Object.assign directly. Apparently there's as a createElementWithObjProps helper in the code that helps you do that (as in here). Haven't tested it but maybe something like this works?

createElementWithObjProps(RN.View, JS.Object.assign(createEmpty<ob>, panResponder.panHandlers)

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

No branches or pull requests

3 participants