Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
android/
cpp/
ios/
node_modules/
rust_modules/
src/
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 🐛 Bug report
description: Report a reproducible bug or regression in this library.
labels: [bug]
body:
- type: markdown
attributes:
value: |
# Bug report

👋 Hi!

**Please fill the following carefully before opening a new issue ❗**
*(Your issue may be closed if it doesn't provide the required pieces of information)*
- type: checkboxes
attributes:
label: Before submitting a new issue
description: Please perform simple checks first.
options:
- label: I tested using the latest version of the library, as the bug might be already fixed.
required: true
- label: I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native.
required: true
- label: I checked for possible duplicate issues, with possible answers.
required: true
- type: textarea
id: summary
attributes:
label: Bug summary
description: |
Provide a clear and concise description of what the bug is.
If needed, you can also provide other samples: error messages / stack traces, screenshots, gifs, etc.
validations:
required: true
- type: input
id: library-version
attributes:
label: Library version
description: What version of the library are you using?
placeholder: "x.x.x"
validations:
required: true
- type: textarea
id: react-native-info
attributes:
label: Environment info
description: Run `react-native info` in your terminal and paste the results here.
render: shell
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: |
You must provide a clear list of steps and code to reproduce the problem.
value: |
1. …
2. …
validations:
required: true
- type: input
id: reproducible-example
attributes:
label: Reproducible example repository
description: Please provide a link to a repository on GitHub with a reproducible example.
render: js
validations:
required: true
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Feature Request 💡
url: https://github.com/Blockstream/lwk-rn/discussions/new?category=ideas
about: If you have a feature request, please create a new discussion on GitHub.
- name: Discussions on GitHub 💬
url: https://github.com/Blockstream/lwk-rn/discussions
about: If this library works as promised but you need help, please ask questions there.
15 changes: 12 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Cache dependencies
- name: Restore dependencies
id: yarn-cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: |
**/node_modules
Expand All @@ -25,3 +25,12 @@ runs:
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash

- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
38 changes: 22 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI Build
on:
push:
branches:
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -56,13 +56,13 @@ jobs:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Android
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
Expand All @@ -79,7 +79,7 @@ jobs:

- name: Install JDK
if: env.turbo_cache_hit != 1
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand All @@ -91,7 +91,7 @@ jobs:

- name: Cache Gradle
if: env.turbo_cache_hit != 1
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
Expand All @@ -103,24 +103,22 @@ jobs:
- name: Build example for Android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
PAT_USER: ${{ secrets.PAT_USER }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"

build-ios:
runs-on: macos-14
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
Expand All @@ -135,10 +133,10 @@ jobs:
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Cache cocoapods
- name: Restore cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: |
**/ios/Pods
Expand All @@ -147,13 +145,21 @@ jobs:
${{ runner.os }}-cocoapods-

- name: Install cocoapods
#if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
pod install
env:
NO_FLIPPER: 1

- name: Cache cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
**/ios/Pods
key: ${{ steps.cocoapods-cache.outputs.cache-key }}

- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
65 changes: 65 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI Generate
on:
workflow_dispatch:

jobs:
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@1.81.0
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android

- name: Install NDK
run: cargo install cargo-ndk

- name: Fetch LWK
run: sh fetch_lwk.sh

- name: Generate android lib
run: yarn ubrn:android --profile release-smaller

- name: Temporarily save artifact
uses: actions/upload-artifact@v4
with:
name: lwk-android-artifact
path: android
retention-days: 1
build-ios:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@1.81.0
with:
targets: x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim

- name: Fetch LWK
run: sh fetch_lwk.sh

- name: Generate ios lib
run: yarn ubrn:ios --profile release-smaller

- name: Strip ios lib
run: |
strip LwkRnFramework.xcframework/ios-arm64/liblwk.a |
strip LwkRnFramework.xcframework/ios-arm64-simulator/liblwk.a

- name: Temporarily save artifact
uses: actions/upload-artifact@v4
with:
name: lwk-ios-artifact
path: LwkRnFramework.xcframework
retention-days: 1
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
Expand Down Expand Up @@ -80,3 +81,10 @@ lib/
# React Native Codegen
ios/generated
android/generated

# React Native Nitro Modules
nitrogen/

# From uniffi-bindgen-react-native
rust_modules/
*.a
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ To run the example app on iOS:
yarn example ios
```

To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:

```sh
Running "LwkRnExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
```

Note the `"fabric":true` and `"concurrentRoot":true` properties.

Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Luca Vaccaro
Copyright (c) 2025 lvaccaro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
41 changes: 41 additions & 0 deletions LwkRn.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
s.name = "LwkRn"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/Blockstream/lwk-rn.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"

# 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.
if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
else
s.dependency "React-Core"

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
end
end
Loading
Loading