Skip to content

Commit ba15d46

Browse files
authored
feat: new arch (#64)
* feat: new arch * fix: make old arch work, change Android color handling * ci: add new arch job
1 parent 1e99a7d commit ba15d46

16 files changed

+554
-127
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,44 @@ jobs:
145145
- name: Build example for iOS
146146
run: |
147147
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
148+
149+
150+
build-ios-newarch:
151+
runs-on: macos-15
152+
env:
153+
TURBO_CACHE_DIR: .turbo/ios-newarch
154+
steps:
155+
- name: Checkout
156+
uses: actions/checkout@v3
157+
158+
- name: Setup
159+
uses: ./.github/actions/setup
160+
161+
- name: Cache turborepo for iOS
162+
uses: actions/cache@v3
163+
with:
164+
path: ${{ env.TURBO_CACHE_DIR }}
165+
key: ${{ runner.os }}-turborepo-ios-newarch-${{ hashFiles('yarn.lock') }}
166+
restore-keys: |
167+
${{ runner.os }}-turborepo-ios-
168+
169+
- name: Check turborepo cache for iOS
170+
run: |
171+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
172+
173+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
174+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
175+
fi
176+
177+
- name: Install cocoapods
178+
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
179+
run: |
180+
cd example
181+
pod install --project-directory=ios
182+
env:
183+
RCT_NEW_ARCH_ENABLED: 1
184+
NO_FLIPPER: 1
185+
186+
- name: Build example for iOS
187+
run: |
188+
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

android/src/main/java/com/rcttabview/RCTTabViewViewManager.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,25 @@ class RCTTabViewViewManager :
6969
view.setIcons(icons)
7070
}
7171

72-
@ReactProp(name = "barTintColor")
72+
@ReactProp(name = "barTintColor", customType = "Color")
7373
fun setBarTintColor(view: ReactBottomNavigationView, color: Int?) {
7474
view.setBarTintColor(color)
7575
}
7676

77-
@ReactProp(name = "rippleColor")
77+
@ReactProp(name = "rippleColor", customType = "Color")
7878
fun setRippleColor(view: ReactBottomNavigationView, rippleColor: Int?) {
7979
if (rippleColor != null) {
8080
val color = ColorStateList.valueOf(rippleColor)
8181
view.setRippleColor(color)
8282
}
8383
}
8484

85-
@ReactProp(name = "activeTintColor")
85+
@ReactProp(name = "activeTintColor", customType = "Color")
8686
fun setActiveTintColor(view: ReactBottomNavigationView, color: Int?) {
8787
view.setActiveTintColor(color)
8888
}
8989

90-
@ReactProp(name = "inactiveTintColor")
90+
@ReactProp(name = "inactiveTintColor", customType = "Color")
9191
fun setInactiveTintColor(view: ReactBottomNavigationView, color: Int?) {
9292
view.setInactiveTintColor(color)
9393
}
@@ -151,7 +151,7 @@ class RCTTabViewViewManager :
151151
}
152152

153153
companion object {
154-
const val NAME = "RCTTabView"
154+
const val NAME = "RNCTabView"
155155
}
156156

157157
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? {

example/ios/Podfile.lock

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,71 @@ PODS:
12321232
- SwiftUIIntrospect (~> 1.0)
12331233
- Yoga
12341234
- react-native-safe-area-context (4.11.0):
1235+
- DoubleConversion
1236+
- glog
1237+
- RCT-Folly (= 2024.01.01.00)
1238+
- RCTRequired
1239+
- RCTTypeSafety
1240+
- React-Core
1241+
- React-debug
1242+
- React-Fabric
1243+
- React-featureflags
1244+
- React-graphics
1245+
- React-ImageManager
1246+
- React-jsi
1247+
- react-native-safe-area-context/common (= 4.11.0)
1248+
- react-native-safe-area-context/fabric (= 4.11.0)
1249+
- React-NativeModulesApple
1250+
- React-RCTFabric
1251+
- React-rendererdebug
1252+
- React-utils
1253+
- ReactCodegen
1254+
- ReactCommon/turbomodule/bridging
1255+
- ReactCommon/turbomodule/core
1256+
- Yoga
1257+
- react-native-safe-area-context/common (4.11.0):
1258+
- DoubleConversion
1259+
- glog
1260+
- RCT-Folly (= 2024.01.01.00)
1261+
- RCTRequired
1262+
- RCTTypeSafety
1263+
- React-Core
1264+
- React-debug
1265+
- React-Fabric
1266+
- React-featureflags
1267+
- React-graphics
1268+
- React-ImageManager
1269+
- React-jsi
1270+
- React-NativeModulesApple
1271+
- React-RCTFabric
1272+
- React-rendererdebug
1273+
- React-utils
1274+
- ReactCodegen
1275+
- ReactCommon/turbomodule/bridging
1276+
- ReactCommon/turbomodule/core
1277+
- Yoga
1278+
- react-native-safe-area-context/fabric (4.11.0):
1279+
- DoubleConversion
1280+
- glog
1281+
- RCT-Folly (= 2024.01.01.00)
1282+
- RCTRequired
1283+
- RCTTypeSafety
12351284
- React-Core
1285+
- React-debug
1286+
- React-Fabric
1287+
- React-featureflags
1288+
- React-graphics
1289+
- React-ImageManager
1290+
- React-jsi
1291+
- react-native-safe-area-context/common
1292+
- React-NativeModulesApple
1293+
- React-RCTFabric
1294+
- React-rendererdebug
1295+
- React-utils
1296+
- ReactCodegen
1297+
- ReactCommon/turbomodule/bridging
1298+
- ReactCommon/turbomodule/core
1299+
- Yoga
12361300
- React-nativeconfig (0.75.3)
12371301
- React-NativeModulesApple (0.75.3):
12381302
- glog
@@ -1491,6 +1555,7 @@ PODS:
14911555
- React-ImageManager
14921556
- React-jsi
14931557
- React-NativeModulesApple
1558+
- React-RCTAppDelegate
14941559
- React-RCTFabric
14951560
- React-rendererdebug
14961561
- React-utils
@@ -1524,6 +1589,29 @@ PODS:
15241589
- ReactCommon/turbomodule/core
15251590
- Yoga
15261591
- RNScreens (3.34.0):
1592+
- DoubleConversion
1593+
- glog
1594+
- RCT-Folly (= 2024.01.01.00)
1595+
- RCTRequired
1596+
- RCTTypeSafety
1597+
- React-Core
1598+
- React-debug
1599+
- React-Fabric
1600+
- React-featureflags
1601+
- React-graphics
1602+
- React-ImageManager
1603+
- React-jsi
1604+
- React-NativeModulesApple
1605+
- React-RCTFabric
1606+
- React-RCTImage
1607+
- React-rendererdebug
1608+
- React-utils
1609+
- ReactCodegen
1610+
- ReactCommon/turbomodule/bridging
1611+
- ReactCommon/turbomodule/core
1612+
- RNScreens/common (= 3.34.0)
1613+
- Yoga
1614+
- RNScreens/common (3.34.0):
15271615
- DoubleConversion
15281616
- glog
15291617
- RCT-Folly (= 2024.01.01.00)
@@ -1578,6 +1666,7 @@ DEPENDENCIES:
15781666
- React-idlecallbacksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`)
15791667
- React-ImageManager (from `../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`)
15801668
- React-jsc (from `../node_modules/react-native/ReactCommon/jsc`)
1669+
- React-jsc/Fabric (from `../node_modules/react-native/ReactCommon/jsc`)
15811670
- React-jserrorhandler (from `../node_modules/react-native/ReactCommon/jserrorhandler`)
15821671
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
15831672
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
@@ -1804,9 +1893,9 @@ SPEC CHECKSUMS:
18041893
React-performancetimeline: d15a723422ed500f47cb271f3175abbeb217f5ba
18051894
React-RCTActionSheet: cb2b38a53d03ec22f1159c89667b86c2c490d92d
18061895
React-RCTAnimation: 6836c87c7364f471e9077fda80b7349bc674be33
1807-
React-RCTAppDelegate: fb2037d3472bda5c31ea16a04cc48e19fe81c792
1896+
React-RCTAppDelegate: 8939a29da847bc51a01264d020a58d9d5035e119
18081897
React-RCTBlob: 984c80df29f3b3e3193bfbc2768bd302c889719b
1809-
React-RCTFabric: 5e691cfb4cd3a9060ddbfb04916284c3c6a933e8
1898+
React-RCTFabric: 4bb022567aacec7417d04741cba7e7baaeec6add
18101899
React-RCTImage: 1b2c2c1716db859ffff2d7a06a30b0ec5c677fc5
18111900
React-RCTLinking: 59c07577767e705b0ab95d11e5ad74c61bf2a022
18121901
React-RCTNetwork: f9a827e7d6bc428e0d99cd1fbe0427854354b8c1
@@ -1834,4 +1923,4 @@ SPEC CHECKSUMS:
18341923

18351924
PODFILE CHECKSUM: 539add55dc6c2e7f9754e288b1ce4fd8583819ae
18361925

1837-
COCOAPODS: 1.15.2
1926+
COCOAPODS: 1.14.3

example/src/Examples/NativeBottomTabs.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ const Tab = createNativeBottomTabNavigator();
1111
function NativeBottomTabs() {
1212
return (
1313
<Tab.Navigator
14-
tabBarInactiveTintColor="red"
15-
tabBarActiveTintColor="orange"
14+
tabBarInactiveTintColor="#C57B57"
15+
tabBarActiveTintColor="#F7DBA7"
16+
barTintColor="#1E2D2F"
17+
rippleColor="#041F1E"
1618
screenListeners={{
1719
tabLongPress: (data) => {
1820
console.log(
@@ -59,7 +61,7 @@ function NativeBottomTabs() {
5961
component={Chat}
6062
options={{
6163
tabBarIcon: () => require('../../assets/icons/chat_dark.png'),
62-
tabBarActiveTintColor: 'purple',
64+
tabBarActiveTintColor: 'white',
6365
}}
6466
/>
6567
</Tab.Navigator>

ios/Extensions.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ extension UIView {
2727
])
2828
}
2929
}
30+
31+
extension UIImage {
32+
func resizeImageTo(size: CGSize) -> UIImage? {
33+
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
34+
self.draw(in: CGRect(origin: CGPoint.zero, size: size))
35+
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()!
36+
UIGraphicsEndImageContext()
37+
return resizedImage
38+
}
39+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifdef RCT_NEW_ARCH_ENABLED
2+
#import <React/RCTViewComponentView.h>
3+
#import <UIKit/UIKit.h>
4+
5+
NS_ASSUME_NONNULL_BEGIN
6+
7+
@interface RCTTabViewComponentView: RCTViewComponentView
8+
@end
9+
10+
NS_ASSUME_NONNULL_END
11+
12+
#endif /* RCT_NEW_ARCH_ENABLED */

0 commit comments

Comments
 (0)