1

我尝试了几乎在这里找到的解决方案,我发现这个链接包含一个关于使用 RNRF 抽屉功能和 redux 的教程:https ://github.com/aksonov/react-native-router-flux/blob/master/docs/OTHER_INFO .md 但链接不再有效,有人可以帮我吗?

这是我的 Router.js

import React from 'react';
import { Scene, Router } from 'react-native-router-flux';
import HomeScreen from './screens/HomeScreen';
import LandingScreen from './screens/LandingScreen';
import ProfileScreen from './screens/ProfileScreen';
import EmailLoginScreen from './screens/EmailLoginScreen';
import FacebookLoginScreen from './screens/FacebookLoginScreen';
import SideMenu from './screens/SideMenu';

const RouterComponent = () => {
  return (
    <Router>
    <Scene overlay>
     <Scene key="lightbox" lightbox leftButtonTextStyle={{ color: 'green' }} backButtonTextStyle={{ color: 'red' }} initial>
      <Scene key="root">
        <Scene key='landing' component={LandingScreen} hideNavBar={true} initial  />
        <Scene key='fbLogin' component={FacebookLoginScreen} hideNavBar={true}  />
        <Scene key='emailLogin' component={EmailLoginScreen} title="Email Login"  />

        <Scene key='drawer' drawer contentComponent={SideMenu} title="Menu" >
          <Scene key='home' component={HomeScreen}   />
          <Scene key='profile' component={ProfileScreen} title="My Profile"  />
        </Scene>

      </Scene>
    </Scene>
    </Scene>
    </Router>
  );
};


export default RouterComponent;

这是我的 SideMenu.js:

import React, { Component, PropTypes } from 'react';
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
import { connect } from 'react-redux';
import { Actions } from 'react-native-router-flux';
import Button from 'react-native-button';
import { CardSection } from '../components/CardSection';

const contextTypes = {
  drawer: React.PropTypes.object,
};

const propTypes = {
  name: PropTypes.string,
  sceneStyle: ViewPropTypes.style,
  title: PropTypes.string,
};

const styles = StyleSheet.create({
  viewContainer: {
    flex: 1,
    backgroundColor: '#fff'
  },
  container: {
    padding: 15,
    height: 45,
    overflow: 'hidden',
    alignSelf: 'flex-start',
  },
  textStyle: {
    fontSize: 18,
    color: '#555',
  },
  nameContainer: {
    padding: 15,
    height: 45,
    overflow: 'hidden',
    alignSelf: 'flex-start',
  },
  name: {
    fontSize: 22,
    color: '#555',
    fontWeight: '400',
  }
});

class SideMenu extends Component {
  render() {
    return (
      <View style={[styles.viewContainer, this.props.sceneStyle]}>

      <CardSection style={{ flexDirection: 'column', padding: 30 }}>
        <Button
          containerStyle={styles.container}
          style={styles.name}
          onPress={() => { Actions.home(); }}
        >Home</Button>
      </CardSection>

        <CardSection style={{ flexDirection: 'column', padding: 30 }}>
          <Button
            containerStyle={styles.container}
            style={styles.name}
            onPress={() => { Actions.profile(); }}
          >Profile</Button>
        </CardSection>
      </View>
    );
  }
}

SideMenu.contextTypes = contextTypes;
SideMenu.propTypes = propTypes;

export default SideMenu;

错误: 调试器错误

4

0 回答 0