Hey, this is an English text. I want you to translate it into the Tunisian dialect.…
- User
Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
- Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
- Highlight sections you are confident translating into the Tunisian dialect. Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:
Q: What is the best way to construct a dropdown and fetch JSON data dynamically from a URL My dropdown has three Items ===> Item0,Item1,Item2 . Every time I select a particular item, I would like to fetch the JSON data and display it on the page (on IOS). I do not understand where exactly to define the onPress event for the Dropdown. Any help would be appreciated. const leveldata = [ { value: 'level1', props: { disabled: true } }, { value: 'level2' }, { value: 'level3' }, ];class TopScores extends Component { constructor(props) { super(props); this.onChangeText = this.onChangeText.bind(this); this.state = { data: [], }; } onChangeText() { if (leveldata.value === 'leve1') { fetch('url') .then((response) => response.json()) .then((responseData) => { this.setState({ newdata: responseData.newdata, }); }) .done(); } else if (leveldata.value === 'level2') { fetch('url1') .then((response) => response.json()) .then((responseData) => { this.setState({ newdata: responseData.newdata, }); }) .done(); } } render() { console.log('data:', this.state.data); return ( <Image /* eslint-disable global-require / source={require('../Images/Top.png')} / eslint-enable global-require */ /> Top Contenders ); } } A: If I remember correctly you need to add the onChangeText prop. import React, { Component } from 'react'; import { Text, View, StyleSheet, Image } from 'react-native'; import { Dropdown } from 'react-native-material-dropdown'; const leveldata = [ { value: 'level1', props: { disabled: true } }, { value: 'level2' }, { value: 'level3' } ]; class TopScores extends Component { constructor(props) { super(props); this.onChangeText = this.onChangeText.bind(this); this.state = { data: [] }; } onChangeText(text) { if(text === 'leve1'){ fetch('url') .then((response) => response.json()) .then((responseData) => { this.setState({ newdata: responseData.newdata, }); }) .done(); } } render() { return ( ); } }
- Assistant