I wouldn't be posting here if I wasn't having a ton of problems and if I had not spent several days trying to link a library correctly in React Native. Mostly I haven't had issues, but this particular library has seemingly been almost impossible.
https://github.com/jerson/react-native-palette-full
Here's my code, which is very basic:
import Palette from "react-native-palette-full";
componentDidMount() {
Palette.getAllSwatchesFromUrl(this.state.merchant.coverPhoto);
}
Exactly what you would expect from the instructions on the library.
Instead I am getting this:
I've tried linking it manually:
react-native link react-native-palette-full
I've tried these manual installation instructions:
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-palette-full and add RNPalette.xcodeproj
In XCode, in the project navigator, select your project. Add libRNPalette.a to your project's Build Phases ➜ Link Binary With Libraries
Go to Podfile and add "SDWebImage", "~>4.3.3"
Run your project (Cmd+R)<
This just leads to RNPalette not being found, despite the project being right there under my libraries in Xcode.
How can I troubleshoot this and get it working? I'm quite literally tearing my hair out - all I want to do is get a color swatch from an image, and it seems virtually impossible in React Native.
I am on RN .60
EDIT:
I have been trying linking manually, and I am consistently getting the error, no matter what I try, that ImageLoader can't be found:
#import <React/RCTImageLoader.h> 'React/RCTImageLoader.h' file not found
I have also tried adding it as a dependency in the podspec file in the library:
Pod::Spec.new do |s|
s.name = "RNPalette"
s.version = "1.0.0"
s.summary = "RNPalette"
s.description = <<-DESC
Info about colors from images or url, compatible with **Android** and **iOS**
DESC
s.homepage = "https://github.com/jerson/react-native-palette-full"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "jeral17@gmail.com" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/jerson/react-native-palette-full.git", :tag => "master" }
s.source_files = "RNPalette/**/*.{h,m}"
s.requires_arc = true
s.dependency "React"
s.dependency "SDWebImage", "~>4.3.3"
s.dependency 'React-Core'
s.dependency 'React-RCTImage'
end
How can I link this library? Is there any way?
from Troubleshooting linking library in React Native

No comments:
Post a Comment