I'm trying to pass data into React Native from native Android. The data is an array of objects which consist of actions that should be dispatched. Example
{
"actions: [
{
"authenticationType: "strong",
"type: "AUTHENTICATION_URL",
"url: "https://foo.bar/",
},
],
}
I'm trying to use the com.facebook.react.bridge.Arguments
class to do something like
val arguments = Arguments.createMap().apply {
putString("path", "general/authentication")
putArray("actions",
Arguments.fromList(listOf(
mapOf("authenticationType" to "strong",
"type" to "AUTHENTICATION_URL",
"url" to url
))))
}
but it only results in
09-14 20:08:53.996 10437 10437 I zygote : Thread[1,tid=10437,Native,Thread*=0xb18da000,peer=0x73d2f568,"main"] recursive attempt to load library "/data/app/com.getdreams-MO6VYrPeHVgAkBP2ori8SA==/lib/x86/libfb.so"
Unsure how to create that array of javascript objects.
Has anyone any suggestion of how to perhaps use com.facebook.react.bridge.Arguments
in a better way?
I did solve this only moments later by using the Arguments
class, like so
val action = Arguments.makeNativeMap(
mutableMapOf("authenticationType" to "strong",
"type" to "AUTHENTICATION_URL",
"url" to url) as Map<String, Any>)
val actionArray = Arguments.makeNativeArray(listOf(action))
val arguments = Arguments.createMap().apply {
putString("path", "general/authentication")
putArray("actions",actionArray)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.