From f899798d4bcb890ce2e28882ba055de6a6598046 Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Tue, 24 Sep 2024 18:45:19 +0200 Subject: [PATCH 1/2] fix: hasItem method typo in jni --- android/src/main/cpp/cpp-adapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/cpp/cpp-adapter.cpp b/android/src/main/cpp/cpp-adapter.cpp index 203fb9a..d1c57df 100644 --- a/android/src/main/cpp/cpp-adapter.cpp +++ b/android/src/main/cpp/cpp-adapter.cpp @@ -117,7 +117,7 @@ bool hasItem(const std::string key) { JNIEnv *jniEnv = GetJniEnv(); java_class = jniEnv->GetObjectClass(java_object); jmethodID hasItemMethodID = - jniEnv->GetMethodID(java_class, "hasitem", "(Ljava/lang/String;)Z"); + jniEnv->GetMethodID(java_class, "hasItem", "(Ljava/lang/String;)Z"); jvalue params[1]; params[0].l = string2jstring(jniEnv, key); From 31f949e9ed626bfb642f6b6a211dd036dff13ea2 Mon Sep 17 00:00:00 2001 From: IvanIhnatsiuk Date: Tue, 24 Sep 2024 18:45:39 +0200 Subject: [PATCH 2/2] feat: add an example with hasItem method --- example/src/App.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/example/src/App.tsx b/example/src/App.tsx index b1b7319..4a67922 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -13,6 +13,7 @@ const testItems = new Array(100).fill(0).map((_, index) => { export default function App() { const [result, setResult] = useState(); + const [hasItem, setHasItem] = useState(false); const [text, setText] = useState(''); const getTestValue = async () => { @@ -44,6 +45,7 @@ export default function App() { {result} + {hasItem ? 'Item exists' : 'Item does not exist'} +