Open thitemple opened 5 years ago
Cc @alfonsogcnunez
Thiago Temple notifications@github.com schrieb am Di., 14. Aug. 2018, 20:56:
Hey there, I'm trying to work with some animation stuff and I'm having some difficulties. You may have seen my PR alread https://github.com/fable-compiler/fable-react-native/pull/36 but I do have another issue that I'd like to understand how to fix it.
The interface IViewProperties inherits from IGestureResponderHandlers
And I was wondering how I could pass it to the view. I began creating an object:
let panResponderConfig = createEmpty
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}>....
How can I replicate JavaScript's spread operator and how can I pass that to IViewProperties?
Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fable-compiler/fable-react-native/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNCXSx6Ypi_lDKcIMRFpk-xxI9f5Cks5uQx1TgaJpZM4V8_iC .
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)
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 fromIGestureResponderHandlers
https://github.com/fable-compiler/fable-react-native/blob/143d057d002bb463179da191b67ba522413919d6/src/Fable.Helpers.ReactNative.fs#L427
And I was wondering how I could pass it to the view. I began creating an object:
But then, how am I suppose to pass
panResponder.panHandlers
to the view?Usually with javascript this is done this way:
How can I replicate JavaScript's spread operator and how can I pass that to
IViewProperties
?Thanks