callstack / callstack/react-native-builder-bob

The C++ Turbo Module template uses a Kotlin implementation on Android

Đang mở
#829 20 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
JavaScript
Star
3.2k
Fork
228
Merge trung bình
7 ngày 12 giờ
Pull request đã merge (30 ngày)
3

Mô tả

### Description

I'm not sure if I'm missing something obvious but when creating the library template for a Turbo Module using C++ for Android & iOS there is a default example implementing a `multiply` function. However, on Android the implementation for this function is in Kotlin and it doesn't use the shared C++ library.

When the JS code calls `multiply` it comes into the code [here](https://github.com/callstack/react-native-builder-bob/blob/main/packages/create-react-native-library/templates/kotlin-library-new/android/src/main/java/com/%7B%25-%20project.package_dir%20%25%7D/%7B%25-%20project.name%20%25%7DModule.kt#L17).

Is there any reason why the `OnLoad.cpp` file isn't used to register the turbo module in this case as described here: [pure-cxx-modules#android](https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules#android)

### Packages

- [x] create-react-native-library
- [ ] react-native-builder-bob

### Selected options

1. `npx create-react-native-library cppLibraryTest`
2. ? What is the name of the npm package? › cpp-lib-test
3. ? What type of library do you want to develop? › Turbo Module
4. ? Which languages do you want to use? › C++ for Android & iOS

### Link to repro

N/A

### Environment

```
System:
OS: macOS 15.0.1
CPU: (11) arm64 Apple M3 Pro
Memory: 90.06 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.7.0
path: /opt/homebrew/bin/node
Yarn:
version: 3.6.1
path: /opt/homebrew/bin/yarn
npm:
version: 11.2.0
path: /opt/homebrew/bin/npm
Watchman:
version: 2025.02.17.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/opt/ruby/bin/pod
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách so sánh các tệp Android được tạo `OnLoad.cpp` và `android/src/main/java/...Module.kt` trong template `kotlin-library-new`, sau đó đọc hướng dẫn React Native được liên kết về pure-C++ cho Android. Xác minh cách lệnh gọi `multiply` được tạo được đăng ký và xác định thay đổi cần thiết đối với template để phần triển khai Android sử dụng module C++ dùng chung.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, kotlin, react-native
Lĩnh vực
mobile, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.