Skip to content

[Packager] RCTPOPAnimationManager.js - syntax error after conversion with babel #1526

@johanneslumpe

Description

@johanneslumpe

In Libraries/BatchedBridge/BatchedBridgedModules/POPAnimation.js the following block is invalid after transpiling it with babel:

var RCTPOPAnimationManager = require('NativeModules').POPAnimationManager;
if (!RCTPOPAnimationManager) {
  // POP animation isn't available in the OSS fork - this is a temporary
  // workaround to enable its availability to be determined at runtime.
  // For Flow let's pretend like we always export POPAnimation
  // so all our users don't need to do null checks
  module.exports = ((null: any): typeof POPAnimation);
} else {
  /*...*/
}

It will turn to

'use strict';

var RCTPOPAnimationManager = require('NativeModules').POPAnimationManager;
if (!RCTPOPAnimationManager) {
  // POP animation isn't available in the OSS fork - this is a temporary
  // workaround to enable its availability to be determined at runtime.
  // For Flow let's pretend like we always export POPAnimation
  // so all our users don't need to do null checks
  module.exports = ;
} else {
  /* ... */
}

resulting in a syntax error because of the broken moule.exports assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions