11import React from 'react'
22import invariant from 'invariant'
33import ReactFiberReconciler from 'react-reconciler'
4- import {
5- unstable_now as now ,
6- unstable_shouldYield as shouldYield ,
7- unstable_scheduleCallback as scheduleDeferredCallback ,
8- unstable_cancelCallback as cancelDeferredCallback
9- } from 'scheduler'
4+ import { DefaultEventPriority } from 'react-reconciler/constants'
105import { emptyObject } from './utils'
116import Gradient from './Gradient'
127import Text from './Text'
@@ -56,6 +51,26 @@ const freeComponentAndChildren = c => {
5651}
5752
5853const CanvasHostConfig = {
54+ supportsHydration : false ,
55+ supportsPersistence : true ,
56+ cancelTimeout : clearTimeout ,
57+ scheduleTimeout : setTimeout ,
58+ noTimeout : - 1 ,
59+ detachDeletedInstance ( ) { } ,
60+ getInstanceFromScope ( ) {
61+ return null
62+ } ,
63+ preparePortalMount ( ) { } ,
64+ afterActiveInstanceBlur ( ) { } ,
65+ beforeActiveInstanceBlur ( ) { } ,
66+ getCurrentEventPriority ( ) {
67+ return DefaultEventPriority
68+ } ,
69+ getInstanceFromNode ( ) {
70+ return undefined
71+ } ,
72+ prepareScopeUpdate ( ) { } ,
73+ clearContainer ( ) { } ,
5974 appendInitialChild ( parentInstance , child ) {
6075 if ( typeof child === 'string' ) {
6176 // Noop for string children of Text (eg <Text>{'foo'}{'bar'}</Text>)
@@ -100,7 +115,7 @@ const CanvasHostConfig = {
100115 } ,
101116
102117 prepareForCommit ( ) {
103- // Noop
118+ return null
104119 } ,
105120
106121 prepareUpdate ( /* domElement, type, oldProps, newProps */ ) {
@@ -111,10 +126,6 @@ const CanvasHostConfig = {
111126 // Noop
112127 } ,
113128
114- resetTextContent ( /* domElement */ ) {
115- // Noop
116- } ,
117-
118129 shouldDeprioritizeSubtree ( /* type, props */ ) {
119130 return false
120131 } ,
@@ -127,24 +138,14 @@ const CanvasHostConfig = {
127138 return emptyObject
128139 } ,
129140
130- scheduleDeferredCallback,
131-
132- cancelDeferredCallback,
133-
134- shouldYield,
135-
136141 shouldSetTextContent ( type , props ) {
137142 return (
138143 typeof props . children === 'string' || typeof props . children === 'number'
139144 )
140145 } ,
141146
142- now,
143-
144147 isPrimaryRenderer : false ,
145148
146- useSyncScheduling : true ,
147-
148149 supportsMutation : true ,
149150
150151 appendChild ( parentInstance , child ) {
@@ -199,14 +200,6 @@ const CanvasHostConfig = {
199200 parentLayer . invalidateLayout ( )
200201 } ,
201202
202- commitTextUpdate ( /* textInstance, oldText, newText */ ) {
203- // Noop
204- } ,
205-
206- commitMount ( /* instance, type, newProps */ ) {
207- // Noop
208- } ,
209-
210203 commitUpdate ( instance , updatePayload , type , oldProps , newProps ) {
211204 if ( typeof instance . applyLayerProps !== 'undefined' ) {
212205 instance . applyLayerProps ( oldProps , newProps )
0 commit comments