react-native使用笔记
2019-11-14 07:46:18    10    0    0
admin

React-Native 快速入门指南

未找到解决方法的问题:

  • react-native 使用 tsx 如何支持修饰器(RN0.59暂时发现github上有很多人有这问题, 还未解决)
  • react-devtools 连接不上 react-native 项目
  • react-native fetch 如何像 axios 一样正常请求到接口, 感觉是headers那里写法不正确

如何删除’警告:已从反应原生核心中提取异步存储…’?

Async Storage has been extracted from react-native core and will be removed in a future release

yarn add @react-native-community/async-storage

链接依赖项

react-native link @react-native-community/async-storage

然后你像这样导入它,并像以前一样使用它。

import AsyncStorage from ‘@react-native-community/async-storage’;

取消警告

您可以使用以下方法来抑制YellowBox警告

import {YellowBox} from ‘react-native’;

然后在你的渲染方法中,我通常会这样做,App.js因此很容易跟踪我隐藏的那些。

  1. render() {
  2. YellowBox.ignoreWarnings(['Warning: Async Storage has been extracted from react-native core']); // <- insert the warning text here you wish to hide.
  3. return (
  4. //cool ui stuff
  5. );
  6. }

react-nativeChrome 上跨域了, 会发送两次请求, 分别是options和你需要的method

  1. 关闭chrome浏览器, 鼠标右键浏览器选择属性->快捷方式->目标文本最后面添加 --disable-web-security --user-data-dir, 注意 --disable 前面有空格.
  2. 注意不要把 chrome 固定在任务栏里, 放在桌面点击打开, 就不会跨域了

Pre: React-native安卓调试

Next: MapBox(可自定义, 开源)

10
Sign in to leave a comment.
No Leanote account? Sign up now.
0 comments
Table of content