Javascript 反应本机抽屉菜单:找不到变量样式
我正在尝试用模块创建一个滑块菜单。安装模块后。获取错误:找不到变量样式。这是从示例中复制的代码:Javascript 反应本机抽屉菜单:找不到变量样式,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我正在尝试用模块创建一个滑块菜单。安装模块后。获取错误:找不到变量样式。这是从示例中复制的代码: import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { Provider } from 'react-redux' import'../I18n/I18n.js'; import RootContainer from './RootContainer' import crea
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Provider } from 'react-redux'
import'../I18n/I18n.js';
import RootContainer from './RootContainer'
import createStore from '../Redux'
import Drawer from 'react-native-drawer-menu';
import {Easing} from 'react-native'; // Customize easing function (Optional)
// create store
const store = createStore()
export default class App extends React.Component {
render() {
// prepare your drawer content
var drawerContent = (<View style={styles.drawerContent}>
<View style={styles.leftTop}/>
<View style={styles.leftBottom}>
<View><Text>Drawer Content</Text></View>
</View>
</View>);
var customStyles = {
drawer: {
shadowColor: '#000',
shadowOpacity: 0.4,
shadowRadius: 10
},
mask: {}, // style of mask if it is enabled
main: {} // style of main board
};
return (
<Drawer
style={styles.container}
drawerWidth={300}
drawerContent={drawerContent}
type={Drawer.types.Overlay}
customStyles={{drawer: styles.drawer}}
drawerPosition={Drawer.positions.Right}
onDrawerOpen={() => {console.log('Drawer is opened');}}
onDrawerClose={() => {console.log('Drawer is closed')}}
easingFunc={Easing.ease}
>
<View style={styles.content}>
<Text>{Object.values(Drawer.positions).join(' ')}</Text>
<Text>{Object.values(Drawer.types).join(' ')}</Text>
</View>
</Drawer>
);
}
}
从“React”导入React;
从“react native”导入{样式表、文本、视图};
从“react redux”导入{Provider}
导入“../I18n/I18n.js”;
从“./RootContainer”导入RootContainer
从“../Redux”导入createStore
从“反应本机抽屉菜单”导入抽屉;
从“react native”导入{Easing};//自定义缓解功能(可选)
//创建存储
const store=createStore()
导出默认类App扩展React.Component{
render(){
//准备抽屉里的东西
var抽屉内容=(
抽屉内容
);
var customStyles={
出票人:{
阴影颜色:“#000”,
阴影不透明度:0.4,
阴影半径:10
},
掩码:{},//掩码的样式(如果已启用)
main:{}//主板的样式
};
返回(
{console.log('Drawer is opened');}
onDrawerClose={()=>{console.log('Drawer is closed')}
easingFunc={Easing.ease}
>
{Object.values(Drawer.positions).join('')}
{Object.values(Drawer.types).join('')}
);
}
}
如果我从代码中删除了变量,那么幻灯片菜单可以工作,但看起来非常糟糕
你认为我应该自己创造菜单的风格,还是应该从某处导入?如果我必须创建它,我如何知道它使用了哪些参数?还是普通视图?看起来您必须自己添加样式,才能使look Drawer内容完全符合您的需要。要实现它,你必须创造 您可以使用answer来获取有关React本机样式表属性的更多信息(它与css非常相似) 同样,抽屉式回购的例子可能是 干杯