Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows and macOS platforms #1000

Merged
merged 2 commits into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions src/ReanimatedModule.js
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 3 additions & 0 deletions src/ReanimatedModule.macos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ReanimatedModuleCompat from './ReanimatedModuleCompat';

export default ReanimatedModuleCompat;
3 changes: 3 additions & 0 deletions src/ReanimatedModule.windows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ReanimatedModuleCompat from './ReanimatedModuleCompat';

export default ReanimatedModuleCompat;
jakub-gonet marked this conversation as resolved.
Show resolved Hide resolved
26 changes: 26 additions & 0 deletions src/ReanimatedModuleCompat.js
Original file line number Diff line number Diff line change
@@ -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');
},
};
2 changes: 1 addition & 1 deletion src/core/AnimatedEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/AnimatedNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/core/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down