0.4.0 • Published 8 years ago
react-yue v0.4.0
react-yue
This is a lib to help you render the View of Yue in the react way.
Get Started
npm i react-yue react guiRender your view into a container:
const React = require('react')
const gui = require('gui')
const { render } = require('react-yue')
// Create your react component:
function App() {
return (
<container
style={{
flexDirection: 'row',
flex: 1,
justifyContent: 'center',
}}
>
<label
text="hello"
/>
</container>
)
}
// Create a window and a root container:
const win = gui.Window.create({})
win.setContentSize({ width: 400, height: 250 })
const contentView = gui.Container.create()
contentView.setStyle({ flexDirection: 'row' })
win.setContentView(contentView)
win.center()
win.activate()
// Create your react elements and render them:
render(<App />, contentView)
// Start your app
if (!process.versions.yode) {
gui.MessageLoop.run()
process.exit(0)
}Components
View (base class)
props:
BooleanvisibleBooleanenabledBooleanfocusableBooleanmouseDownCanMoveWindowFontfontColorcolorColorbackgroundColor
events:
- onMouseDown
- params
Viewself
- params
- onMouseUp
- params
ViewselfMouseEventevent
- params
- onMouseMove
- params
ViewselfMouseEventevent
- params
- onMouseEnter
- params
ViewselfMouseEventevent
- params
- onMouseLeave
- params
ViewselfMouseEventevent
- params
- onKeyDown
- params
ViewselfKeyEventevent
- params
- onKeyUp
- params
ViewselfKeyEventevent
- params
- onSizeChanged
- params
ViewselfKeyEventevent
- params
- onCaptureLost
- params
ViewselfKeyEventevent
- params
Button
props:
Button::TypetypeBooleandefaultCheckedStringtitleImageimage
events:
- onClick(self)
- params
Buttonself
- params
Container
events:
- onDraw(self, painter, painter)
- params
ContainerselfPainterpainter - The drawing context of the view.RectFdirty - The area in the view to draw on.
- params
Entry
props:
Entry::TypetypeStringtext
events:
- onTextChange(self)
- params
Entryself
- params
- onActivate(self)
- params
Entryself
- params
Group
props:
StringtitleViewchildren
Label
props:
Stringtext
ProgressBar
props:
NumberpercentBooleanindeterminate
Scroll
props:
Scroll::PolicyhpolicyScroll::PolicyvpolicyBooleanoverlayScrollbarSizeF sizecontentSizeViewchildren
TextEdit
props:
StringtextScroll::PolicyhpolicyScroll::PolicyvpolicyBooleanoverlayScrollbar
events:
- onTextChange(self)
- params
TextEditself
- params
Vibrant
props:
Vibrant::MaterialmaterialVibrant::BlendingModemode
Run Tests
npm run test