안녕하세요
android native module을 만들고 해당 module에다
javascript단에서 [{ name: ‘hello’ }, { name: ‘world’ }]라는 배열을보내서 native단에서 사용을 하고싶습니다.
const array = [{ name: 'hello' }, { name: 'world' }];
MyAwesomeModule.foo(array);
@ReactMethod
public void foo(ReadableArray array) {
for (int i = 0; i< array.size(); i++) {
// 출력: foo: { NativeMap: { "name": "hello" } } ...
Log.d("foo", array.getMap(i).toString());
}
}
위와같이 출력이 됩니다.
제가 원하는건 위에서 list라는 배열을 만들어서 객체를 집어넣고 꺼내서 사용하고싶습니다.
링크한 코드를 참고하여 해봤는데도 제가 언어를 몰라서 그런지 잘 안됩니다.
방법이 있나요?