react-jsbox
Advanced tools
Comparing version 0.0.19 to 0.0.20
{ | ||
"name": "react-jsbox", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "A Custom React Renderer for writing JSBox apps in React.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -394,63 +394,22 @@ # react-jsbox-renderer | ||
import rootContainer from './Containers/root' | ||
import useMotion from './hooks/useMotion' | ||
const {width, height} = $device.info.screen | ||
// Create React Components: | ||
class App extends React.PureComponent { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
count: 0 | ||
} | ||
this._listTemplate = { | ||
props: { | ||
bgcolor: $color('#fff') | ||
}, | ||
views: [ | ||
{ | ||
type: 'label', | ||
props: { | ||
bgcolor: $color('#474b51'), | ||
textColor: $color('#abb2bf'), | ||
align: $align.center, | ||
font: $font('iosevka', 24) | ||
}, | ||
layout: $layout.fill | ||
} | ||
] | ||
} | ||
} | ||
const App = () => { | ||
const [state] = useMotion() | ||
render() { | ||
return ( | ||
<view frame={styles.container}> | ||
<label | ||
frame={styles.text} | ||
align={$align.center} | ||
font={$font('ArialRoundedMTBold', 26)} | ||
text={String(this.state.count)} | ||
autoFontSize={true} | ||
/> | ||
<list | ||
frame={styles.list} | ||
scrollEnabled={false} | ||
radius={10} | ||
bgcolor={$color('#ededed')} | ||
data={['INCREASE', 'DECREASE', 'RESET']} | ||
template={this._listTemplate} | ||
events={{ | ||
didSelect: (sender, {row}, data) => | ||
this.setState({ | ||
count: this.state.count + [1, -1, -this.state.count][row] | ||
}) | ||
}} | ||
/> | ||
</view> | ||
) | ||
} | ||
return ( | ||
<view frame={styles.container}> | ||
<text | ||
frame={styles.container} | ||
font={$font(12)} | ||
text={JSON.stringify(state, null, 2)} | ||
autoFontSize={true} | ||
/> | ||
</view> | ||
) | ||
} | ||
let styles = { | ||
container: $rect(0, 0, width, height - 40), | ||
text: $rect(0, 64, width, 30), | ||
list: $rect(0, (height - 40) * 0.3, width, 132) | ||
container: $rect(0, 0, width, height - 40) | ||
} | ||
@@ -457,0 +416,0 @@ |
import View from './Components/View' | ||
import warn from 'warning' | ||
import { filterProps, emptyObject, now, debug } from './helper' | ||
@@ -4,0 +3,0 @@ |
Sorry, the diff of this file is too big to display
95850
596
422