随笔分类 - dev-react
摘要:from: https://blog.logrocket.com/react-memo-vs-usememo/ Memoization is one of the ways to optimize performance. In this article, we’ll explore how it
阅读全文
摘要:react native上的notifee组建可发送local notification和remote push notification,可订阅各种Event。我使用的是local notification。另一个与之对应的是expo notification,也是很好的组建,但我的app未来想用
阅读全文
摘要:有时需要在bottom tab中的screen中隐藏tab bar,包括其占用的高度也隐藏。参见:https://medium.com/@indrajit.suryakanta.9/customise-tabbar-in-react-native-bottom-tab-navigator-e2ced
阅读全文
摘要:React Native的Debug基础: https://reactnative.dev/docs/next/debugging 调出开发菜单Dev Menu。 cmd+D 或 Device -> Shake 在Dev Menu上可以选择“Show Element Inspector”,显示UI上
阅读全文
摘要:Mobx 是状态管理的框架,可以用在多个JS框架上。与之对应的是Redux:: https://blog.logrocket.com/understanding-redux-tutorial-examples/ 官方文档:(mobx)https://github.com/mobxjs/mobx ht
阅读全文
摘要:官方文档:https://reactnative.dev/docs/flexbox/#absolute--relative-layout 另外一片文档:https://medium.com/wix-engineering/the-full-react-native-layout-cheat-shee
阅读全文
摘要:通常情况下不要用Ref去获取child component: In React, it’s generally recommended to use props and state to manage your component data flow. While refs are a powerf
阅读全文
摘要:https://medium.com/@bobjunior542/effortlessly-use-react-fc-with-typescript-best-practices-91aa7fc057c7 React Function Components (FCs) have become a p
阅读全文
摘要:我想实现的效果是这样的: 注意:Modal的背景还是其他的tab,并没有变化,等Modal消失后Screen还是原来的screen。 Solution: 因为中间的自定义图标按钮需要有一部分在Tab中,所以还是把icon作为tab中的一个screen的,于是就借用:tabBarButton 来实现,
阅读全文
摘要:firebase可以方便的提供api服务,但是是谷歌的服务,国内访问不好。 https://supabase.com/dashboard/projects 是一个替代服务,可以让你专注于demo产品的开发。官网说和next.js配对产品。 该产品可以快速创建db,并且开通基于jwt的api 这种产品
阅读全文
摘要:Starting from version 0.68, React Native provides the New Architecture, which offers developers new capabilities for building highly performant and re
阅读全文
摘要:for useState(), see: https://www.freecodecamp.org/news/usestate-vs-redux-state-management/ 另外请记住,更新state是asynchronous的,意味着如果刚set了state就读取其值,这个值应该还是old
阅读全文
摘要:React Navigation是React社区自己维护的导航的解决方案。文档参见:https://reactnavigation.org/docs/getting-started 常见的几种类型的navigation如下:1. Tab菜单: 参见https://reactnavigation.or
阅读全文
摘要:Notes: 1. With reducers in place, Redux will know how to make changes to the store when actions are dispatched. In a moderately complex app, you’ll us
阅读全文
摘要:我用了最新的xcode和新的react native。 Chapter6: Navigation 这一章中的事例跑不起来,应该是程序用了就的版本的react navigation ("react-navigation": "^2.0.1"),同时关于Navigation的用法也做了不小的改动,因此需
阅读全文
摘要:1. 进入工程目录,启动:Metro npx react-native start 2. 然后在新的terminal窗口中运行app npx react-native run-ios 第1,2步参考:https://reactnative.dev/docs/environment-setup#run
阅读全文
摘要:以下用的是react native cli的方式。如果使用Expo Go,请参考:https://reactnative.dev/docs/environment-setup?guide=quickstart 1. 安装cli命令: npm uninstall -g react-native-cli
阅读全文
摘要:最早直接采用brew安装,如下: brew install node@18 brew uninstall node@18 // 卸载 但学习的项目用的是老版本node,所以卸载了,用NVM来管理多版本node,参考这篇文章: https://blog.bigoodyssey.com/how-to-m
阅读全文
摘要:我在terminal中设置了proxy后,开启proxyon后,执行npm install包错误: (proxyon是通过在~/.zshrc 中添加export http_proxy来实现的) 把proxyoff后,错误又没有了,不知道是啥问题。如果碰到这个问题就用: npm config set
阅读全文
摘要:摘抄自react in action , see chapter4: 直接上图: DEFINITION Mounting is the process of React inserting your components into the real DOM. Once done, your comp
阅读全文