diff --git a/src/ReanimatedModule.js b/src/ReanimatedModule.js index 42714e4593d..79b33400a0e 100644 --- a/src/ReanimatedModule.js +++ b/src/ReanimatedModule.js @@ -1,26 +1,3 @@ -export default { - async disconnectNodeFromView() { - // noop - }, - async attachEvent(viewTag, eventName, nodeID) { - // noop - }, - async detachEvent(viewTag, eventName, nodeID) { - // noop - }, - async createNode(nodeID, config) { - // noop - }, - async dropNode(nodeID) { - // noop - }, - async configureProps() { - // noop - }, - async disconnectNodes() { - // noop - }, - async animateNextTransition() { - console.warn('Reanimated: animateNextTransition is unimplemented on web'); - }, -}; +import ReanimatedModuleCompat from './ReanimatedModuleCompat'; + +export default ReanimatedModuleCompat; diff --git a/src/ReanimatedModule.macos.js b/src/ReanimatedModule.macos.js new file mode 100644 index 00000000000..79b33400a0e --- /dev/null +++ b/src/ReanimatedModule.macos.js @@ -0,0 +1,3 @@ +import ReanimatedModuleCompat from './ReanimatedModuleCompat'; + +export default ReanimatedModuleCompat; diff --git a/src/ReanimatedModule.windows.js b/src/ReanimatedModule.windows.js new file mode 100644 index 00000000000..79b33400a0e --- /dev/null +++ b/src/ReanimatedModule.windows.js @@ -0,0 +1,3 @@ +import ReanimatedModuleCompat from './ReanimatedModuleCompat'; + +export default ReanimatedModuleCompat; diff --git a/src/ReanimatedModuleCompat.js b/src/ReanimatedModuleCompat.js new file mode 100644 index 00000000000..4fa302fb3b4 --- /dev/null +++ b/src/ReanimatedModuleCompat.js @@ -0,0 +1,26 @@ +export default { + async disconnectNodeFromView() { + // noop + }, + async attachEvent(viewTag, eventName, nodeID) { + // noop + }, + async detachEvent(viewTag, eventName, nodeID) { + // noop + }, + async createNode(nodeID, config) { + // noop + }, + async dropNode(nodeID) { + // noop + }, + async configureProps() { + // noop + }, + async disconnectNodes() { + // noop + }, + async animateNextTransition() { + console.warn('Reanimated: animateNextTransition is unimplemented on current platform'); + }, +}; diff --git a/src/core/AnimatedEvent.js b/src/core/AnimatedEvent.js index b6b4dd5d2e0..024f1cd4667 100644 --- a/src/core/AnimatedEvent.js +++ b/src/core/AnimatedEvent.js @@ -15,7 +15,7 @@ function sanitizeArgMapping(argMapping) { const alwaysNodes = []; const getNode = node => { - if (Platform.OS === 'web') { + if (Platform.OS === 'web' || Platform.OS === 'windows' || Platform.OS === 'macos') { return node; } return node.__nodeID; diff --git a/src/core/AnimatedNode.js b/src/core/AnimatedNode.js index b91eb009121..567d7135277 100644 --- a/src/core/AnimatedNode.js +++ b/src/core/AnimatedNode.js @@ -17,7 +17,7 @@ export function setCallID(nextCallID) { } function sanitizeConfig(config) { - if (Platform.OS === 'web' || ['undefined', 'string', 'function', 'boolean', 'number'].includes(typeof config)) { + if (Platform.OS === 'web' || Platform.OS === 'windows' || Platform.OS === 'macos' || ['undefined', 'string', 'function', 'boolean', 'number'].includes(typeof config)) { return config; } else if (Array.isArray(config)) { return config.map(sanitizeConfig); diff --git a/src/core/AnimatedValue.js b/src/core/AnimatedValue.js index fca5d8304f0..aa3e9fb3416 100644 --- a/src/core/AnimatedValue.js +++ b/src/core/AnimatedValue.js @@ -9,7 +9,7 @@ import ReanimatedModule from '../ReanimatedModule'; export default class AnimatedValue extends InternalAnimatedValue { setValue(value) { this.__detachAnimation(this._animation); - if (Platform.OS === 'web') { + if (Platform.OS === 'web' || Platform.OS === 'windows' || Platform.OS === 'macos') { this._updateValue(value); } else { if (ReanimatedModule.setValue && typeof value === "number") {