Feat: revert FC changes (like the old style).

This commit reverts to the old style of props + FC. The old style is desirable
because people comfortable with react can automatically be comfortable with
dioxus. It's also nice in that the same props can be used to drive two different
components - something the trait version couldn't do. Now, our trait bound forces
implementations to have the #[derive(Props)] flag. This will need to implement the
Properties trait as well as PartialEq (using ptr::equal for closure fields).
This commit is contained in:
Jonathan Kelley committed 2021-03-09 00:58:20 -05:00
1 parent 55a5541dba
commit 7158bc3575
15 files changed
+1339 -137

No files matched your search

+2 -5
View File
@@ -296,10 +296,7 @@ mod vtext {
/// Virtual Components for custom user-defined components
/// Only supports the functional syntax
mod vcomponent {
use crate::{
innerlude::{Context, ScopeIdx},
scope::FC,
};
use crate::innerlude::{Context, Properties, ScopeIdx, FC};
use std::{
any::{Any, TypeId},
cell::RefCell,
@@ -345,7 +342,7 @@ mod vcomponent {
// this lets us keep scope generic *and* downcast its props when we need to:
// - perform comparisons when diffing (memoization)
// -
pub fn new<P: FC + 'static>(comp: P) -> Self {
pub fn new<P: Properties + 'static>(caller: FC<P>, comp: P) -> Self {
todo!()
// let p = Rc::new(props);