@shenai/react-native-sdk 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +5 -0
- package/android/build.gradle +81 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/shenaisdk/ShenaiSdkModule.java +1325 -0
- package/android/src/main/java/com/shenaisdk/ShenaiSdkPackage.java +24 -0
- package/android/src/main/java/com/shenaisdk/ShenaiSdkViewManager.java +37 -0
- package/ios/ShenaiSdkNativeModule.m +1121 -0
- package/ios/ShenaiSdkViewManager.m +37 -0
- package/lib/module/hooks.js +83 -0
- package/lib/module/index.js +667 -0
- package/lib/typescript/src/hooks.d.ts +37 -0
- package/lib/typescript/src/index.d.ts +466 -0
- package/package.json +57 -0
- package/react-native-shenai-sdk.podspec +37 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package ai.mxlabs.shenai_sdk_react_native;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage;
|
|
4
|
+
import com.facebook.react.bridge.NativeModule;
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
7
|
+
|
|
8
|
+
import java.util.Arrays;
|
|
9
|
+
import java.util.Collections;
|
|
10
|
+
import java.util.List;
|
|
11
|
+
|
|
12
|
+
public class ShenaiSdkPackage implements ReactPackage {
|
|
13
|
+
@Override
|
|
14
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
15
|
+
return Collections.singletonList(
|
|
16
|
+
new ShenaiSdkModule(reactContext)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Override
|
|
21
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
22
|
+
return Arrays.<ViewManager>asList(new ShenaiSdkViewManager());
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
package ai.mxlabs.shenai_sdk_react_native;
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
|
|
6
|
+
import androidx.annotation.NonNull;
|
|
7
|
+
|
|
8
|
+
import ai.mxlabs.shenai_sdk.ShenAIView;
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.SimpleViewManager;
|
|
11
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
12
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
13
|
+
|
|
14
|
+
public class ShenaiSdkViewManager extends SimpleViewManager<ShenAIView> {
|
|
15
|
+
public static final String REACT_CLASS = "ShenaiSdkView";
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
@NonNull
|
|
19
|
+
public String getName() {
|
|
20
|
+
return REACT_CLASS;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@NonNull
|
|
24
|
+
@Override
|
|
25
|
+
protected ShenAIView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
|
26
|
+
ShenAIView shenaiView = new ShenAIView(reactContext);
|
|
27
|
+
// You can add lifecycle management here if required
|
|
28
|
+
return shenaiView;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public void onDropViewInstance(@NonNull ShenAIView view) {
|
|
33
|
+
super.onDropViewInstance(view);
|
|
34
|
+
// Handle any cleanup
|
|
35
|
+
view.activityPaused(); // If required
|
|
36
|
+
}
|
|
37
|
+
}
|