NativeScript / docs-v8

https://docs.nativescript.org
29 stars 42 forks source link

Update svelte.md #101

Closed daveychu closed 1 year ago

daveychu commented 1 year ago

Change to how it's described at https://svelte-native.technology/docs#frame. The original code doesn't seem to work for me:

NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'addEventListener' of undefined

Type 'typeof Home__SvelteComponent_' is not assignable to type 'string'.ts(2322)

cla-bot[bot] commented 1 year ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign the CLA at https://www.nativescript.org/cla. CLA has not been signed by users: @daveychu. After signing the CLA, you can ask me to recheck this PR by posting @cla-bot check as a comment to the PR.

daveychu commented 1 year ago

@cla-bot check

cla-bot[bot] commented 1 year ago

The cla-bot has been summoned, and re-checked this pull request!

rigor789 commented 1 year ago

I don't think this is correct - you are removing the frame with this change... Running the tutorial app seems to work fine with the above: https://github.com/NativeScript/tutorials/blob/main/svelte-tutorial/app/App.svelte

image

daveychu commented 1 year ago

Sorry, the first commit was incomplete.

I compared my repo with the svelte-tutorial repo to see what could be the cause of my problem. It looks like my execution of ns create example-app --svelte created an app.ts with svelteNativeNoFrame rather than svelteNative which doesn't seem to work with the example code.

I honestly just started with SvelteNative/NativeScript so have no idea what the supposed solution is. Someone might want to take a look at this so newcomers don't get stuck like me. Unless it's an error on my part of course, then ignore this PR 😅 .

Edit: The create actually sets up App.svelte like in the new commit (except Home.svelte is in components folder).

rigor789 commented 1 year ago

Good catch on the svelteNativeNoFrame vs svelteNative difference, I think we should update the tutorial to use the defaults from ns create...