f-f / purescript-react-basic-native

Apache License 2.0
60 stars 18 forks source link

update to latest react native #33

Open joprice opened 3 years ago

joprice commented 3 years ago

I noticed there's a branch that updated the react native version. I'm interested in using some new components like Pressable. Can I help out getting that one updated to the latest and releasing?

f-f commented 3 years ago

@joprice can you link to the branch you mention?

joprice commented 3 years ago

I think I jumped to conclusions about the branch: I saw the 0.61.4 branch https://github.com/f-f/purescript-react-basic-native/blob/0.61.4/codegen/package.json, where the last commit is "upgraded to rn 0.6", and I assumed master was on 0.5 still. Still, it does look like the latest react-native is 0.63.4 and Pressable was added 0.63 in https://reactnative.dev/blog/2020/07/06/version-0.63.

f-f commented 3 years ago

I see! My maintenance of this repo is limited to merging PRs, so if you'd like to upgrade I'd happily merge that. It should be enough to run the scripts in the codegen folder after upgrading the version in the package.json there

joprice commented 3 years ago

Ok I'll try that

joprice commented 3 years ago

Looks like a previously unhandled type has been used in the newer definitions:

purescript-react-basic-native/codegen/lib/parser.js:240
        default: throw ("Got a type that I don't know: " + ts.SyntaxKind[type.kind]);
                 ^
Got a type that I don't know: IntersectionType

Looks like it's failing on the following type, which now includes an intersection:

  export type SectionListData<ItemT, SectionT = DefaultSectionT> = SectionBase<ItemT, SectionT> & SectionT;

Whereas in the currently used version it looks like this:

  export interface SectionListData<ItemT> extends SectionBase<ItemT> {
      [key: string]: any;
  }
joprice commented 3 years ago

Just to see the scope of the changes in the latest version, I took the first element of the intersection type: (type as unknown as ts.IntersectionTypeNode).types[0] and recursively called handleTypes with it. That gave me this diff:

https://github.com/f-f/purescript-react-basic-native/compare/master...joprice:update63?expand=1

I noticed a few observations: