@@ -29,14 +29,18 @@ const UIManager = require('UIManager');
2929
3030const deepFreezeAndThrowOnMutationInDev = require ( 'deepFreezeAndThrowOnMutationInDev' ) ;
3131const findNodeHandle = require ( 'findNodeHandle' ) ;
32+ const invariant = require ( 'invariant' ) ;
3233
3334const { precacheFiberNode, uncacheFiberNode } = ReactNativeComponentTree ;
3435
3536ReactNativeInjection . inject ( ) ;
3637
3738type Container = number ;
39+ type Instance = {
40+ _children : Array < Instance | number > ,
41+ _nativeTag : number ,
42+ } ;
3843type Props = Object ;
39- type Instance = any ;
4044type TextInstance = number ;
4145
4246function NativeHostComponent ( tag ) {
@@ -123,7 +127,7 @@ const NativeRenderer = ReactFiberReconciler({
123127 UIManager . updateView (
124128 ( instance : any ) . _nativeTag , // reactTag
125129 viewConfig . uiViewClassName , // viewName
126- ( updatePayload : any ) , // props
130+ updatePayload , // props
127131 ) ;
128132 } ,
129133
@@ -154,7 +158,7 @@ const NativeRenderer = ReactFiberReconciler({
154158 tag , // reactTag
155159 viewConfig . uiViewClassName , // viewName
156160 rootContainerInstance , // rootTag
157- ( updatePayload : any ) , // props
161+ updatePayload , // props
158162 ) ;
159163
160164 const component = new NativeHostComponent ( tag ) ;
@@ -215,7 +219,17 @@ const NativeRenderer = ReactFiberReconciler({
215219 child : Instance | TextInstance ,
216220 beforeChild : Instance | TextInstance
217221 ) : void {
222+ // TODO (bvaughn): Remove this check when...
223+ // We create a wrapper object for the container in ReactNative render()
224+ // Or we refactor to remove wrapper objects entirely.
225+ // For more info on pros/cons see PR #8560 description.
226+ invariant (
227+ ! ( typeof parentInstance === 'number' ) ,
228+ 'Container does not support insertBefore operation' ,
229+ ) ;
230+
218231 const children = ( parentInstance : any ) . _children ;
232+
219233 const beforeChildIndex = children . indexOf ( beforeChild ) ;
220234 const index = children . indexOf ( child ) ;
221235
@@ -247,7 +261,7 @@ const NativeRenderer = ReactFiberReconciler({
247261 } ,
248262
249263 prepareForCommit ( ) : void {
250- // Noop?
264+ // Noop
251265 } ,
252266
253267 prepareUpdate (
@@ -292,11 +306,11 @@ const NativeRenderer = ReactFiberReconciler({
292306 } ,
293307
294308 resetAfterCommit ( ) : void {
295- // Noop?
309+ // Noop
296310 } ,
297311
298312 resetTextContent ( instance : Instance ) : void {
299- // Noop?
313+ // Noop
300314 } ,
301315
302316 scheduleAnimationCallback : global . requestAnimationFrame ,
0 commit comments