-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add proper LaunchScreen to iOS app * Add bottom tabs * Bottom view * Add Benchmarks screen * feat: Improve benchmarks screen * feat: Create ExampleTurboModule for `addNumbers(..)` benchmark * fix: Make benchmark work * Add text to explain start * feat: Implement ExampleTurboModule on Android * Fix elevation
- Loading branch information
Showing
23 changed files
with
666 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
example/android/app/src/main/java/com/nitroexample/exampleturbomodule/ExampleTurboModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.nitroexample.exampleturbomodule | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext | ||
|
||
class ExampleTurboModuleModule(reactContext: ReactApplicationContext) : NativeExampleTurboModuleSpec(reactContext) { | ||
override fun getName() = NAME | ||
|
||
override fun addNumbers(a: Double, b: Double): Double { | ||
return a + b | ||
} | ||
|
||
companion object { | ||
const val NAME = "ExampleTurboModule" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ndroid/app/src/main/java/com/nitroexample/exampleturbomodule/ExampleTurboModulePackage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.nitroexample.exampleturbomodule | ||
|
||
import com.facebook.react.TurboReactPackage | ||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.module.model.ReactModuleInfo | ||
import com.facebook.react.module.model.ReactModuleInfoProvider | ||
|
||
class ExampleTurboModulePackage: TurboReactPackage() { | ||
override fun getModule(name: String, context: ReactApplicationContext): NativeModule? { | ||
if (name == ExampleTurboModuleModule.NAME) { | ||
return ExampleTurboModuleModule(context) | ||
} else { | ||
return null | ||
} | ||
} | ||
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider { | ||
mapOf( | ||
ExampleTurboModuleModule.NAME to ReactModuleInfo( | ||
ExampleTurboModuleModule.NAME, | ||
ExampleTurboModuleModule.NAME, | ||
false, // canOverrideExistingModule | ||
false, // needsEagerInit | ||
true, // hasConstants | ||
false, // isCxxModule | ||
true // isTurboModule | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// MGLExampleTurboModule.h | ||
// NitroExample | ||
// | ||
// Created by Marc Rousavy on 13.11.24. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <ExampleTurboModule/ExampleTurboModule.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface ExampleTurboModule : NSObject <NativeExampleTurboModuleSpec> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// MGLExampleTurboModule.mm | ||
// NitroExample | ||
// | ||
// Created by Marc Rousavy on 13.11.24. | ||
// | ||
|
||
#import "MGLExampleTurboModule.h" | ||
|
||
@implementation ExampleTurboModule | ||
|
||
RCT_EXPORT_MODULE() | ||
|
||
- (NSNumber*)addNumbers:(double)a b:(double)b { | ||
NSNumber* result = [[NSNumber alloc] initWithDouble:a + b]; | ||
return result; | ||
} | ||
|
||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule: | ||
(const facebook::react::ObjCTurboModule::InitParams &)params | ||
{ | ||
return std::make_shared<facebook::react::NativeExampleTurboModuleSpecJSI>(params); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
example/ios/NitroExample/Images.xcassets/nos.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "android-chrome-192x192 2.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "android-chrome-192x192 1.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "android-chrome-192x192.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+9.17 KB
example/ios/NitroExample/Images.xcassets/nos.imageset/android-chrome-192x192 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.17 KB
example/ios/NitroExample/Images.xcassets/nos.imageset/android-chrome-192x192 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.17 KB
example/ios/NitroExample/Images.xcassets/nos.imageset/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.