NSObject for React-Native

If I have an NSObject defined:

// Person.h
@interface Person : NSObject
@property(nonatomic,copy)NSString *uuid;
@property(nonatomic,copy)NSString *firstName;
@property(nonatomic,copy)NSString *lastName;
@end

... and I want to provide an array Personfor mine ReactPeopleView, how do I pass objects Personinto my responsive view?

When I try:

NSArray *people = [PeopleManager getAllPeople]; // returns an array of People objects
NSDictionary *properties = @{"people":people};
RCTRootView *root = [[RCTRootView alloc] initWithBridge:_bridge
                                     moduleName:@"ReactPeopleView"
                              initialProperties:properties];

... result:

Running application "ReactPeopleView" with appParams: {"rootTag":1,"initialProps":{"people":[]}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

where 'people':[]there is, but he does not receive any of the objects. I am 100% present in the array, before proceeding to the reaction (I can see them in NSLog in an NSArray, people.

I am very new to reacting, I played with him for several weeks. Encoding with ObjC for about 10 years. Any help is greatly appreciated.

UPDATE 2016-08-30: I traced the creation of a reactive view all the way to -(void)_executeJSCall:arguments:callback:... the arguments I pass are correct in everything, so I'm not sure where things get lost.

2016-08-31: -(NSDictionary *)toDictionary; NSObject. , ReactPeopleView, , ; . , , :)

+4

Source: https://habr.com/ru/post/1652928/


All Articles