Comments (6)
you sure the create block is not called - it works for me :/
from render.
Yeah, I put a print statement in there to check it for sure. I got nothing printed to the console. I reverted the framework to the previous update and it worked as expected. I haven't encountered this issue before the recent update. I will test again in the sample code that I shared with you earlier.
from render.
that's really weird - I'm on HEAD right now and the creation closure seems to be invoked all of the time.
from render.
What is really strange is that it only stopped working in my card component, but it seems to work everywhere else.
import Foundation
import UIKit
import Render
struct CardState: State {
var id: String = "Card"
var feature: NodeType = layoutBuilder("")
var titlebar: NodeType = layoutBuilder("")
var cardSize: CGFloat = 1
var layoutAs: String = "layer"
}
class CardComponent: ComponentView<CardState> {
required init() {
super.init()
self.state = CardState()
self.defaultOptions = [.preventViewHierarchyDiff]
}
required init?(coder aDecoder: NSCoder) {
fatalError("Not supported")
}
override func render() -> NodeType {
let card = Node<UIView>(key: state.id,
create: {
let cardView = UIView()
ComponentAnimation.springOn(view: cardView)
return cardView
}) { (view, layout, size) in
let componentSize = self.getSize()
// Add shadow
view.layer.shadowColor = UIColor.black.cgColor
view.layer.shadowOpacity = 0.5
view.layer.shadowOffset = CGSize.init(width: 2, height: 2)
view.layer.shadowRadius = 2
// Perform layout
layout.width = componentSize.width
layout.height = componentSize.width * CardSize.Proportion
configs[self.state.layoutAs]!(layout)
//layout.paddingTop = 6
}
// A content view that clips its contents
let content = Node<UIView> { (view, layout, size) in
let componentSize = self.getSize()
view.isUserInteractionEnabled = true
view.onTap { _ in mainStore.dispatch(ContextActionRemove(sender: view))}
view.layer.cornerRadius = componentSize.width * CardSize.CornerRadiusRatio
view.clipsToBounds = true
layout.percent.width = 100%
layout.percent.height = 100%
layout.alignContent = .center
}
return card.add(children: [ content.add(children: [
state.feature, state.titlebar
])
])
}
private func getSize() -> CGSize {
let componentWidth = (UIScreen.main.bounds.size.width * self.state.cardSize)
return CGSize(width: componentWidth, height: componentWidth * CardSize.Proportion)
}
}
from render.
Well, I tried putting a reuseIdentifer: "card"
before the key:
and then the card started behaving as usual and called the create:
block correctly. If I remove the reuseIdentifer:
again it stops calling the create block. I guess I'm still a bit unclear the difference between key:
and the reuseIdentifier
.
from render.
from render.
Related Issues (20)
- What happened to ComponentCollectionViewCell? HOT 1
- Classic Version does not compile on clean CocoaPods install HOT 2
- No control over a ComponentView's contentView HOT 1
- UICollectionView support? HOT 2
- Updating a panning view fails to HOT 4
- RenderNeutrino issue with cacaopod headers(device) HOT 1
- Question: why is .flexibleHeight a default for non-scrolling UIComponentViewControllers? HOT 2
- Question: optimisation of the render cycle for stateless components HOT 3
- Carthage support broken since version 5.2
- AppKit Support? HOT 3
- Struct vs Class for UIProps/UIState HOT 1
- Use of _kvcKeyPathString for the identifier in AnyKeyPath extension HOT 2
- REQUEST: Simple Example of how to use CollectionViews with Render Neutrino?
- Write documentation.
- Is Render cross-platform?
- Build List component.
- Ensure RenderInspector works with Neutrino.
- Build more examples in the catalog.
- Port Documentation. HOT 5
- Neutrino: table component layout performance HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from render.