小编Shu*_*ham的帖子

如何在react-native-router-flux中设置初始场景并检查用户的状态?

如何根据用户登录状态在react-native-router-flux中设置初始场景.这是我想要实现此功能的代码.如果用户登录,我想要场景2,如果用户没有登录,我想要场景1.

我遇到这个代码的问题它总是返回第一个屏幕而不是场景2我有用户登录状态.

import React, { Component } from 'react';
import { Router, Scene } from 'react-native-router-flux';
import Scene1 from '../Scene1';
import Scene2 from '../Scene2';

// localization strings
import strings from '../config/localization';

import styles from './Styles';

class Routes extends Component {
  state = {
    isUserLogin: false
  }
  async componentDidMount() {
    await AsyncStorage.getItem('user', (err, result) => {
      if (result != null) {
        this.setState({ isUserLogin: JSON.parse(result).isUserLoggedIn });
      }
      if (__DEV__) {
        console.log('routes', this.state); // return trur or false if user logged in or …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-router-flux

6
推荐指数
1
解决办法
5721
查看次数

我们如何在 React Native 中的向下滚动事件中隐藏标签栏

我正在使用 react-native-tab-view 模块在我的应用程序中实现选项卡。选项卡工作正常,但我希望当用户向下滚动列表时,应使用动画隐藏选项卡栏。

我正在使用的模块链接,即 https://github.com/react-native-community/react-native-tab-view

这是我的代码:-

import React, { Component } from 'react';
import { View, Text, ScrollView, ActivityIndicator } from 'react-native';
import { TabViewAnimated, TabBar, SceneMap } from 'react-native-tab-view';

import styles from './Styles';

// First tab component
const FirstRoute = () => (
  <ScrollView>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
  </ScrollView>
);

export default class BookingDetail extends Component {

  // default states
  state = {
    index: 0,
    routes: [
      { key: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-scrollview react-native-android react-native-tab-view

5
推荐指数
0
解决办法
1022
查看次数

如何在react app中使用material-ui next的rtl布局

我想在我的 React 应用程序中使用 rtl 布局。我已经使用 material-ui next version 来集成这个应用程序。我使用下面的代码来制作应用程序布局 rtl。某些组件在 rtl 布局中正常工作,但某些组件不受影响。

/**
 * App.js Layout Start Here
 */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import classnames from 'classnames';
import { MuiThemeProvider } from 'material-ui/styles';
import { IntersectingCirclesSpinner } from 'react-epic-spinners';
import { IntlProvider } from 'react-intl';
import { Redirect, Route } from 'react-router-dom';
import { NotificationContainer } from 'react-notifications';

// app routes
import Dashboard from '../routes/dashboard';
import AppSignUp from '../routes/AppSignUp';

// App …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

4
推荐指数
1
解决办法
5460
查看次数

如何在 vuejs 代码拆分中使用 nprogress?

我是 vuejs 的新手,我想将 nprogress 与 vuejs 代码拆分功能一起使用。基本上我想要 nprogress 在使用导航到页面时。要求是显示进度,直到组件承诺无法解决。如何在我的应用程序中添加此功能?

这是我的代码:

import Vue from 'vue'
import Router from 'vue-router'
import Nprogress from 'nprogress'
import 'nprogress/nprogress.css';

// layout components
import Full from '../container/Full'

function asyncComponent(importComponent) {
  return importComponent()
  Nprogress.start();
  importComponent().then(() => {
    Nprogress.done();
    return importComponent();
  })
}

// dashboard components

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Full,
      redirect: '/dashboard/dashboard-v1',
      children: [
        {
          path: '/dashboard/dashboard-v1',
          component: asyncComponent(() => import('../views/dashboard/DashboardOne')),
          meta: {
            title: 'Dashboard V1',
            breadcrumb: 'Dashboard / Dashboard …
Run Code Online (Sandbox Code Playgroud)

lazy-loading vuejs2 code-splitting-async

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