Skip to content

Commit b158716

Browse files
committed
feat: drop sdwebimage, implement svg decoder
1 parent 6f87ff1 commit b158716

File tree

15 files changed

+333
-154
lines changed

15 files changed

+333
-154
lines changed

.changeset/sour-cases-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-bottom-tabs': minor
3+
---
4+
5+
feat: drop SDWebImage, resolve bunch of build issues

CONTRIBUTING.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,7 @@ To run the React Native example app on Android:
3939
yarn workspace react-native-bottom-tabs-example android
4040
```
4141

42-
To run the React Native example app on iOS:
43-
44-
Make sure to install [`cocoapods-swift-modular-headers`](https://github.com/callstack/cocoapods-swift-modular-headers) gem, otherwise `pod install` will fail.
45-
46-
```sh
47-
gem install cocoapods-swift-modular-headers
48-
```
49-
50-
Next you can install cocoapods.
42+
To run the React Native example app on iOS, you need to install cocoapods.
5143

5244
```sh
5345
cd apps/example/ios

apps/example/ios/Podfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plugin 'cocoapods-swift-modular-headers'
1+
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
22

33
ws_dir = Pathname.new(__dir__)
44
ws_dir = ws_dir.parent until
@@ -8,6 +8,4 @@ require "#{ws_dir}/node_modules/react-native-test-app/test_app.rb"
88

99
workspace 'ReactNativeBottomTabsExample.xcworkspace'
1010

11-
apply_modular_headers_for_swift_dependencies()
12-
1311
use_test_app! :hermes_enabled => true, :fabric_enabled => true

apps/example/ios/Podfile.lock

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ PODS:
17481748
- React-RCTFBReactNativeSpec
17491749
- ReactCommon/turbomodule/core
17501750
- SocketRocket
1751-
- react-native-bottom-tabs (0.11.1):
1751+
- react-native-bottom-tabs (0.11.2):
17521752
- boost
17531753
- DoubleConversion
17541754
- fast_float
@@ -1774,8 +1774,6 @@ PODS:
17741774
- ReactCodegen
17751775
- ReactCommon/turbomodule/bridging
17761776
- ReactCommon/turbomodule/core
1777-
- SDWebImage (>= 5.19.1)
1778-
- SDWebImageSVGCoder (>= 1.7.0)
17791777
- SocketRocket
17801778
- SwiftUIIntrospect (~> 1.0)
17811779
- Yoga
@@ -2520,11 +2518,6 @@ PODS:
25202518
- ReactCommon/turbomodule/core
25212519
- SocketRocket
25222520
- Yoga
2523-
- SDWebImage (5.21.1):
2524-
- SDWebImage/Core (= 5.21.1)
2525-
- SDWebImage/Core (5.21.1)
2526-
- SDWebImageSVGCoder (1.8.0):
2527-
- SDWebImage/Core (~> 5.6)
25282521
- SocketRocket (0.7.1)
25292522
- SwiftUIIntrospect (1.3.0)
25302523
- Yoga (0.0.0)
@@ -2614,8 +2607,6 @@ DEPENDENCIES:
26142607

26152608
SPEC REPOS:
26162609
trunk:
2617-
- SDWebImage
2618-
- SDWebImageSVGCoder
26192610
- SocketRocket
26202611
- SwiftUIIntrospect
26212612

@@ -2821,7 +2812,7 @@ SPEC CHECKSUMS:
28212812
React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48
28222813
React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696
28232814
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
2824-
react-native-bottom-tabs: fa973f009e321d7d11dbdb761192ce185948a05a
2815+
react-native-bottom-tabs: ca7796411ccc78911e66cca41a97a18cede4d582
28252816
react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616
28262817
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
28272818
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
@@ -2859,12 +2850,10 @@ SPEC CHECKSUMS:
28592850
RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961
28602851
RNScreens: 0bbf16c074ae6bb1058a7bf2d1ae017f4306797c
28612852
RNVectorIcons: c13cc1db346e960ecd0aafcdd5d0bb458133b9c1
2862-
SDWebImage: f29024626962457f3470184232766516dee8dfea
2863-
SDWebImageSVGCoder: 8e10c8f6cc879c7dfb317b284e13dd589379f01c
28642853
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
28652854
SwiftUIIntrospect: fee9aa07293ee280373a591e1824e8ddc869ba5d
28662855
Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d
28672856

2868-
PODFILE CHECKSUM: e4dd5fac8fa6e00534aac80dc857efbb13ef2723
2857+
PODFILE CHECKSUM: d61a3255405492afdb755f6ddd335fd0f5a84cd3
28692858

28702859
COCOAPODS: 1.16.2

docs/docs/docs/getting-started/quick-start.mdx

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,6 @@ If you are going to use [React Navigation / Expo Router Integration](/docs/guide
1919

2020
<PackageManagerTabs command="install @bottom-tabs/react-navigation" />
2121

22-
<details>
23-
<summary>If you use React Native <b>version 0.75 or lower</b></summary>
24-
25-
- For `@react-native-community/cli` users, open Podfile in ios folder and change minimum iOS version to `14.0` before `pod install`
26-
27-
```diff
28-
- platform :ios, min_ios_version_supported
29-
+ platform :ios, '14.0'
30-
```
31-
32-
- For Expo users, install `expo-build-properties`, open app.json file and update `deploymentTarget` for `ios` as below
33-
34-
```json
35-
{
36-
"expo": {
37-
"plugins": [
38-
[
39-
"expo-build-properties",
40-
{
41-
"ios": {
42-
"deploymentTarget": "14.0"
43-
}
44-
}
45-
]
46-
],
47-
}
48-
}
49-
```
50-
51-
</details>
52-
53-
5422

5523
### Expo
5624

@@ -64,53 +32,6 @@ Add the library plugin in your `app.json` config file and [create a new build](h
6432
}
6533
```
6634

67-
Then install `expo-build-properties` to enable static linking for iOS by adding `"useFrameworks": "static"` in the plugin.
68-
69-
```sh
70-
npx expo install expo-build-properties
71-
```
72-
73-
```diff
74-
{
75-
"expo": {
76-
"plugins": [
77-
"react-native-bottom-tabs",
78-
+ [
79-
+ "expo-build-properties",
80-
+ {
81-
+ "ios": {
82-
+ "useFrameworks": "static"
83-
+ }
84-
+ }
85-
+ ]
86-
+ ]
87-
}
88-
}
89-
```
90-
91-
Alternatively, you can avoid enabling static linking (which can cause problems with your existing packages) by adding the following in the `expo-build-properties` plugin.
92-
93-
```diff
94-
{
95-
"expo": {
96-
"plugins": [
97-
"react-native-bottom-tabs",
98-
+ [
99-
+ "expo-build-properties",
100-
+ {
101-
+ "ios": {
102-
+ "extraPods": [
103-
+ { name: "SDWebImage", modular_headers: true }, // Work around for not enabling static framework, required for react-native-bottom-tabs
104-
+ { name: "SDWebImageSVGCoder", modular_headers: true }
105-
+ ]
106-
+ }
107-
+ }
108-
+ ]
109-
+ ]
110-
}
111-
}
112-
```
113-
11435
:::warning
11536

11637
This library is not supported in [Expo Go](https://expo.dev/go).
@@ -133,12 +54,6 @@ Edit `android/app/src/main/res/values/styles.xml` to inherit from provided theme
13354

13455
Here you can read more about [Android Native Styling](/docs/guides/android-native-styling).
13556

136-
To enable static linking for iOS, Open the `./ios/Podfile` file and add the following:
137-
138-
```ruby
139-
use_frameworks! :linkage => :static
140-
```
141-
14257

14358
## Example usage
14459

packages/react-native-bottom-tabs/ios/Fabric/RCTTabViewComponentView.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ - (instancetype)initWithFrame:(CGRect)frame
6969
{
7070
if (self = [super initWithFrame:frame]) {
7171
static const auto defaultProps = std::make_shared<const RNCTabViewProps>();
72-
_tabViewProvider = [[TabViewProvider alloc] initWithDelegate:self];
72+
// TODO: Find a better way to retrieve ImageLoader module.
73+
RCTImageLoader *imageLoader = [[RCTBridge currentBridge] moduleForName:@"ImageLoader"];
74+
_tabViewProvider = [[TabViewProvider alloc] initWithDelegate:self imageLoader:imageLoader];
7375
self.contentView = _tabViewProvider;
7476
_props = defaultProps;
7577
}

packages/react-native-bottom-tabs/ios/RCTTabViewViewManager.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ - (NSView *)view
7373
- (UIView *) view
7474
#endif
7575
{
76-
return [[TabViewProvider alloc] initWithDelegate:self];
76+
RCTImageLoader *imageLoader = [self.bridge moduleForClass:[RCTImageLoader class]];
77+
return [[TabViewProvider alloc] initWithDelegate:self imageLoader:imageLoader];
7778
}
7879

7980
@end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#import <UIKit/UIKit.h>
2+
3+
@interface CoreSVGWrapper : NSObject
4+
5+
+ (instancetype)sharedWrapper;
6+
7+
- (UIImage *)imageFromSVGData:(NSData *)data;
8+
- (UIImage *)imageFromSVGData:(NSData *)data targetSize:(CGSize)targetSize;
9+
- (UIImage *)imageFromSVGData:(NSData *)data targetSize:(CGSize)targetSize preserveAspectRatio:(BOOL)preserveAspectRatio;
10+
11+
- (BOOL)isSVGData:(NSData *)data;
12+
+ (BOOL)supportsVectorSVG;
13+
14+
@end

0 commit comments

Comments
 (0)