-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
45 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
package/android/src/main/java/com/margelo/filament/FilamentModule.java
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,45 @@ | ||
package com.margelo.filament; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
|
||
public class FilamentModule extends ReactContextBaseJavaModule { | ||
static { | ||
System.loadLibrary("RNFilament"); | ||
} | ||
|
||
private @Nullable FilamentProxy proxy = null; | ||
private final ReactApplicationContext context; | ||
|
||
public FilamentModule(ReactApplicationContext reactContext) { | ||
context = reactContext; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "FilamentModule"; | ||
} | ||
|
||
|
||
@ReactMethod(isBlockingSynchronousMethod = true) | ||
public boolean install() { | ||
try { | ||
proxy = new FilamentProxy(context); | ||
FilamentInstaller.install(proxy); | ||
return true; | ||
} catch (Throwable cause) { | ||
throw new RuntimeException("Failed to initialize react-native-filament! Reason: " + cause.getMessage(), cause); | ||
} | ||
} | ||
|
||
@Override | ||
public void onCatalystInstanceDestroy() { | ||
super.onCatalystInstanceDestroy(); | ||
proxy = null; | ||
} | ||
} |
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
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