diff --git a/packages/react/src/components/AnimatedSprite.js b/packages/react/src/components/AnimatedSprite.js index cd77062d..4d9dfddb 100644 --- a/packages/react/src/components/AnimatedSprite.js +++ b/packages/react/src/components/AnimatedSprite.js @@ -12,7 +12,7 @@ const AnimatedSprite = (root, props) => { invariant( texture instanceof Texture || texture?.texture, - `AnimationSprite texture needs to be an array of \`PIXI.Texture\` or \`{ texture: PIXI.Texture, time: + `AnimationSprite texture needs to be an array of \`Texture\` or \`{ texture: Texture, time: number }\`` ); diff --git a/packages/react/src/components/Graphics.js b/packages/react/src/components/Graphics.js index ebd2e4d4..ad7e8b87 100644 --- a/packages/react/src/components/Graphics.js +++ b/packages/react/src/components/Graphics.js @@ -4,7 +4,7 @@ import invariant from '../utils/invariant'; const Graphics = (root, { geometry }) => { - invariant(!geometry || geometry instanceof PixiGraphics, `Graphics geometry needs to be a \`PIXI.Graphics\``); + invariant(!geometry || geometry instanceof PixiGraphics, `Graphics geometry needs to be a \`Graphics\``); const g = geometry ? new PixiGraphics(geometry.geometry) : new PixiGraphics(); g.applyProps = (instance, oldProps, newProps) => diff --git a/packages/react/src/components/SimpleRope.js b/packages/react/src/components/SimpleRope.js index 5cccc62e..fc791e01 100644 --- a/packages/react/src/components/SimpleRope.js +++ b/packages/react/src/components/SimpleRope.js @@ -13,7 +13,7 @@ const SimpleRope = (root, props) => { const { image, texture, ...props } = newProps; - invariant(Array.isArray(newProps.points), 'SimpleRope points needs to be %s', 'Array'); + invariant(Array.isArray(newProps.points), 'SimpleRope points needs to be %s', 'Array'); let changed = applyDefaultProps(instance, oldProps, props); if (image || texture) diff --git a/packages/react/src/hooks/useApp.js b/packages/react/src/hooks/useApp.js index dc7aa255..3f63b173 100644 --- a/packages/react/src/hooks/useApp.js +++ b/packages/react/src/hooks/useApp.js @@ -10,7 +10,7 @@ export function useApp() invariant( app instanceof Application, 'No Context found with `%s`. Make sure to wrap component with `%s`', - 'PIXI.Application', + 'Application', 'AppProvider' ); diff --git a/packages/react/src/hooks/useTick.js b/packages/react/src/hooks/useTick.js index 88474846..6af1508e 100644 --- a/packages/react/src/hooks/useTick.js +++ b/packages/react/src/hooks/useTick.js @@ -11,7 +11,7 @@ function useTick(callback, enabled = true) invariant( app instanceof Application, 'No Context found with `%s`. Make sure to wrap component with `%s`', - 'PIXI.Application', + 'Application', 'AppProvider' ); diff --git a/packages/react/src/reconciler/hostconfig.js b/packages/react/src/reconciler/hostconfig.js index df821cfe..ac56af15 100644 --- a/packages/react/src/reconciler/hostconfig.js +++ b/packages/react/src/reconciler/hostconfig.js @@ -101,7 +101,7 @@ function removeChild(parent, child) function insertBefore(parent, child, beforeChild) { - invariant(child !== beforeChild, 'pixi-react: PixiFiber cannot insert node before itself'); + invariant(child !== beforeChild, 'Cannot insert node before itself'); const childExists = parent.children.indexOf(child) !== -1; @@ -256,10 +256,9 @@ const HostConfig = { { invariant( false, - `pixi-react: Error trying to add text node "${text}"`, - 'PixiFiber does not support text nodes as children of a Pixi component. ' - + 'To pass a string value to your component, use a property other than children. ' - + 'If you wish to display some text, you can use <Text text={string} /> instead.' + `Error trying to add text node "${text}"`, + 'text strings as children of a Pixi component is not supported. ' + + 'To add some text, use <Text text={string} />' ); }, diff --git a/packages/react/src/render/index.js b/packages/react/src/render/index.js index 60f179c4..06f6dd5f 100644 --- a/packages/react/src/render/index.js +++ b/packages/react/src/render/index.js @@ -12,7 +12,7 @@ function unmountComponent(container) { invariant( Container.prototype.isPrototypeOf(container), - 'Invalid argument `container`, expected instance of `PIXI.Container`.' + 'Invalid argument `container`, expected instance of `Container`.' ); if (roots.has(container)) @@ -38,12 +38,12 @@ export function createRoot(container) { invariant( Container.prototype.isPrototypeOf(container), - 'Invalid argument `container`, expected instance of `PIXI.Container`.' + 'Invalid argument `container`, expected instance of `Container`.' ); let root = roots.get(container); - invariant(!root, 'Pixi React: createRoot should only be called once'); + invariant(!root, 'createRoot should only be called once'); if (!root) { diff --git a/packages/react/src/utils/pixi.js b/packages/react/src/utils/pixi.js index e577aeee..549bf1e9 100644 --- a/packages/react/src/utils/pixi.js +++ b/packages/react/src/utils/pixi.js @@ -138,9 +138,8 @@ export function setValue(instance, prop, value) invariant( typeof coordinates !== 'undefined' && coordinates.length > 0 && coordinates.length < 3, - 'The property `%s` is a `PIXI.Point` or `PIXI.ObservablePoint` and must be set to a comma-separated string of ' - + 'either 1 or 2 coordinates, a 1 or 2 element array containing coordinates, or a PIXI Point/ObservablePoint. ' - + 'If only one coordinate is given then X and Y will be set to the provided value. Received: `%s` of type `%s`.', + 'The property `%s` is a `Point` and must be set to a comma-separated string of ' + + 'either coordinates, an array containing coordinates, or a Point.', prop, JSON.stringify(value), typeof value diff --git a/packages/react/test/hooks.spec.js b/packages/react/test/hooks.spec.js index 041e7e7a..0e8c8e9b 100644 --- a/packages/react/test/hooks.spec.js +++ b/packages/react/test/hooks.spec.js @@ -33,7 +33,7 @@ describe('hooks', () => }); expect(createApp).toThrow( - 'No Context found with `PIXI.Application`. Make sure to wrap component with `AppProvider`' + 'No Context found with `Application`. Make sure to wrap component with `AppProvider`' ); }); @@ -91,7 +91,7 @@ describe('hooks', () => }); expect(createApp).toThrow( - 'No Context found with `PIXI.Application`. Make sure to wrap component with `AppProvider`' + 'No Context found with `Application`. Make sure to wrap component with `AppProvider`' ); }); diff --git a/packages/react/test/render.spec.js b/packages/react/test/render.spec.js index b521ebcd..a4049a10 100644 --- a/packages/react/test/render.spec.js +++ b/packages/react/test/render.spec.js @@ -45,7 +45,7 @@ describe('render', () => test('invariant container', () => { expect(() => render('something', null)).toThrow( - 'Invalid argument `container`, expected instance of `PIXI.Container`' + 'Invalid argument `container`, expected instance of `Container`' ); });