草庐IT

react-state-management

全部标签

android - React native 如何每 x 分钟从 api 中获取一次

我想在android上每x分钟运行一次获取(使用Reactnative)functiongetMoviesFromApiAsync(){returnfetch('https://facebook.github.io/react-native/movies.json').then((response)=>response.json()).then((responseJson)=>{returnresponseJson.movies;}).catch((error)=>{console.error(error);});}我使用了documentaion中的示例,因为我仍然不确定我将如何进行

javascript - 未定义不是 this.state 中的对象 - React Native

我是ReactNative的新手,我在this.state.rows中收到错误消息undefinedisnotaobject我我正在尝试在用户单击Button时动态添加View。我尝试使用this而不是使用getInitialState我使用constructor(props)但我一直有上述错误。这是我的代码constructor(props){super(props);this.state={rows:[],};}addRow(){this.state.rows.push(index++)this.setState({rows:this.state.rows})}render(){l

android - React Native - 运行 Android - 找不到 common.jar (android.arch.core :common:1. 0.0)

这个问题在这里已经有了答案:Error:Failedtoresolve:android.arch.core:common:1.1.0(5个答案)关闭4年前。当运行react-nativerun-android时,我得到了这个错误:*Whatwentwrong:Aproblemoccurredconfiguringproject':app'.>Couldnotresolvealldependenciesforconfiguration':app:_debugApk'.>Aproblemoccurredconfiguringproject':react-native-device-info

javascript - React Native - 如何检查 UI/元素?

我已经安装了React开发工具。但是当我在模拟器上启动我的应用程序时,我的Chrome浏览器看不到它。如果你看这个youtubeclip,您可以看到React选项卡在列表中,您可以检查应用的UI。知道为什么吗?如果React开发工具无法在我的Chrome上运行,我该如何检查应用的UI/元素? 最佳答案 Devtools“React”目前是不可能的。这是由于在devtools插件中评估应用程序脚本的方式发生了变化。您可以在https://facebook.github.io/react-native/docs/known-issues

React路由器V4&CSS过渡组

我有一个简单的示例React-RouterV4&路线过渡。它遵循所示的示例https://reaecttraining.com/reaeact-router/web/example/animated-transitions。但是,结果只是显示的最后一条路线。其他人只是空白。https://codesandbox.io/s/r0pvb30wk.importReactfrom'react';import{render}from'react-dom';import{BrowserRouterasRouter,Route,Link}from'react-router-dom';import{C

Android SDK Manager 无法下载新文件

我试图获取最新的android源代码(5.0,只是为了看看它的外观),但是当我尝试从AndroidSDK下载源代码时,它给了我一个错误,说local未找到URL。这是日志:Fetchinghttps://dl-ssl.google.com/android/repository/addons_list-2.xmlValidateXMLParseXMLFetchedAdd-onsListsuccessfullyFetchingURL:https://dl-ssl.google.com/android/repository/repository-10.xmlValidateXML:https

React 中ref 的使用(类组件和函数组件)以及forwardRef 与 useImperativeHandle 详解

前言在一个父组件中,我们想要获取到其中的节点元素或者子组件实例,从而直接调用其上面的方法。Class类组件和函数组件是两种不同的写法。1.Class组件中使用ref在React的Class组件中,我们通过createRef创建refclassParentextendsReact.Component{constructor(props){super(props)this.inputRef=React.createRef();}componentDidMount(){console.log(this.inputRef)this.inputRef.current.focus();}render(){

管道在Vue和Angular中的作用及React的替代方案

管道在Vue和Angular中的作用及React的替代方案前言管道起源管道特点前端中管道概念和作用概念作用React关于管道的替代方案Vue和Angular管道的区别前言本文主要讲解管道在Vue和Angular中有哪些作用以及React对于管道概念的替代方案是什么。管道起源计算机中的Pipline(管道)常被认为起源于Unix,最初Mcllroy发现很多时候人们会将shell命令的输出传递给另一个shell命令,类似于管道。所以就提出了管道的概念。并在1973年实现了这个管道概念,使用|作为pipe的语法符号。此后,很多操作系统也引入了pipe概念,而Angular和Vue框架都引入了这个概念

android - 不可能 : No layout manager attached; Skipping layout

我完全迷失了这个错误,我理解它,但我不知道出了什么问题。对于代码://IntheOnCreateofmyactivityhistoryRecyclerView=(RecyclerView)findViewById(R.id.recycler_suggestions);SearchBarHistoryAdaptersearchBarHistoryAdapter=newSearchBarHistoryAdapter();searchBarHistoryAdapter.setActivity(this);historyRecyclerView.setLayoutManager(newLine

android - 在 Android 的 TelephonyManager.CALL_STATE_RINGING 上将默认来电屏幕移至后台

我正在开发一个应用程序,我必须在其中覆盖传入调用屏幕。当设备接到电话时,我必须显示我的应用程序的弹出窗口。我对这个任务做了详细的研究。CALLPOPOUT是一个使用相同功能的应用程序,但我没有获得源代码。目前我有几个模块可以用来获取INCOMINGCALL的Action。publicclassMyPhonestateListnerextendsPhoneStateListener{Contextcontext;ListblockedNumberList=newArrayList();BlockDataSourcedatasourceobj;publicMyPhonestateListn