You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by tw93 <gi...@git.apache.org> on 2018/03/21 11:09:17 UTC

[GitHub] incubator-weex pull request #1076: +[ios] switch supports setting color

GitHub user tw93 opened a pull request:

    https://github.com/apache/incubator-weex/pull/1076

    +[ios] switch supports setting color

    ## Background
    - Currently, the [<switch>](http://weex-project.io/cn/references/components/switch.html) component in Weex only support the default green color, But many times the business needs to set color for the theme tone of the product, So <switch> needs to support setting the color.
    
    
    ## New Support &&  Demo
    - tintColor: Background color when the switch is turned on.
    - onTintColor: Border color and background color on Android when the switch is turned off.
    - thumbTintColor: Color of the foreground switch grip.
    
    <table><tr><td><img src="https://gw.alipayobjects.com/zos/rmsportal/echgZhufHYAqYQSSSyKJ.gif" width="240"></td><td><img src="https://gw.alipayobjects.com/zos/rmsportal/zlyOBlQnVbloIizCdWKU.gif" width="240"></td></tr></table>
    
    ## How to Use
    
    ```
    <switch on-tint-color="#C33D3E" 
            thumb-tint-color="#FF7703" 
            tint-color="#850B0B" 
            checked="true"></switch>
    ```
    
    ## My solution
    #### Code
    * Weex iOS:
      * [WXSwitchComponent.m](https://github.com/tw93/incubator-weex/blob/ios-feature-switch/ios/sdk/WeexSDK/Sources/Component/WXSwitchComponent.m)
    * Weex Vue Demo:
      * [http://dotwe.org/vue/99a13cce5a429c7b9bce9bea24253935](http://dotwe.org/vue/99a13cce5a429c7b9bce9bea24253935)
      * [Demo Bundle JS](http://dotwe.org/raw/dist/99a13cce5a429c7b9bce9bea24253935.bundle.wx)
    
    #### Details
    
    It can be overwritten with the `onTintColor`、`thumbTintColor`、`tintColor` attributes of `switchView`, as well as the job of updating the attributes.
    
    ```
    ...
    _switchView.onTintColor = _onTintColor;
    _switchView.thumbTintColor = _thumbTintColor;
    _switchView.tintColor = _tintColor;
    ```
    
    
    Welcome to put forward any suggestion about the solution or other requirements for the <switch> component, Thanks!

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tw93/incubator-weex ios-feature-switch

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-weex/pull/1076.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1076
    
----
commit 96c102effcb9955726c38c99371961288af6ea18
Author: Tw93 <tw...@...>
Date:   2018-03-20T07:23:09Z

    +[ios] switch supports setting color

----


---

[GitHub] incubator-weex issue #1076: [Weex-260][iOS]switch supports setting color

Posted by acton393 <gi...@git.apache.org>.
Github user acton393 commented on the issue:

    https://github.com/apache/incubator-weex/pull/1076
  
    it looks good to me , accepted


---

[GitHub] incubator-weex issue #1076: [Weex-260][iOS]switch supports setting color

Posted by weex-bot <gi...@git.apache.org>.
Github user weex-bot commented on the issue:

    https://github.com/apache/incubator-weex/pull/1076
  
    
    <!--
      0 failure: 
      1 warning:  No Changelog chan...
      1 messages
      
    -->
    
    
    <table>
      <thead>
        <tr>
          <th width="50"></th>
          <th width="100%" data-danger-table="true">Warnings</th>
        </tr>
      </thead>
      <tbody><tr>
          <td>:warning:</td>
          <td>No Changelog changes!</td>
        </tr>
      </tbody>
    </table>
    
    
    <table>
      <thead>
        <tr>
          <th width="50"></th>
          <th width="100%" data-danger-table="true">Messages</th>
        </tr>
      </thead>
      <tbody><tr>
          <td>:book:</td>
          <td>danger test finished.</td>
        </tr>
      </tbody>
    </table>
    
    
    <p align="right">
      Generated by :no_entry_sign: <a href="http://github.com/danger/danger-js/">dangerJS</a>
    </p>



---

[GitHub] incubator-weex pull request #1076: [Weex-260][iOS]switch supports setting co...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-weex/pull/1076


---