![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
react-native-wifi-reborn
Advanced tools
A react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.
This project is based on the no longer maintained https://github.com/robwalkerco/react-native-wifi.
$ npm install react-native-wifi-reborn --save
You need use enable Access WIFI Information, with correct profile
You need put "Privacy - Location When In Use Usage Description" or "Privacy - Location Always and When In Use Usage Description" in Settings -> info
Location permission (a runtime permission starting Android 6) is required for some methods (https://github.com/inthepocket/react-native-wifi-reborn#connecttoprotectedssidssid-string-password-string-iswep-boolean-promise). Make sure to request them at runtime: https://facebook.github.io/react-native/docs/permissionsandroid.
This library is correctly autolinked on React Native 60+ 🎉.
While the library is included (via settings.gradle) and added (via build.gradle), you still need to manually added to your MainApplication.
import com.reactlibrary.RNWifiPackage;
public class MainApplication extends NavigationApplication {
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.asList(
...,
new RNWifiPackage());
}
}
$ react-native link react-native-wifi-reborn
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-wifi-reborn
and add RNWifi.xcodeproj
libRNWifi.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)<android/app/src/main/java/[...]/MainActivity.java
import com.reactlibrary.RNWifiPackage;
to the imports at the top of the filenew RNWifiPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-wifi-reborn'
project(':react-native-wifi-reborn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-wifi-reborn/android')
android/app/build.gradle
:
implementation project(':react-native-wifi-reborn')
import WifiManager from "react-native-wifi-reborn";
WifiManager.connectToProtectedSSID(ssid, password, isWep).then(
() => {
console.log("Connected successfully!");
},
() => {
console.log("Connection failed!");
}
);
WifiManager.getCurrentWifiSSID().then(
ssid => {
console.log("Your current connected wifi SSID is " + ssid);
},
() => {
console.log("Cannot get current SSID!");
}
);
The api documentation is in progress.
The following methods work on both Android and iOS
connectToProtectedSSID(SSID: string, password: string, isWEP: boolean): Promise
Returns a promise that resolves when connected or rejects with the error when it couldn't connect to the wifi network.
Type: string
The SSID of the wifi network to connect with.
Type: string
The password of the wifi network to connect with.
Type: boolean
Used on iOS. If YES, the network is WEP Wi-Fi; otherwise it is a WPA or WPA2 personal Wi-Fi network.
notInRange
: The WIFI network is not currently in range.addOrUpdateFailed
: Could not add or update the network configuration.disconnectFailed
: Disconnecting from the network failed. This is done as part of the connect flow.connectNetworkFailed
: Could not connect to network.Use this function when you want to match a known SSID prefix, but don’t have a full SSID. If the system finds multiple Wi-Fi networks whose SSID string matches the given prefix, it selects the network with the greatest signal strength.
Type: string
A prefix string to match the SSID of a Wi-Fi network.
Type: string
The password of the wifi network to connect with.
Type: boolean
Used on iOS. If YES, the network is WEP Wi-Fi; otherwise it is a WPA or WPA2 personal Wi-Fi network.
notInRange
: The WIFI network is not currently in range.
addOrUpdateFailed
: Could not add or update the network configuration.
disconnectFailed
: Disconnecting from the network failed. This is done as part of the connect flow.
connectNetworkFailed
: Could not connect to network.
getCurrentWifiSSID(): Promise
The following methods work only on iOS
connectToSSID(ssid: string): Promise
connectToSSIDPrefix(ssid: string): Promise
disconnectFromSSID(ssid: string): Promise
The following methods work only on Android
loadWifiList(successCallback: function, errorCallback: function)
Method to get a list of nearby WiFI networks.
Type: function
Function to be called if the attempt is successful. It contains a stringified JSONArray of wifiObjects as parameter, each object containing:
SSID
: The network name.BSSID
: The WiFi BSSID.capabilities
: Describes the authentication, key management, and encryption schemes supported by the access point.frequency
: The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.level
: The detected signal level in dBm, also known as the RSSI.timestamp
: timestamp in microseconds (since boot) when this result was last seen.Type: function
Function to be called if any error occurs during the attempt. It contains a string
as parameter with the error message.
WifiManager.loadWifiList(
wifiList => {
let wifiArray = JSON.parse(wifiList);
wifiArray.map((value, index) =>
console.log(`Wifi ${index + 1} - ${value.SSID}`)
);
},
error => console.log(error)
);
/**
Result:
"Wifi 1 - Name of the network"
"Wifi 2 - Name of the network"
"Wifi 3 - Name of the network"
...
*/
reScanAndLoadWifiList(successCallback: function, errorCallback: function)
This method is similar to loadWifiList
but it forcefully starts the wifi scanning on android and in the callback fetches the list.
Same as loadWifiList
.
isEnabled(isEnabled: function)
Method to check if WiFi is enabled.
WifiManager.isEnabled(isEnabled => {
this.setState({wifiIsEnabled: isEnabled});
});
setEnabled(enabled: boolean)
Method to set the WiFi on or off on the user's device.
WifiManager.setEnabled(true); //set WiFi ON
WifiManager.setEnabled(false); //set WiFi OFF
connectionStatus (connectionStatusResult: function)
Indicates whether network connectivity exists and it is possible to establish connections.
Type: function
Called when the network status is resolved. It contains a boolean argument
disconnect
getBSSID
getCurrentSignalStrength
getFrequency
getIP
isRemoveWifiNetwork
Method to force wifi usage if the user needs to send requests via wifi if it does not have internet connection.
If you want to use it, you need to add the android.permission.WRITE_SETTINGS
permission to your AndroidManifest.xml.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
</manifest>
FAQs
A react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.
The npm package react-native-wifi-reborn receives a total of 12,236 weekly downloads. As such, react-native-wifi-reborn popularity was classified as popular.
We found that react-native-wifi-reborn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.