5.x hooks or - Discussion
See original GitHub issue版本更新说明
由于这个库变成了个人开发者维护了,所以更多的版本更新是来自于issue的反馈,这里也提一下对于issue的提交规范对我们很重要。 我们将从issues中整理出一些高频问题进行在线讨论
其中问的比较炸眼👀的问题 《这个项目还维护吗》链接 ,我们的一致回答是 “这次一定,这次一定维护” 😂
开发说明
“站在巨人的肩膀上”
我们严格遵循ant-design的设计语言,所以非常适合在移动端上的中台类应用服务
过多的props
会导致组件“千疮百孔”,间接导致我们疲于开发和维护,
样式上我们只开放styles
合集对象。想改样式,这可能需要去读源码,
比如找到对应的styles name(类似html的class类名)并定义额外样式,内部代码会实现自动merge
比如:
// 使用端
<Tag
small
styles={{
normalText: { color: '#52c41a' },
normalWrap: { borderColor: '#b7eb8f', backgroundColor: '#f6ffed' },
}}
style={{ marginRight: 5 }}>
NICE
</Tag>
// style name映射列表(./components/tag/style/index.tsx)
export interface TagStyle {
tag: ViewStyle
wrap: ViewStyle
wrapSmall: ViewStyle
text: TextStyle
textSmall: TextStyle
normalWrap: ViewStyle // 上述代码将丰富它的样式
normalText: TextStyle // 上述代码将丰富它的样式
activeWrap: ViewStyle
activeText: TextStyle
disabledWrap: ViewStyle
disabledText: TextStyle
close: ViewStyle
closeIOS: ViewStyle
closeAndroid: ViewStyle
closeText: TextStyle
}
如果你发现这样的样式改动特别多,要么说服UI,要么这个库可能不适合你,我们希望做到“开箱即用”的初衷
把ant-desgin的sketch插件推荐给产品和UI,能节省不少工作量 幸运的是还是有很多组件是通用型的,比如List、Toast、Modal等等
React Hook
截止今天许多组件中使用了UNSAFE_xx
的生命周期,避免未来react实现异步渲染时可能会造成影响,我们也将在本次重构中弃用并使用Hooks替换之。具体如下:
- 提供相关组件的Hooks版本
- 支持严格模式
<React.StrictMode>
- 拥抱 React 17 (wow!~)
最后
欢迎大家在这里分享一下你们的使用案例,给我们一点创作灵感 有兴趣的话还可以做一个开箱即用的-pro案例
- General
- Bug fixes
- Perfect Documentation …
- Refactoring
- Upgrade related
Component
toHooks
version - Improve documentation …
- Upgrade related
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Introducing Hooks - React
On this page, we'll continue by explaining why we're adding Hooks to React and how they can help you write great applications.
Read more >General Discussion: Round 5: What's a good hook? - Paizo
An intriguing NPC makes a great hook for me. I like games where I get to interact with other characters a lot. By...
Read more >Presentation Hook Examples
1. Starting with a story is one of the oldest and most powerful methods of introducing your presentation. Storytelling is a good hook...
Read more >Captain of a hook: 10 engaging lesson introduction ideas
Hooks can be short around 2-5 minutes with a short video, photograph, sound clip or they can take some time by doing a...
Read more >All About Love by Bell Hooks | Book Club Discussion Questions
5. hooks describes the allure of lying in relation to the allure of power. What are the lies you tell to feel powerful?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@1uokun I have had a busy end of the week. Will get to you tomorrow about the project plan. 🙌
I have used antd (react.js) for some time now. It is great because it includes basic components, but also professional looking components that have more applicability to complex UI needs (usually enterprise-level stuff).
ant-design-mobile-rn has the ability to build a great community, matching as many components from antd component framework as possible, and become a very popular react-native library.
Once we get past the React 17 hurdle and standardize things, we can embark on a research project to determine what antd components to reimplement for native and go from there.
Thoughts on the docs: I completely agree with @1uokun. You have to read a lot of the source code to understand them. The other problem I see is that the embedded emulators don’t support ios or android. This is a long-standing problem for mobile component framework demos. Most react-native docs just show a gif of component interaction, which could be done here if there are no other solutions. With the standard antd component library, demos are fairly easy since it’s made specifically for web. If anybody knows how to implement ios/android in-browser demos for the docs, it would be nice… but the memory overhead would be crazy. My vote is to develop a standard format for gifs (to demo components) and then include the source code in collapsable bins like the main antd website does.
@bang88 I am more than willing to start overhauling the docs, we just need to have more discussion.