File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -261,9 +261,10 @@ export default function HeadphonesCarouselExample() {
261
261
}
262
262
) }
263
263
>
264
- { data . map ( ( item , index ) => (
264
+ { data . map ( ( { key , ... item } , index ) => (
265
265
< View collapsable = { false } key = { index } >
266
266
< Item
267
+ key = { key }
267
268
{ ...item }
268
269
scrollOffsetAnimatedValue = { scrollOffsetAnimatedValue }
269
270
positionAnimatedValue = { positionAnimatedValue }
Original file line number Diff line number Diff line change @@ -92,14 +92,13 @@ - (void)willMoveToSuperview:(UIView *)newSuperview {
92
92
#pragma mark - React API
93
93
94
94
- (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 ];
98
98
}
99
99
100
100
- (void )unmountChildComponentView : (UIView<RCTComponentViewProtocol> *)childComponentView index : (NSInteger )index {
101
- [[_nativeChildrenViewControllers objectAtIndex: index].view removeFromSuperview ];
102
- [_nativeChildrenViewControllers objectAtIndex: index].view = nil ;
101
+ [childComponentView removeFromSuperview ];
103
102
[_nativeChildrenViewControllers removeObjectAtIndex: index];
104
103
105
104
NSInteger maxPage = _nativeChildrenViewControllers.count - 1 ;
@@ -119,11 +118,7 @@ -(void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
119
118
120
119
-(void )prepareForRecycle {
121
120
[super prepareForRecycle ];
122
-
123
- _nativeChildrenViewControllers = [[NSMutableArray alloc ] init ];
124
- [_nativePageViewController.view removeFromSuperview ];
125
121
_nativePageViewController = nil ;
126
-
127
122
_currentIndex = -1 ;
128
123
}
129
124
You can’t perform that action at this time.
0 commit comments