我试图以某种方式将这些与示例联系起来:
react-native-drawer 与 react-native-router-flux:遵循本文档: https ://github.com/aksonov/react-native-router-flux/blob/master/docs/OTHER_INFO.md
如何将自定义抽屉放入文件中?
当我尝试这样处理时,我总是会出错:
文件:components/Drawer.js
import Drawer from 'react-native-drawer';
import ControlPanel from './ControlPanel';
import {Actions, DefaultRenderer} from 'react-native-router-flux';
export default class extends Component {
render(){
const state = this.props.navigationState;
const children = state.children;
return (
<Drawer
ref="navigation"
open={state.open}
onOpen={()=>Actions.refresh({key:state.key, open: true})}
onClose={()=>Actions.refresh({key:state.key, open: false})}
type="displace"
content={<SideMenu />}
tapToClose={true}
openDrawerOffset={0.2}
panCloseMask={0.2}
negotiatePan={true}
tweenHandler={(ratio) => ({
main: { opacity:Math.max(0.54,1-ratio) }
})}>
<DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} />
</Drawer>
);
}
}
文件:App.js
import Drawer from './components/Drawer'
我得到这个错误。