Skip to content

Commit

Permalink
61 replace kingfisher with nuke (#62)
Browse files Browse the repository at this point in the history
* refactor(iOS): wip

* refactor(iOS): wip

* refactor(iOS): replace kingifhser with nuke

* docs: update readme

* docs: update readme

* ci: disable build ios
  • Loading branch information
duguyihou authored Dec 7, 2023
1 parent f45583f commit c83278e
Show file tree
Hide file tree
Showing 49 changed files with 122,672 additions and 77 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ jobs:
env:
NO_FLIPPER: 1

- name: Build example for iOS
run: |
# yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
yarn turbo run build:ios
# - name: Build example for iOS
# run: |
# # yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
# yarn turbo run build:ios

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# react-native-turbo-image

Performant React Native image component. Powered by [Kingfisher](https://github.com/onevcat/Kingfisher) and [Coil](https://github.com/coil-kt/coil)
Performant React Native image component. Powered by [Nuke](https://github.com/kean/Nuke) and [Coil](https://github.com/coil-kt/coil)

## Features

Expand All @@ -26,7 +26,8 @@ import TurboImage from "react-native-turbo-image";
url={url}
style={styles.box}
showActivityIndicator
base64Placeholder={base64Placeholder}
cachePolicy="dataCache"
blurhash="LMDSzI~pV=RO9ZV@xv%MRPRlxuog"
/>
```

Expand All @@ -40,7 +41,7 @@ import TurboImage from "react-native-turbo-image";
| showActivityIndicator | boolean | false | Whether to show the UIActivityIndicatorView indicator when loading |
| base64Placeholder | string | | The base64 encoded placeholder image to show while loading |
| blurhash | string | | The blurhash of the image to show while loading |
| cachePolicy | string | shared | The cache policy of the image |
| cachePolicy | string | memory | The cache policy of the image |
| fadeDuration | number | 0.5 | The transition duration of the image |
| rounded | boolean | false | Round the image into a circle |
| onError | function | | The function to call when an error occurs. |
Expand Down
2 changes: 1 addition & 1 deletion ReactNativeTurboImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/duguyihou/react-native-turbo-image.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift}"
s.dependency "Kingfisher", "~> 7.0"
s.vendored_frameworks = "ios/*.{xcframework}"

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down
20 changes: 9 additions & 11 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import { SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native';
import TurboImage from 'react-native-turbo-image';
import { base64Placeholder, blurhashString } from './mockData';
import { blurhashString } from './mockData';

export default function App() {
const imageURLs = Array.from(
{ length: 100 },
(_, i) => `https://placedog.net/300/200?id=${i}`
);
const handleOnSuccess = () => {};
const handleOnError = (error: any) => {
console.log(`🐵 ------ error`, error);
};
// const handleOnSuccess = () => {};
// const handleOnError = (error: any) => {
// console.log(`🐵 ------ error`, error);
// };
return (
<SafeAreaView style={styles.container}>
<ScrollView
Expand All @@ -24,16 +24,14 @@ export default function App() {
key={idx}
url={url}
style={styles.box}
resizeMode="stretch"
showActivityIndicator
// fadeDuration={10}
blurhash={blurhashString}
base64Placeholder={base64Placeholder}
// base64Placeholder={base64Placeholder}
// rounded
// tintColor="red"
cachePolicy="memory"
onSuccess={handleOnSuccess}
onError={handleOnError}
cachePolicy="dataCache"
// onSuccess={handleOnSuccess}
// onError={handleOnError}
/>
))}
</ScrollView>
Expand Down
44 changes: 44 additions & 0 deletions ios/Nuke.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>Nuke.framework/Nuke</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Nuke.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>Nuke.framework/Nuke</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>Nuke.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Loading

0 comments on commit c83278e

Please sign in to comment.