-
Notifications
You must be signed in to change notification settings - Fork 29
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
[WIP] Update to Fable 2 #66
base: master
Are you sure you want to change the base?
Conversation
splitter.config.js
Outdated
@@ -17,7 +17,7 @@ module.exports = { | |||
entry: resolve('src/Nightwatch.fsproj'), | |||
outDir: resolve("out"), | |||
babel: { | |||
// presets: [["es2015", { modules: false }]], | |||
plugins: ["@babel/plugin-transform-modules-commonjs"], |
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.
In the example, I have you I use @babel/plugin-transform-modules-commonjs
because it was needed for node.js
support
I don't know, if this is needed for React Native env.
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.
ah ok. let me remove it for now
@forki What are you expecting from me? For me, the diff seems good for an upgrade to Fable 2.1. Do you expect me to build/test the app? |
no I don't. |
You need to start It will start the compiler for you. |
ah cool. that was missing link. trying that now! |
So everything compiles, but react-navigation/react-navigation#2767 (comment) suggest there is some trouble with the import. https://stackoverflow.com/a/47871724/145701 suggests there needs to be some additonal export!? But I don't see what changed. @alfonsogarciacaro any ideas? |
@MangelMaxime I assume we need to "export" Elmish.ReactNative.Components.App somehow!? https://github.com/elmish/react/blob/master/src/react-native.fs#L15 |
elmish/react@c6c15b5#diff-ce3e72f76b021b9de55e8aba30e99cf5R45 looks like @alfonsogarciacaro already fixed something for fable2. how can I test that? |
yes that's the correct change. good work @alfonsogarciacaro |
@forki If I didn't mess up the merge/rebase, I released Fable.Elmish.React 2.2.0 with the fix included. Available when nuget ready. |
I don't understand this comment. Is the fix in Fable.Elmish.React enough or do we still need to do something? |
fix would be enough. let me test the new packge |
Use new elmish
this is how fable did it in 1.x |
Looks like the keyValueProps call is missing. Fable 1 did this implicitly I believe, but in Fable 2 you have to call it explicitly to transform the list into a JS object |
Ah, I think the Style function is wrong, I'll check after coming back from kindergarten |
so we need to update the bindings? |
I think so, in fable-react, We need to do something similar for fable-react-native bindings, for example here: https://github.com/fable-compiler/fable-react-native/blob/e4c666f27dfc1ff77bdbfaa0e899f30dadff2839/src/Fable.Helpers.ReactNative.fs#L531 Because there are many cases accepting type IStyleProps = interface end
let style (props: IStyle seq) = keyValueList CaseRules.LowerFirst props :?> IStyleProps Then change all |
Tbh I don't mind making it breaking (it's already breaking anyway) - I want
it look work as close as possible like React proper.
Alfonso Garcia-Caro <[email protected]> schrieb am Fr., 22. Feb.
2019, 10:44:
… I think so, in fable-react, Style is disguised as a union case, but it's
actually a function that calls keyValueList:
https://github.com/fable-compiler/fable-react/blob/b89835014ae16caec51938ad8337010b36b13613/src/Fable.React/Fable.React.Props.fs#L731-L732
We need to do something similar for fable-react-native bindings, for
example here:
https://github.com/fable-compiler/fable-react-native/blob/e4c666f27dfc1ff77bdbfaa0e899f30dadff2839/src/Fable.Helpers.ReactNative.fs#L531
Because there are many cases accepting IStyle list, if this makes the
bindings too hacky, another solution is to create a function like this:
type IStyleProps = interface end
let style (props: IStyle seq) = keyValueList CaseRules.LowerFirst props :?> IStyleProps
Then change all IStyle list to IStyleProps. The drawback is it forces the
user to call style all the time, but you can turn the function into an
operator like: let (!^) (props: IStyle seq) = ...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNISqEQ9flokMjFB1KxZPfu-HrBLIks5vP7vjgaJpZM4bFKNN>
.
|
let's go with option 1: what do I need to do? |
for testing I added the following to my Fable.Helpers.ReactNative.fs:
and indeed it seems to work if I use that function instead of ImageProperties.Style. so we replace all these union cases with such a function? Is that the idea? |
Ok cool. Will try it and send pull request
Maxime Mangel <[email protected]> schrieb am Fr., 22. Feb. 2019,
14:01:
… @forki <https://github.com/forki> Yes, the idea is to replace the *.Style
to use a similar function.
If the existing DSL used a Style case, you can use a static member and
make it a non breaking change. Example
<https://github.com/fable-compiler/fable-react/blob/62c0c88830c72e11bab32ad9686fb8aa9ef1289a/src/Fable.ReactLeaflet/ReactLeaflet.fs#L472>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNJR9PzuzSoxzlYpl5L9X8j5Jbgi4ks5vP-pDgaJpZM4bFKNN>
.
|
@alfonsogarciacaro @MangelMaxime looks like we actually made it work. Thanks guys! Only issue left is bug in fable splitter: fable-compiler/Fable#1751 |
Major changes: - Upgrade to RN 58.5 - Upgrade the gradle/android project to latest version (seems needed for RN 58.5) - Upgrade to Elmish.HMR 3.2 which fix HMR support for RN - Re-activate the HMR support in the application
Is this work still ongoing? Can we use DotNet 5 and the latest Fable for react-native apps? |
I have a open PR for net5 and Fable 3 |
cc @alfonsogarciacaro @MangelMaxime