Files
react-native/React/Base
Eli White 91681016e8 Add utility methods for enabling high quality error messages
Summary:
These helper functions will be used by the ObjC generated code for support on commands.

This is an example of what that code might look like and how these functions will be used.
```
- (void)handleCommand:(NSString const *)commandName args:(NSArray const *)args
{
  if ([commandName isEqualToString:@"scrollTo"]) {
    if ([args count] != 2) {
      RCTLogError(
          @"%@ command %@ received %d arguments, expected %d.", @"ScrollView", @"scrollTo", (int)[args count], 2);
      return;
    }

    NSObject *arg0 = args[0];
    if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"ScrollView", @"scrollTo", @"1st")) {
      return;
    }

    int x = [(NSNumber *)arg0 intValue];

    NSObject *arg1 = args[1];
    if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @"number", @"ScrollView", @"scrollTo", @"2nd")) {
      return;
    }
    int y = [(NSNumber *)arg1 intValue];

    [self scrollTo:x y:y];
  } else if ([commandName isEqualToString:@"scrollToEnd"]) {
    if ([args count] != 0) {
      RCTLogError(
          @"%@ command %@ received %d arguments, expected %d.", @"ScrollView", @"scrollToEnd", (int)[args count], 0);
      return;
    }

    [self scrollToEnd];
  }
}
```

Reviewed By: JoshuaGross

Differential Revision: D16474117

fbshipit-source-id: 2bb9f01d7c97cc59e9373b7759021c65980fcc0e
2019-07-24 19:39:29 -07:00
..
2019-07-23 03:23:11 -07:00
2019-03-12 19:41:51 -07:00
2019-03-12 19:41:51 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2018-09-17 12:33:01 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-23 03:23:11 -07:00
2019-07-12 16:51:28 -07:00