File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -261,9 +261,10 @@ export default function HeadphonesCarouselExample() {
261261 }
262262 ) }
263263 >
264- { data . map ( ( item , index ) => (
264+ { data . map ( ( { key , ... item } , index ) => (
265265 < View collapsable = { false } key = { index } >
266266 < Item
267+ key = { key }
267268 { ...item }
268269 scrollOffsetAnimatedValue = { scrollOffsetAnimatedValue }
269270 positionAnimatedValue = { positionAnimatedValue }
Original file line number Diff line number Diff line change @@ -92,14 +92,13 @@ - (void)willMoveToSuperview:(UIView *)newSuperview {
9292#pragma mark - React API
9393
9494- (void )mountChildComponentView : (UIView<RCTComponentViewProtocol> *)childComponentView index : (NSInteger )index {
95- UIViewController *wrapper = [[ UIViewController alloc ] initWithView: childComponentView ];
96- [_nativeChildrenViewControllers insertObject: wrapper atIndex: index ];
97- [self goTo: _currentIndex animated: NO ];
95+ UIViewController *vc = [UIViewController new ];
96+ [vc.view addSubview: childComponentView ];
97+ [_nativeChildrenViewControllers insertObject: vc atIndex: index ];
9898}
9999
100100- (void )unmountChildComponentView : (UIView<RCTComponentViewProtocol> *)childComponentView index : (NSInteger )index {
101- [[_nativeChildrenViewControllers objectAtIndex: index].view removeFromSuperview ];
102- [_nativeChildrenViewControllers objectAtIndex: index].view = nil ;
101+ [childComponentView removeFromSuperview ];
103102 [_nativeChildrenViewControllers removeObjectAtIndex: index];
104103
105104 NSInteger maxPage = _nativeChildrenViewControllers.count - 1 ;
@@ -119,11 +118,7 @@ -(void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
119118
120119-(void )prepareForRecycle {
121120 [super prepareForRecycle ];
122-
123- _nativeChildrenViewControllers = [[NSMutableArray alloc ] init ];
124- [_nativePageViewController.view removeFromSuperview ];
125121 _nativePageViewController = nil ;
126-
127122 _currentIndex = -1 ;
128123}
129124
You can’t perform that action at this time.
0 commit comments