react-native-redux-toast icon indicating copy to clipboard operation
react-native-redux-toast copied to clipboard

TypeError: stat merge is not a function

Open isAlmogK opened this issue 7 years ago • 4 comments

I'm getting the following error:

screen shot 2018-01-25 at 1 42 21 pm

Here is my code it's pretty much like the example Reducer Index

import { combineReducers } from 'redux';

// Import reducers
import routesReducer from './routesReducer';
import { reducer as navbarReducer } from './navbarReducers';
import { reducer as projectsReducer } from './projectsReducers';
import { reducer as teamsReducer } from './teamsReducers';
import { reducer as photosReducer } from './photosReducers';
import { reducer as photosCommentsReducer } from './photosCommentsReducers';
import { reducer as persistReducer } from './persistReducers';
import { reducer as connectionReducer } from './connectionReducers';
import { reducer as newDataReducer } from './newDataReducers';
import { reducer as functionReducer } from './functionsReducers';
import { reducer as userReducer } from './userReducers';
import { reducer as jwtReducer } from './jwtReducer';
import { reducer as resetPasswordReducer } from './resetPasswordReducer';
import { toastReducer as toast } from 'react-native-redux-toast';

export default combineReducers({
    //Scenes,
    toast,
    routesReducer,
    persist: persistReducer,
    connectionStatus:connectionReducer,
    navbar: navbarReducer,
    selectedProject: projectsReducer,
    selectedTeam: teamsReducer,
    selectedTeamPhotos: photosReducer,
    photosComments: photosCommentsReducer,
    newData: newDataReducer,
    functions:functionReducer,
    user:userReducer,
    jwt:jwtReducer,
    resetPassword:resetPasswordReducer,
});

Calling the props

// Maps to props
const mapDispatchToProps = (dispatch) => {
    return {
        postEditComment: (data) => dispatch(photosCommentsActionCreators.photoEditComment(data)),
        testing:() => dispatch(ToastActionsCreators.displayError('Error toast!'))

        //this.props.dispatch(ToastActionsCreators.displayError('Error toast!'));
    };
};

isAlmogK avatar Jan 25 '18 02:01 isAlmogK

Getting the same problem. I think this library is making the assumption that the state is set up using ImmutableJS, resulting in this error when you are actually not using ImmutableJS.

jordanmkoncz avatar Mar 01 '18 03:03 jordanmkoncz

I have the same problem.

jan-happy avatar Dec 20 '18 08:12 jan-happy

I think this https://github.com/reactjs/react-router-redux/issues/441 would help you. Several things you need to update:

  1. import { combineReducers } from 'redux-immutable'; // not from 'redux'
  2. import { fromJS } from 'immutable' and convert the initialState to immutable object with fromJS()
  3. also call fromJS() each time you update state
  4. call state.get(reducerName) each time you need to get values, don't use 'state.key', I suggest you write your own util to handle conversion

delusionxb avatar Jan 23 '19 08:01 delusionxb

I've forked this and removed redux-immutable. Here's a link for anyone that runs into this issue: https://github.com/PeterChauYEG/react-native-redux-toast

PeterChauYEG avatar Apr 14 '19 19:04 PeterChauYEG