I am trying to create a component using react-native from below JSON format. And this has to be done with-out using any third party components.
- {
- "properties": {
- "taxDetails": {
- "type": "array",
- "items": {
- "properties": {
- "keyValue": {
- "type": "string"
- },
- "keyName": {
- "type": "string"
- },
- "index": {
- "type": "number"
- }
- }
- }
- },
- "upperBody": {
- "type": "array",
- "items": {
- "properties": {
- "keyValue": {
- "type": "string"
- },
- "keyName": {
- "type": "string"
- },
- "index": {
- "type": "number"
- }
- }
- }
- },
- "bodyItems": {
- "type": "object",
- "properties": {
- "itemDetails": {
- "type": "array",
- "items": {
- "properties": {
- "ItemValue": {
- "type": "string"
- },
- "ItemPrice": {
- "type": "string"
- },
- "ItemQty": {
- "type": "string"
- },
- "ItemName": {
- "type": "string"
- }
- }
- }
- },
- "itemCount": {
- "type": "string"
- }
- }
- },
- "paymentDetails": {
- "type": "object",
- "properties": {
- "paymentMeta": {
- "type": "array",
- "items": {
- "properties": {
- "keyValue": {
- "type": "string"
- },
- "keyName": {
- "type": "string"
- },
- "index": {
- "type": "number"
- }
- }
- }
- },
- "paymentType": {
- "type": "string"
- }
- }
- }
- }
- },
- }
By using the above JSON schema, I have to create a template like below.
- <View>
- <Text>{item.keyName}</Text>
- <Text>{item.keyValue}</Text>
- <Text>{item.index}</Text>
- </View>
-
- <View>
- <Text>{item.ItemName}</Text>
- <Text>{item.ItemPrice}</Text>
- <Text>{item.ItemQty}</Text>
- <Text>{item.ItemValue}</Text>
- </View>
If I create a template like that, I can show the values by using other JSON. So can someone please help me in creating a template like above.