DioxusLabs / example-projects

Featured Dioxus projects on how to build clean user interfaces in Rust
491 stars 62 forks source link

Various issues with getting examples to run #2

Open InfiniteRain opened 2 years ago

InfiniteRain commented 2 years ago

So, while trying to get any example to work, I've met the following issues:

  1. Already reported in one of the other issues, but the dioxus dependency references an invalid relative path.
  2. ios_demo seems to be referencing invalid API. Seems to me like it's been developed during early stages of development and is not compatible with the version 1.0. I get a ton of different compile time errors while trying to compile:
❯ cargo build
   Compiling dioxus-ios-demo v0.1.0 (/Users/dlossenko/projects/example-projects/ios_demo)
error: expected item, found `;`
   --> src/lib.rs:124:2
    |
124 | };
    |  ^ help: remove this semicolon

error: macro expansion ignores token `compile_error` and any following
   --> src/lib.rs:83:26
    |
79  |       cx.render(rsx!{
    |  _______________-
80  | |         section { class: "todoapp"
81  | |             style { {[include_str!("./style.css")]} }
82  | |             div {
83  | |                 header { class: "header"
    | |                          ^^^^^
...   |
122 | |         }
123 | |     })
    | |     -- help: you might be missing a semicolon here: `;`
    | |_____|
    |       caused by the macro expansion here
    |
    = note: the usage of `rsx!` is likely invalid in expression context

error: This attribute is misisng a trailing comma
  --> src/lib.rs:80:19
   |
80 |         section { class: "todoapp"
   |                   ^^^^^

error: macro expansion ignores token `compile_error` and any following
   --> src/lib.rs:142:19
    |
140 |       cx.render(rsx!{
    |  _______________-
141 | |         li { class: "{completed}"
142 | |             div { class: "view"
    | |                   ^^^^^
143 | |                 input { class: "toggle" r#type: "checkbox" id: "cbg-{todo.id}" checked: "{todo.checked}"
...   |
165 | |         }
166 | |     })
    | |     -- help: you might be missing a semicolon here: `;`
    | |_____|
    |       caused by the macro expansion here
    |
    = note: the usage of `rsx!` is likely invalid in expression context

error: This attribute is misisng a trailing comma
   --> src/lib.rs:141:14
    |
141 |         li { class: "{completed}"
    |              ^^^^^

error[E0425]: cannot find function `use_provide_state` in this scope
  --> src/lib.rs:29:5
   |
29 |     use_provide_state(cx, || Todos::new());
   |     ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `use_shared_state` in this scope
  --> src/lib.rs:37:17
   |
37 |     let todos = use_shared_state::<Todos>(cx)?;
   |                 ^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `FC` in this scope
   --> src/lib.rs:131:19
    |
131 | static TodoEntry: FC<TodoEntryProps> = |(cx, props)| {
    |                   ^^ help: a trait with a similar name exists: `Fn`
    |
   ::: /Users/dlossenko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:1
    |
67  | pub trait Fn<Args>: FnMut<Args> {
    | ------------------------------- similarly named trait `Fn` defined here

error[E0425]: cannot find function `use_shared_state` in this scope
   --> src/lib.rs:132:17
    |
132 |     let todos = use_shared_state::<Todos>(cx)?;
    |                 ^^^^^^^^^^^^^^^^ not found in this scope

Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `dioxus-ios-demo` due to 9 previous errors
  1. Other projects I tried seems to have similar issues when I try to run them on mobile (like the dog-app exits with a compile error in one of the dependencies after I ran cargo mobile init on it and fixed the cargo.toml file.)

It would be much appreciated if you guys tried to run all these examples yourselves and fixed the issues.

InfiniteRain commented 2 years ago

Also, whenever I try to fetch with the mobile feature, it tells me that the feature doesn't exist:

error: failed to select a version for `dioxus`.
    ... required by package `dioxus v0.1.0 (/Users/dlossenko/projects/dioxus)`
versions that meet the requirements `^0.1.6` are: 0.1.6

the package `dioxus` depends on `dioxus`, with features: `mobile` but `dioxus` does not have these features.

failed to select a version for `dioxus` which could resolve this conflict