Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
e7b421e
device-utils
huhuanming Dec 17, 2025
bd8a81a
update @onekeyfe/react-native-device-utils
huhuanming Dec 17, 2025
3c8b3e7
add code
huhuanming Dec 17, 2025
f80b01c
Update ReactNativeDeviceUtils.swift
huhuanming Dec 17, 2025
8e5f484
Update ReactNativeDeviceUtils.nitro.ts
huhuanming Dec 17, 2025
b9a119a
Update ReactNativeDeviceUtils.swift
huhuanming Dec 17, 2025
28bbf65
fix: fix color
huhuanming Dec 17, 2025
803953f
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
6f81d61
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
d486614
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
dda7b07
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
7308968
workspace
huhuanming Dec 17, 2025
b63b4d2
Update build.gradle
huhuanming Dec 17, 2025
3aebc39
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
da2bdfd
Update ReactNativeDeviceUtils.nitro.ts
huhuanming Dec 17, 2025
b9e8e40
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
32c93eb
Update ReactNativeDeviceUtils.swift
huhuanming Dec 17, 2025
787fab2
Update ReactNativeDeviceUtils.swift
huhuanming Dec 17, 2025
8ca79c0
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
71b69d1
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
f3687c0
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
ab53599
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
a760e48
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
0bd5061
fix: fix dual check
huhuanming Dec 17, 2025
9f58bfd
fix: fix events
huhuanming Dec 17, 2025
33536b8
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
4eba40a
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
e493a83
Update ReactNativeDeviceUtils.kt
huhuanming Dec 17, 2025
effa00f
add react-native-device-utils
huhuanming Dec 17, 2025
1a5d7c3
init react-native-skeleton
huhuanming Dec 18, 2025
82f48d8
@onekeyfe/react-native-skeleton
huhuanming Dec 18, 2025
c82d3cb
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
e690cdf
Update package.json
huhuanming Dec 18, 2025
3ae0cf8
Update route.tsx
huhuanming Dec 18, 2025
81494b6
Refactor imports and style in Skeleton components
huhuanming Dec 18, 2025
c4a1a3d
Update Podfile.lock
huhuanming Dec 18, 2025
e2436a6
Update Skeleton.nitro.ts
huhuanming Dec 18, 2025
f7676a7
create template
huhuanming Dec 18, 2025
8fdc3b9
fix: fix code
huhuanming Dec 18, 2025
80cd8d6
Add shimmerGradientColors prop to Skeleton component
huhuanming Dec 18, 2025
a1229e9
Update Skeleton.swift
huhuanming Dec 18, 2025
41b2cdf
Update Skeleton.swift
huhuanming Dec 18, 2025
7eb43b3
Update Skeleton.swift
huhuanming Dec 18, 2025
6cdc50f
Revert "Update Skeleton.swift"
huhuanming Dec 18, 2025
e964228
Update Skeleton.swift
huhuanming Dec 18, 2025
49433b0
Update Skeleton.swift
huhuanming Dec 18, 2025
c18d3ca
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
84e0bae
Update Skeleton.swift
huhuanming Dec 18, 2025
ee2bc08
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
123904b
Update Skeleton.swift
huhuanming Dec 18, 2025
fbb9835
Update Skeleton.swift
huhuanming Dec 18, 2025
65dd3ed
fix: fix all
huhuanming Dec 18, 2025
ebafc8a
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
7bb25ab
Update Skeleton.swift
huhuanming Dec 18, 2025
f019192
Update Skeleton.swift
huhuanming Dec 18, 2025
22e1c6a
fix: fix error
huhuanming Dec 18, 2025
85a4729
fix: fix version
huhuanming Dec 18, 2025
f9773c8
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
e3120e5
Update package.json
huhuanming Dec 18, 2025
6b83734
Update SkeletonTestPage.tsx
huhuanming Dec 18, 2025
f9a0606
Update package.json
huhuanming Dec 18, 2025
2423be2
Update yarn.lock
huhuanming Dec 27, 2025
2859053
Update Skeleton.kt
huhuanming Dec 27, 2025
34a8b84
Update Skeleton.swift
huhuanming Dec 27, 2025
6ee74b1
Update Skeleton.swift
huhuanming Dec 27, 2025
5b69583
Update Skeleton.swift
huhuanming Dec 27, 2025
b559992
update version
huhuanming Dec 27, 2025
af9c649
Merge branch 'main' into device-utiles
huhuanming Dec 27, 2025
6e5422f
Update yarn.lock
huhuanming Dec 27, 2025
f5fd20b
Update ReactNativeDeviceUtils.kt
huhuanming Dec 31, 2025
eb8691b
Update .gitignore
huhuanming Jan 3, 2026
e11332a
Create commit.md
huhuanming Jan 3, 2026
4cfc7e6
🐛 fix: improve memory safety and cleanup in Skeleton component
huhuanming Jan 3, 2026
52210c4
Merge branch 'main' into device-utiles
huhuanming Jan 3, 2026
5639ff1
fix: fix memory leak
huhuanming Jan 3, 2026
853f5cb
patch version
huhuanming Jan 4, 2026
4a213bc
Update Skeleton.swift
huhuanming Jan 4, 2026
fcdda9e
Update commit.md
huhuanming Jan 4, 2026
eb14d4c
Update commit.md
huhuanming Jan 4, 2026
88a569d
Update Skeleton.swift
huhuanming Jan 5, 2026
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
161 changes: 161 additions & 0 deletions .claude/commands/commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Claude Command: Commit

This command helps you create well-formatted commits with conventional commit messages.

## Usage

To create a commit, just type:
```
/commit
```

Or with options:
```
/commit --no-verify
```

## What This Command Does

1. Unless specified with `--no-verify`, automatically runs pre-commit checks:
- `yarn lint` to ensure code quality
2. Checks which files are staged with `git status`
3. If 0 files are staged, automatically adds all modified and new files with `git add`
4. Performs a `git diff` to understand what changes are being committed
5. Analyzes the diff to determine if multiple distinct logical changes are present
6. If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits
7. For each commit (or the single commit if not split), creates a commit message using conventional commit format

## Best Practices for Commits

- **Verify before committing**: Ensure code is linted, builds correctly, and documentation is updated
- **Atomic commits**: Each commit should contain related changes that serve a single purpose
- **Split large changes**: If changes touch multiple concerns, split them into separate commits
- **Conventional commit format**: Use the format `<type>: <description>` where type is one of:
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation changes
- `style`: Code style changes (formatting, etc)
- `refactor`: Code changes that neither fix bugs nor add features
- `perf`: Performance improvements
- `test`: Adding or fixing tests
- `chore`: Changes to the build process, tools, etc.
- **Present tense, imperative mood**: Write commit messages as commands (e.g., "add feature" not "added feature")
- **Concise first line**: Keep the first line under 72 characters
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation
- `style`: Formatting/style
- `refactor`: Code refactoring
- `perf`: Performance improvements
- `test`: Tests
- `chore`: Tooling, configuration
- `ci`: CI/CD improvements
- `revert`: Reverting changes
- `test`: Add a failing test
- `fix`: Fix compiler/linter warnings
- `fix`: Fix security issues
- `chore`: Add or update contributors
- `refactor`: Move or rename resources
- `refactor`: Make architectural changes
- `chore`: Merge branches
- `chore`: Add or update compiled files or packages
- `chore`: Add a dependency
- `chore`: Remove a dependency
- `chore`: Add or update seed files
- `chore`: Improve developer experience
- `feat`: Add or update code related to multithreading or concurrency
- `feat`: Improve SEO
- `feat`: Add or update types
- `feat`: Add or update text and literals
- `feat`: Internationalization and localization
- `feat`: Add or update business logic
- `feat`: Work on responsive design
- `feat`: Improve user experience / usability
- `fix`: Simple fix for a non-critical issue
- `fix`: Catch errors
- `fix`: Update code due to external API changes
- `fix`: Remove code or files
- `style`: Improve structure/format of the code
- `fix`: Critical hotfix
- `chore`: Begin a project
- `chore`: Release/Version tags
- `wip`: Work in progress
- `fix`: Fix CI build
- `chore`: Pin dependencies to specific versions
- `ci`: Add or update CI build system
- `feat`: Add or update analytics or tracking code
- `fix`: Fix typos
- `revert`: Revert changes
- `chore`: Add or update license
- `feat`: Introduce breaking changes
- `assets`: Add or update assets
- `feat`: Improve accessibility
- `docs`: Add or update comments in source code
- `db`: Perform database related changes
- `feat`: Add or update logs
- `fix`: Remove logs
- `test`: Mock things
- `feat`: Add or update an easter egg
- `chore`: Add or update .gitignore file
- `test`: Add or update snapshots
- `experiment`: Perform experiments
- `feat`: Add, update, or remove feature flags
- `ui`: Add or update animations and transitions
- `refactor`: Remove dead code
- `feat`: Add or update code related to validation
- `feat`: Improve offline support

## Guidelines for Splitting Commits

When analyzing the diff, consider splitting commits based on these criteria:

1. **Different concerns**: Changes to unrelated parts of the codebase
2. **Different types of changes**: Mixing features, fixes, refactoring, etc.
3. **File patterns**: Changes to different types of files (e.g., source code vs documentation)
4. **Logical grouping**: Changes that would be easier to understand or review separately
5. **Size**: Very large changes that would be clearer if broken down

## Examples

Good commit messages:
- feat: add user authentication system
- fix: resolve memory leak in rendering process
- docs: update API documentation with new endpoints
- refactor: simplify error handling logic in parser
- fix: resolve linter warnings in component files
- chore: improve developer tooling setup process
- feat: implement business logic for transaction validation
- fix: address minor styling inconsistency in header
- fix: patch critical security vulnerability in auth flow
- style: reorganize component structure for better readability
- fix: remove deprecated legacy code
- feat: add input validation for user registration form
- fix: resolve failing CI pipeline tests
- feat: implement analytics tracking for user engagement
- fix: strengthen authentication password requirements
- feat: improve form accessibility for screen readers

Example of splitting commits:
- First commit: feat: add new solc version type definitions
- Second commit: docs: update documentation for new solc versions
- Third commit: chore: update package.json dependencies
- Fourth commit: feat: add type definitions for new API endpoints
- Fifth commit: feat: improve concurrency handling in worker threads
- Sixth commit: fix: resolve linting issues in new code
- Seventh commit: test: add unit tests for new solc version features
- Eighth commit: fix: update dependencies with security vulnerabilities

## Command Options

- `--no-verify`: Skip running the pre-commit checks (lint, build, generate:docs)

## Important Notes

- By default, pre-commit checks (`yarn lint`) will run to ensure code quality
- If these checks fail, you'll be asked if you want to proceed with the commit anyway or fix the issues first
- If specific files are already staged, the command will only commit those files
- If no files are staged, it will automatically stage all modified and new files
- The commit message will be constructed based on the changes detected
- Before committing, the command will review the diff to identify if multiple commits would be more appropriate
- If suggesting multiple commits, it will help you stage and commit the changes separately
- Always reviews the commit diff to ensure the message matches the changes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ test-report.html

# Ignore tamagui config file
.tamagui
scripts/nitro-view/template/android/.gradle
2 changes: 1 addition & 1 deletion example/react-native/pages/DeviceUtilsTestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function DeviceUtilsTestPage({ onGoHome, safeAreaInsets }: DeviceUtilsTes
clearResults();
try {
if (!spanningCallbackActive) {
deviceUtils.onSpanningChanged((spanning: boolean) => {
deviceUtils.addSpanningChangedListener((spanning: boolean) => {
setIsSpanning(spanning);
setResult({
spanningCallbackTriggered: true,
Expand Down
2 changes: 1 addition & 1 deletion native-modules/react-native-background-thread/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-background-thread",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-background-thread",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-check-biometric-auth-changed",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-check-biometric-auth-changed",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion native-modules/react-native-cloud-kit-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-cloud-kit-module",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-cloud-kit-module",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import androidx.core.util.Consumer
import androidx.window.layout.FoldingFeature
import androidx.window.layout.WindowInfoTracker
import androidx.window.layout.WindowLayoutInfo
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.bridge.LifecycleEventListener
import com.facebook.react.bridge.ReactApplicationContext
import com.margelo.nitro.NitroModules
import com.margelo.nitro.core.Promise
import java.util.concurrent.Executor
import java.util.concurrent.CopyOnWriteArrayList

data class Listener(
val id: Double,
Expand All @@ -28,24 +30,15 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
private var isSpanning = false
private var layoutInfoConsumer: Consumer<WindowLayoutInfo>? = null
private var windowInfoTracker: WindowInfoTracker? = null
private var spanningChangedListeners: MutableList<Listener> = mutableListOf()
private var callbackAdapter: WindowInfoTrackerCallbackAdapter? = null
private var spanningChangedListeners: MutableList<Listener> = CopyOnWriteArrayList()
private var isObservingLayoutChanges = false
private var nextListenerId = 0.0
private var isDualScreenDeviceDetected: Boolean? = null

companion object {
private var reactContext: ReactApplicationContext? = null

fun setReactContext(context: ReactApplicationContext) {
reactContext = context
}
}

init {
NitroModules.applicationContext?.let { ctx ->
ctx.addLifecycleEventListener(this)
} ?: run {

}
}

Expand Down Expand Up @@ -241,12 +234,12 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
}
}

override fun addSpanningChangedListener(callback: (isSpanning: Boolean) -> Unit): Double {
var id = nextListenerId
override fun addSpanningChangedListener(callback: (isSpanning: Boolean) -> Unit): Double = synchronized(this) {
val id = nextListenerId
nextListenerId++
val listener = Listener(id, callback)
spanningChangedListeners.add(listener)
return id
return@synchronized id
Comment thread
huhuanming marked this conversation as resolved.
}

override fun removeSpanningChangedListener(id: Double) {
Expand All @@ -272,11 +265,14 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven

// Use main executor for callbacks
val mainExecutor: Executor = ContextCompat.getMainExecutor(activity)

// Subscribe to window layout changes using the Java adapter
val callbackAdapter = androidx.window.java.layout.WindowInfoTrackerCallbackAdapter(windowInfoTracker!!)
callbackAdapter = WindowInfoTrackerCallbackAdapter(windowInfoTracker!!)

callbackAdapter.addWindowLayoutInfoListener(
if (callbackAdapter == null) {
return
}
Comment thread
huhuanming marked this conversation as resolved.
callbackAdapter!!.addWindowLayoutInfoListener(
Comment thread
huhuanming marked this conversation as resolved.
activity,
mainExecutor,
layoutInfoConsumer!!
Expand All @@ -292,14 +288,18 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
return
}
isObservingLayoutChanges = false
if (windowInfoTracker != null && layoutInfoConsumer != null) {
try {
// The listener will be cleaned up when the activity is destroyed
layoutInfoConsumer = null
windowInfoTracker = null
} catch (e: Exception) {
// Ignore cleanup errors

// Properly clean up window layout listener
try {
if (callbackAdapter != null && layoutInfoConsumer != null) {
callbackAdapter!!.removeWindowLayoutInfoListener(layoutInfoConsumer!!)
Comment thread
huhuanming marked this conversation as resolved.
}
} catch (e: Exception) {
// Ignore cleanup errors
} finally {
callbackAdapter = null
layoutInfoConsumer = null
windowInfoTracker = null
}
}

Expand All @@ -321,8 +321,14 @@ class ReactNativeDeviceUtils : HybridReactNativeDeviceUtilsSpec(), LifecycleEven
val activity = getCurrentActivity() ?: return
activity.runOnUiThread {
try {
// Clamp color values to valid range [0, 255]
val red = Math.max(0, Math.min(255, r.toInt()))
val green = Math.max(0, Math.min(255, g.toInt()))
val blue = Math.max(0, Math.min(255, b.toInt()))
val alpha = Math.max(0, Math.min(255, a.toInt()))
Comment thread
huhuanming marked this conversation as resolved.

val rootView = activity.window.decorView
rootView.rootView.setBackgroundColor(Color.rgb(r.toInt(), g.toInt(), b.toInt()))
rootView.rootView.setBackgroundColor(Color.argb(alpha, red, green, blue))
} catch (e: Exception) {
e.printStackTrace()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.facebook.react.module.model.ReactModuleInfoProvider
class ReactNativeDeviceUtilsPackage : BaseReactPackage() {
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
// Set the React context for the DeviceUtils module
ReactNativeDeviceUtils.setReactContext(reactContext)
return null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ class ReactNativeDeviceUtils: HybridReactNativeDeviceUtilsSpec {

public func changeBackgroundColor(r: Double, g: Double, b: Double, a: Double) throws -> Void {
DispatchQueue.main.async {
let color = UIColor(red: r/255, green: g/255, blue: b/255, alpha: a/255)
let rootViewController = UIApplication.shared.delegate?.window??.rootViewController
rootViewController?.view.backgroundColor = color
// Clamp color values to valid range [0, 255]
let red = max(0, min(255, r))
let green = max(0, min(255, g))
let blue = max(0, min(255, b))
let alpha = max(0, min(255, a))

Comment thread
huhuanming marked this conversation as resolved.
let color = UIColor(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: alpha/255.0)

// Fix optional chaining syntax
if let window = UIApplication.shared.delegate?.window,
let rootViewController = window?.rootViewController {
rootViewController.view.backgroundColor = color
}
}
}
}
2 changes: 1 addition & 1 deletion native-modules/react-native-device-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-device-utils",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-device-utils",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion native-modules/react-native-get-random-values/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-get-random-values",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-get-random-values",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion native-modules/react-native-keychain-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-keychain-module",
"version": "1.1.12",
"version": "1.1.13",
"description": "react-native-keychain-module",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion native-modules/react-native-lite-card/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-lite-card",
"version": "1.1.12",
"version": "1.1.13",
"description": "lite card",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down
Loading