devstepbcn / react-native-android-wifi

A react-native module for viewing and connecting to Wifi networks on Android devices.
ISC License
212 stars 121 forks source link

How do I retrieve a specific Wi-Fi SSID when clicked? #109

Open benjaminle9x opened 3 years ago

benjaminle9x commented 3 years ago

I am setting up a click event on each object of the wifiList array so that when I click on a specific Wi-Fi, it sends an alert message of its SSID. How do I do this?

denizyesilirmak commented 3 years ago

loadWifiList function returns an array that contains ssid's and other informations. If you are populating your wifi list using map, you can assign an alert function on your list items.

          {
            this.state.wifiList.map((e, i) => {
              return (
                  <TouchableOpacity key={i} onPress={() => alert(e.SSID)}>

                  </TouchableOpacity>
              )
            })
          }