barModel.js 427 B

123456789101112131415161718
  1. import { StatusBar } from "react-native";
  2. export default {
  3. state: {
  4. nowBackground: "#FFC21C",
  5. },
  6. actions: ({ model, setState }) => ({
  7. changeBackground(background) {
  8. const {nowBackground}=model()
  9. if (nowBackground !== background) {
  10. StatusBar.setBackgroundColor(background);
  11. setState({
  12. nowBackground:background
  13. })
  14. }
  15. },
  16. }),
  17. };