小编Luí*_*tre的帖子

如何将 redux-persist 与工具包和 next-redux-wrapper 一起使用?

redux-toolkit我在、redux-persist和配置方面遇到问题next-redux-wrapper。我尝试使 redux 状态持久化,但它不运行应将状态保存到本地存储的 redux 操作。

我的store.ts文件。

import {
  Action,
  combineReducers,
  configureStore,
  ThunkAction,
  getDefaultMiddleware,
} from '@reduxjs/toolkit';
import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { createWrapper } from 'next-redux-wrapper';
import taskReducer from './reducers/taskReducer';
import projectReducer from './reducers/projectReducer';
import workplaceReducer from './reducers/workplaceReducer';
import userReducer from './reducers/userReducer';
import trackTaskReducer from './reducers/trackTaskReducer';
import chatRoomReducer from './reducers/chatRoomReducer';
import messageReducer from './reducers/messageReducer';

const rootReducer = combineReducers({
  taskReducer,
  projectReducer,
  workplaceReducer,
  userReducer,
  trackTaskReducer,
  chatRoomReducer,
  messageReducer,
});

const …
Run Code Online (Sandbox Code Playgroud)

reactjs redux next.js redux-toolkit

9
推荐指数
1
解决办法
4307
查看次数

如何让 Luxon 的 Intl API 在 React-Native 中工作

我已经使用 Luxon 相当一段时间了,作为 moment 的替代品,它重量轻,并且总体上有很棒的文档,现在我遇到了一个需要使用 luxon 的 toFormat 函数来写入日期月份名称的情况。

现在这个问题只发生在Android中,而不是iOS中,我假设是因为iOS中的一些javascript也来自Safari,并且浏览器确实支持Luxon的Intl API。

基本上我的问题是如何让 Luxon 的 Intl Api 在 Android 上工作?

React-Native 版本:0.62.2

javascript intl react-native luxon

8
推荐指数
1
解决办法
5097
查看次数

在 React Native 中使用 ScrollViews 水平和垂直滚动

我尝试实现水平和垂直滚动,如下所示:

滚动预览模拟

水平滚动将特色内容显示为图像(应该是可点击的)。垂直滚动还有其他可点击的项目。

我的第一次尝试是使用两个均具有绝对位置的 ScrollView,但水平 ScrollView 会消耗所有触摸事件(即使在添加 pointerEvents={"box-none"} 之后)。

这就是我在那种情况下尝试的:

import React, { Component } from "react";
import { Dimensions, ScrollView, Text, StyleSheet, View } from "react-native";
const DimensionsWindowWidth = Dimensions.get("window").width;

export default class App extends Component {
    render() {
        return (
            <View style={styles.container}>
                <ScrollView horizontal={true} style={styles.scrollView}>
                    <View style={styles.slide}>
                        <Text>H1</Text>
                    </View>
                    <View style={styles.slide}>
                        <Text>H2</Text>
                    </View>
                    <View style={styles.slide}>
                        <Text>H3</Text>
                    </View>
                </ScrollView>
                <ScrollView pointerEvents={"box-none"} style={styles.scrollView}>
                    <View style={styles.item}>
                        <Text>V1</Text>
                    </View>
                    <View style={styles.item}>
                        <Text>V2</Text>
                    </View>
                    <View style={styles.item}>
                        <Text>V3</Text>
                    </View>
                    <View style={styles.item}>
                        <Text>V4</Text>
                    </View> …
Run Code Online (Sandbox Code Playgroud)

react-native

5
推荐指数
2
解决办法
1万
查看次数