Skip to content
Draft
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: 5 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PODS:
- hermes-engine (0.14.0):
- hermes-engine/Pre-built (= 0.14.0)
- hermes-engine/Pre-built (0.14.0)
- lottie-ios (4.5.2)
- NativeModules (0.0.0):
- boost
- DoubleConversion
Expand Down Expand Up @@ -45,6 +46,7 @@ PODS:
- fmt
- glog
- hermes-engine
- lottie-ios (= 4.5.2)
- NitroModules
- RCT-Folly
- RCT-Folly/Fabric
Expand Down Expand Up @@ -2775,6 +2777,7 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- lottie-ios
- SocketRocket

EXTERNAL SOURCES:
Expand Down Expand Up @@ -2952,8 +2955,9 @@ SPEC CHECKSUMS:
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
hermes-engine: f7b1bbda11bd37179cfea60b5e240f9d508f457c
lottie-ios: 96784afc26ea031d3e2b6cae342a4b8915072489
NativeModules: ee8742cd9a988e76634d564f034090287b5e18a9
NativeViews: ceee020f8f7ec32892b1225b50f0891486f1db83
NativeViews: a8d4810f48eed13bb55807b364dcdd8c19e7eac4
NitroModules: 5bc319d441f4983894ea66b1d392c519536e6d23
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
RCTDeprecation: 2b70c6e3abe00396cefd8913efbf6a2db01a2b36
Expand Down
1 change: 1 addition & 0 deletions native-views/NativeViews.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Pod::Spec.new do |s|

s.dependency 'React-jsi'
s.dependency 'React-callinvoker'
s.dependency 'lottie-ios', '4.5.2'

load 'nitrogen/generated/ios/NativeViews+autolinking.rb'
add_nitrogen_files(s)
Expand Down
1 change: 1 addition & 0 deletions native-views/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
dependencies {
implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.airbnb.android:lottie:6.7.1'
implementation project(":react-native-nitro-modules")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.margelo.nitro.nativeviews

import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieDrawable
import com.facebook.react.uimanager.ThemedReactContext

class HybridLottie(val context: ThemedReactContext): HybridLottieSpec() {
override val view: LottieAnimationView = LottieAnimationView(context).apply {
repeatCount = LottieDrawable.INFINITE
}

private var _url: String = ""
override var url: String
get() = _url
set(value) {
_url = value
view.setAnimationFromUrl(value)
view.playAnimation()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfoProvider
import com.facebook.react.uimanager.ViewManager
import com.margelo.nitro.nativeviews.views.HybridLottieManager

import com.margelo.nitro.nativeviews.views.HybridNativeViewsManager

Expand All @@ -18,7 +19,7 @@ class NativeViewsPackage : BaseReactPackage() {
}

override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
return listOf(HybridNativeViewsManager())
return listOf(HybridNativeViewsManager(), HybridLottieManager())
}

companion object {
Expand Down
28 changes: 28 additions & 0 deletions native-views/ios/LottieView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// LottieView.swift
// Pods
//
// Created by Parsa Nasirimehr on 2025-12-14.
//

import Foundation
import Lottie

class HybridLottie : HybridLottieSpec {
var view: UIView = LottieAnimationView()

var url: String = "" {
didSet {
guard let url = URL(string: url) else { return }
Task {
guard let animation = await LottieAnimation.loadedFrom(url: url) else { return }
await MainActor.run {
guard let lottieView = view as? LottieAnimationView else { return }
lottieView.animation = animation
lottieView.loopMode = .loop
lottieView.play()
}
}
}
}
}
4 changes: 4 additions & 0 deletions native-views/nitro.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"NativeViews": {
"swift": "HybridNativeViews",
"kotlin": "HybridNativeViews"
},
"Lottie": {
"swift": "HybridLottie",
"kotlin": "HybridLottie"
}
},
"ignorePaths": ["node_modules"]
Expand Down
56 changes: 56 additions & 0 deletions native-views/nitrogen/generated/android/c++/JHybridLottieSpec.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions native-views/nitrogen/generated/android/c++/JHybridLottieSpec.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading