Skip to content

Assets not linked if not linking dependencies #584

@olistic

Description

@olistic

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
      Memory: 32.57 MB / 16.00 GB
      Shell: 5.7.1 - /usr/local/bin/zsh
    Binaries:
      Node: 12.4.0 - /usr/local/bin/node
      Yarn: 1.16.0 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild

Description

For react-native-cli version 1.3.0, project assets are not linked when running react-native link if not linking dependencies. I think the bug is at this line. linkAssets is called for each dependency config, instead of only once after having collected all the assets.

I managed to link my assets by making this change:

const tasks = flatten(
    depenendenciesConfig.map(config => [
      () => promisify(config.commands.prelink || commandStub),
      () => linkDependency(platforms, project, config),
      () => promisify(config.commands.postlink || commandStub),
-      () => linkAssets(platforms, project, assets),
    ]),
-  );
+  ).concat([
+    () => linkAssets(platforms, project, assets),
+  ]);

I can submit a PR after you guys confirm this is actually a bug and that is a proper fix.

Thanks!

Reproducible Demo

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions