-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
34 lines (27 loc) · 812 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {create} from 'hoe'
import {Component} from 'react'
import {AppRegistry} from 'react-native'
import {App, app, AppParams} from './src/components/app/App'
import {consoleLogger} from './src/lib/logger'
class BootstrapComponent extends Component<AppParams, App> {
private e = create((act: any) => {
const nState = app.update(act, this.state)
const cmd = app.command(act, this.state)
consoleLogger({
action: act,
command: cmd,
preState: this.state,
currState: nState
})
console.log(cmd)
this.setState(nState)
})
componentWillMount () {
this.setState(app.init())
}
render () {
const state = this.state as App
return app.view(this.e, state, this.props)
}
}
AppRegistry.registerComponent('reactNativePOC', () => BootstrapComponent)