Giter VIP home page Giter VIP logo

Comments (5)

Ashoat avatar Ashoat commented on May 2, 2024 2

#44 (comment) <--- this might be helpful

from redux-helpers.

Rafayel777 avatar Rafayel777 commented on May 2, 2024

+1
any updates ?

from redux-helpers.

Ashoat avatar Ashoat commented on May 2, 2024

Your code doesn't even seem to use the component reduxifyNavigator returns?

If you think you have an actual bug, please create an Expo Snack demonstrating the issue, and I can investigate.

from redux-helpers.

realironnam avatar realironnam commented on May 2, 2024

@Ashoat sorry for my bad example.
I fixed by follow your comment #44
my working code

// Setup navigator
const MainStack = createStackNavigator(routesConfig);
const Drawer = createDrawerNavigator(
  {
    Main: { screen: MainStack }
  },
  {
    contentComponent: NavigationDrawer
  }
);

export const AppNavigator = createStackNavigator(
  {
    Splash: {
      screen: SplashScreen,
      description: "Loading screen"
    },
    Drawer: {
      screen: Drawer,
      description: "main drawer"
    }
  },
  {
    initialRouteName: "Splash",
    headerMode: "none"
  }
);

// Create middleware and connect
export const appNavigatorMiddleware = createReactNavigationReduxMiddleware(
  "root",
  state => state.nav
);

const ReduxAppNavigator = reduxifyNavigator(AppNavigator, "root");

// create nav component
class ReduxNavigation extends PureComponent {
  componentDidMount() {
    BackHandler.addEventListener("hardwareBackPress", this.onBackPress);
  }

  componentWillUnmount() {
    BackHandler.removeEventListener("hardwareBackPress", this.onBackPress);
  }

  onBackPress = () => {
    const { dispatch, nav } = this.props;
    if (nav.index === 0) {
      return false;
    }

    dispatch(NavigationActions.back());
    return true;
  };

  render() {
    const { dispatch, nav } = this.props;
    return <ReduxAppNavigator dispatch={dispatch} state={nav} />;
  }
}

const mapNavStateProps = state => ({
  state: state.nav
});

export default connect(mapNavStateProps)(ReduxNavigation);

from redux-helpers.

derren7532123 avatar derren7532123 commented on May 2, 2024

Hi Guys anyone can provide solution for this addreduxhelper:
import React from 'react'
import * as ReactNavigation from 'react-navigation'
import { connect } from 'react-redux'
import MixedNavigation from './MixedNavigation'

// here is our redux-aware our smart component
function ReduxNavigation (props) {
const { dispatch, nav } = props
const navigation =({
dispatch,
state: nav
})

return
}

const mapStateToProps = state => ({ nav: state.nav })
export default connect(mapStateToProps)(ReduxNavigation)

from redux-helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.