alibaba / weex

A framework for building Mobile cross-platform UI
https://weexapp.com/
Apache License 2.0
18.28k stars 2.13k forks source link

ios端拓展组件问题 #2813

Closed weartist closed 3 years ago

weartist commented 7 years ago

又有事情来请教了,现在想实现一个类似输入的控件,继承了w'xComponent类,但是有些方法还是调用不了,例如:

#pragma mark update touch styles
-(void)handlePseudoClass
{
    NSMutableDictionary *styles = [NSMutableDictionary new];
    NSMutableDictionary *recordStyles = [NSMutableDictionary new];
    if(_disabled){
        recordStyles = [self getPseudoClassStylesByKeys:@[@"disabled"]];
        [styles addEntriesFromDictionary:recordStyles];
    }else {
        recordStyles = [NSMutableDictionary new];
        recordStyles = [self getPseudoClassStylesByKeys:@[@"enabled"]];
        [styles addEntriesFromDictionary:recordStyles];
    }
    if ([_inputView isFirstResponder]){
        recordStyles = [NSMutableDictionary new];
        recordStyles = [self getPseudoClassStylesByKeys:@[@"focus"]];
        [styles addEntriesFromDictionary:recordStyles];
    }
    NSString *disabledStr = @"enabled";
    if (_disabled){
        disabledStr = @"disabled";
    }
    if ([_inputView isFirstResponder]) {
        NSString *focusStr = @"focus";
        recordStyles = [NSMutableDictionary new];
        recordStyles = [self getPseudoClassStylesByKeys:@[focusStr,disabledStr]];
        [styles addEntriesFromDictionary:recordStyles];
    }
    [self updatePseudoClassStyles:styles];
}

这里边的包含在component的方法并不能正常调用

  recordStyles = [self getPseudoClassStylesByKeys:@[@"disabled"]];
  recordStyles = [self getPseudoClassStylesByKeys:@[@"enabled"]];
  recordStyles = [self getPseudoClassStylesByKeys:@[@"focus"]];
  [self updatePseudoClassStyles:styles];

然后在textfield回调时候调用fireevent,代码执行了,但是weex端收不到,,再次麻烦大家了

kfeagle commented 7 years ago

@slidoooor #import "WXComponent+PseudoClassManagement.h" 引用这个头文件

weartist commented 7 years ago

@kfeagle 您好,我用cocoapods集成的,引用不到啊...

kfeagle commented 7 years ago

看了下,WXComponent+PseudoClassManagement.h 这个头文件没有对外开放,后续讨论下是否要开放

weartist commented 7 years ago

@kfeagle 是的,多谢了,那这种情况要写一个随时和服务端通信的组件,还有什么其他方法吗,

kfeagle commented 7 years ago

websocket?https://weex-project.io/cn/references/modules/websocket.html

YorkShen commented 5 years ago

This PR/issue doesn't received response since Weex migrated to Apache two years ago and this repository is no longer active yet.

Feel free to ask question in new repository and thanks for your contribution.

Hanks10100 commented 3 years ago

This issue is outdated for a long time and will be closed now. You can create a new one if you still have questions.