2

In React-Native i have a component like this

<View nativeID={'id1'}>
 ...other chicle components
</View>

In native how this nativeID will be used. In Objective C how can i check if certain UIVIew has given nativeID or not. I have access to RCTRootView, now how can i get a subview with given nativeID.

Harish_N
  • 2,249
  • 3
  • 23
  • 34

1 Answers1

2

You can check the nativeID for all subviews as follows:

#import "UIView+React.h"

for (UIView *subview in self.subviews) {
    if [subview.nativeID isEqualToString: "myIDString"] {
        // found it!
    }
}
koen
  • 5,383
  • 7
  • 50
  • 89