Redux记录器未记录到控制台

时间:2019-05-23 14:34:11

标签: javascript redux react-redux

控制台中没有记录任何操作。有什么想法吗?

商店:

import thunk from "redux-thunk";

import logger from "redux-logger";
import rootReducer from "../reducers";

const initialState = {
    fetchVideos: []
};

const store = createStore(
    rootReducer,
    initialState,
    applyMiddleware(thunk, logger)
);

export default store;

Package.json:

  "dependencies": {
    "react": "16.5.0",
    "react-native": "0.57.1",
    "react-navigation": "^3.0.9",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "redux-logger": "^3.0.6"
  },

1 个答案:

答案 0 :(得分:0)

将记录器安装为依赖项:

public View getView(int position, View convertView, ViewGroup parent) { ChatData message = chatMessageList.get(position); View vi = convertView; if (convertView == null) vi = inflater.inflate(R.layout.msglist, parent, false); TextView msg = vi.findViewById(R.id.text); msg.setText(message.body); LinearLayout layout = vi.findViewById(R.id.message_layout); LinearLayout parent_layout = vi.findViewById(R.id.message_layout_parent); inflater = (LayoutInflater) this.mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // if message is mine then align to right if (message.isMine) { layout.setGravity(Gravity.RIGHT); int couleurBubble = getCouleurSelectionnee(); switch(couleurBubble){ case R.color.c1: msg.setBackgroundResource(R.drawable.user_color1); break; case R.color.c2: msg.setBackgroundResource(R.drawable.user_color2); break; case R.color.c3: msg.setBackgroundResource(R.drawable.user_color3); break; case R.color.c4: msg.setBackgroundResource(R.drawable.user_color4); break; case R.color.c5: msg.setBackgroundResource(R.drawable.user_color5); break; case R.color.c6: msg.setBackgroundResource(R.drawable.user_color6); break; case R.color.c7: msg.setBackgroundResource(R.drawable.user_color7); break; case R.color.c8: msg.setBackgroundResource(R.drawable.user_color8); break; default: break; } parent_layout.setGravity(Gravity.RIGHT); } // If not mine then align to left else { layout.setGravity(Gravity.LEFT); msg.setBackgroundResource(R.drawable.bot_chat); parent_layout.setGravity(Gravity.LEFT); } return vi; }

希望对您有帮助。