Giter Club home page Giter Club logo

Comments (8)

janaagaard75 avatar janaagaard75 commented on July 23, 2024 3

I found two issues, and fixing these made the app load in iOS Simulator. Let me know if this also works for you, so that I can close this issue.

  1. Missing packagerOpts in app.json, i.e.
"packagerOpts": {
  "sourceExts": [
    "ts",
    "tsx"
  ],
  "transformer": "node_modules/react-native-typescript-transformer/index.js"
}
  1. You have to use Expo's version of React Native, so change the react-native dependency in package.json to
"react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz"

from expo-and-typescript.

janaagaard75 avatar janaagaard75 commented on July 23, 2024

I think I've seen a similar error because I forgot that the main component should use export default class on the main component - the rest of them use export default. I might be possible to avoid having to use default by writing App.js a bit differently, but I haven't investigated that.

Regarding the warnings, it would certainly be a big help, if you uploaded a the project to GitHub. I haven't seen these before, and my guess is that it's a simple syntax typo in app.json.

from expo-and-typescript.

Rolandisimo avatar Rolandisimo commented on July 23, 2024

First of all, Merry Christmas! :)
Secondly, here's the branch https://github.com/Rolandisimo/habits/tree/migrate-to-ts

Please check it out, whenever you have time

from expo-and-typescript.

Rolandisimo avatar Rolandisimo commented on July 23, 2024

Great! It works perfectly now. Really appreciate the help. :)

Could you please clarify why the expos version of react native is required?
Cheers!

from expo-and-typescript.

Elijen avatar Elijen commented on July 23, 2024

I've used this repo as a template and having the exact same problem but don't have missing packagerOpts or wrong react-native dependency.

I am using Expo SDK v25.0.0 though. Is there anything obvious I can try to check? Do I have to somehow manually run TS compiler (thought that's what the transformer does).

How are you guys running the app? I am using exp start.

from expo-and-typescript.

janaagaard75 avatar janaagaard75 commented on July 23, 2024

@Elijen: No, you don't have to manually run the TypeScript compiler. I am running the app using the Expo XDE because I find that the easiest way to launch the iOS Simulator, and I haven't tried this app using the command line.

I do however get a long list of these errors if I run yarn upgrade, so if you're install the packages with npm, that might not work, because you're getting newer versions of the dependencies' dependencies.

node_modules/@types/react-navigation/node_modules/@types/react/index.d.ts(3756,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes, HTMLAnchorElement>'.

I'll try to upgrade the app to the newest versions of the packages, including Expo 25. At the bottom of this blog post there is a detailed description of how to upgrade: https://blog.expo.io/expo-sdk-v25-0-0-is-now-available-714d10a8c3f7.

from expo-and-typescript.

Elijen avatar Elijen commented on July 23, 2024

@janaagaard75 Thanks, I've made it work after a long time of debugging. One of the problems was wrong app.json (not sure why exp didn't throw a warning that some options are unrecognized).

Expo 25 seems to work fine. Here's the repo: https://github.com/Elijen/react-native-web-stack

from expo-and-typescript.

janaagaard75 avatar janaagaard75 commented on July 23, 2024

Great. I just updated this project to Expo 25, so that hopefully others won't run into the same issue as you.

from expo-and-typescript.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.