Coder Social home page Coder Social logo

Comments (1)

rilyu avatar rilyu commented on July 16, 2024

从使用上来说这确实是个问题,不过Teaset的设计初衷就是这样的,就是传入element的属性能控制所有样式,所有的Teaset组件都是按这个方式实现的。

就这个问题来说,如果ListRow预设paddingRight=12,有两个方法可以实现:

  • 把传入的element放到设置了paddingRight=12的View容器里

  • 使用cloneElement为传入的element的style属性增加paddingRight=12

前者的问题是使用者不能指定别的paddingRight值,后者的问题是假定传入的element支持style,但不一定总是这样,这就是这个问题的原因。
你可以派生出一个新的类,在类内作易用性封装,可参照Example中的SelectRow实现:https://github.com/rilyu/teaset/blob/master/example/views/SelectRow.js

from teaset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.