-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenjiRootView.js
42 lines (39 loc) · 1.21 KB
/
genjiRootView.js
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
34
35
36
37
38
39
40
41
42
import React, { Component } from 'react'
import {View} from 'react-native'
import { Provider } from 'react-redux'
import {Modal, Provider as AntProvider} from '@ant-design/react-native'
export const GenjiContext = React.createContext({})
export default class GenjiRootView extends Component {
constructor (props) {
super(props)
this.state = {
visible: false
}
this.props.genji._modalState.set(this.props.partTag, (visible) => {
this.setState({ visible })
})
}
render () {
// 子组件显示滞后,所以注册后移了,现在就是 undefined
const genjiNavigation = this.props.genji._genjiNavigationMap.get(this.props.partTag)
const store = this.props.genji.getStore()
return (
<Provider store={store}>
<AntProvider>
<GenjiContext.Provider value={genjiNavigation}>
{this.props.children}
</GenjiContext.Provider>
<Modal
closable
maskClosable
animateAppear='fade'
transparent={false}
visible={this.state.visible}
>
<View style={{flex: 1, backgroundColor: 'red'}} />
</Modal>
</AntProvider>
</Provider>
)
}
}